An end to implicit fall-throughs in the kernel
An end to implicit fall-throughs in the kernel
Posted Aug 15, 2019 10:18 UTC (Thu) by ksandstr (guest, #60862)In reply to: An end to implicit fall-throughs in the kernel by rweikusat2
Parent article: An end to implicit fall-throughs in the kernel
The underlying problem here is that switch-case is, with seeming regularity, learned as "what C has for select-case in Visual Basic". That, like many common assumptions regarding C-family languages, is very wrong.
Thirdly, the compiler-oriented solution implies that review will actually compile submitted code and has both care and cojones to require warnings fixed. If that's the case, nice; but I'm not even convinced that any of these "fix fallthru warning" patches' cases were hit in a specific test first to determine that fallthru is actually the correct behaviour. Done wrong, that could be worse than changing nothing.
Posted Aug 15, 2019 17:34 UTC (Thu)
by mpr22 (subscriber, #60784)
[Link] (2 responses)
It seems to me that "this case label has no statements between it and the next case label" is fairly readily distinguishable from "this case label has statements between it and the next case label, but those statements do not include a break; statement".
Posted Aug 15, 2019 20:29 UTC (Thu)
by mjg59 (subscriber, #23239)
[Link] (1 responses)
Posted Aug 16, 2019 15:02 UTC (Fri)
by nybble41 (subscriber, #55106)
[Link]
The "implicit fall-through for adjacent case labels" situation doesn't really exist, so there's no need for special handling in -Wimplicit-fallthrough. Labels apply to the following statement; when you have a list of labels with no intervening statements, every label in the list is associated with the same statement at the end, not the next label. You can never end up branching into the middle of a group of labels, so there is no fall-through.
An end to implicit fall-throughs in the kernel
An end to implicit fall-throughs in the kernel
An end to implicit fall-throughs in the kernel
