Skip to content

Fix all implicit case fallthrough (#287)#1

Merged
rampageservices merged 1 commit intodevelopfrom
fix/case-fallthrough
Mar 1, 2026
Merged

Fix all implicit case fallthrough (#287)#1
rampageservices merged 1 commit intodevelopfrom
fix/case-fallthrough

Conversation

@rampageservices
Copy link
Copy Markdown

Summary

  • Enable -Wimplicit-fallthrough in CMakeLists.txt compiler flags
  • Annotate all intentional case fallthroughs with C23 [[fallthrough]]; attribute

Changes

File Location Fallthrough
src/amacro.c case '0':case '1': Comment is conditionally consumed, otherwise falls through to digit parsing
src/callbacks.c SAVE_FILE_RS274XMSAVE_FILE_DRILL Merged visible layers export shares drill export path
src/callbacks.c LAYER_SELECTEDdefault Resolves selected index then falls to default toggle logic
src/csv.c (×2) ST_STARTST_COLLECT State-machine transition (char and wchar_t variants)
src/drill.c case 'R':case 'S': Repeat-hole command falls through to spindle speed handler
src/main.c case 'w':case 'W': Lowercase sets pixel flag then shares window-size parsing

Test plan

  • Clean build with zero -Wimplicit-fallthrough warnings
  • 94/104 regression tests pass (same 10 pre-existing rendering mismatches)
  • Functional test: test-amacro-hex-expression.gbx exports correctly
  • Functional test: test-gerber-x2-attributes.gbx exports correctly

Upstream PR: gerbv#294
Closes gerbv#287 (upstream)

)

Enable -Wimplicit-fallthrough and add [[fallthrough]] annotations
to intentional case fallthroughs in amacro.c, callbacks.c, csv.c,
and main.c.

Fix two bugs exposed by the review:
- drill.c case 'R' was falling through to case 'S', causing
  eat_line() to consume the next drill command after repeat-hole
- callbacks.c SAVE_FILE_RS274XM was falling through to
  SAVE_FILE_DRILL, presenting a drill dialog for RS-274X export
@rampageservices
Copy link
Copy Markdown
Author

Fixed both — drill.c case 'R' and callbacks.c RS274XM now have break; instead of [[fallthrough]];. Force-pushed the amended commit.

@rampageservices rampageservices merged commit ebcbc1f into develop Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix all case fallthrough

1 participant