Fix all implicit case fallthrough (#287)#294
Conversation
spe-ciellt
left a comment
There was a problem hiding this comment.
One old bug found, but was fixed in the wrong way.
Hard blocker —
|
| Location | Assessment |
|---|---|
amacro.c — case '0' → case '1' |
Correct — '0' mid-expression is a digit |
callbacks.c — LAYER_SELECTED → default |
Correct — replaces /* No break */ which didn't match GCC's regex |
csv.c (×2) — ST_START → ST_COLLECT |
Correct — standard state machine optimization |
main.c — case 'w' → case 'W' |
Correct — intentional shared getopt handling |
The three existing /* fall through */ comments in scheme.c are correctly left untouched — GCC level 3 already accepts them.
When you fixed it, amend it into current commit and push it --force--with-lease.
) 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
d87216b to
e7e10d6
Compare
|
Fixed both — |
Summary
-Wimplicit-fallthroughinCMakeLists.txtcompiler flags[[fallthrough]];attributeChanges
src/amacro.ccase '0':→case '1':src/callbacks.cSAVE_FILE_RS274XM→SAVE_FILE_DRILLsrc/callbacks.cLAYER_SELECTED→defaultsrc/csv.c(×2)ST_START→ST_COLLECTsrc/drill.ccase 'R':→case 'S':src/main.ccase 'w':→case 'W':Test plan
-Wimplicit-fallthroughwarningstest-amacro-hex-expression.gbxexports correctlytest-gerber-x2-attributes.gbxexports correctlyCloses #287