[cfe-commits] [PATCH] Implicit fall-through between switch labels
Jordy Rose
jediknil at belkadan.com
Sat Apr 21 09:17:47 PDT 2012
I feel like the common case here is not actually fall-through but a missing break, though like David said there are many other ways to exit a switch. I would expect something like this instead:
warning: fall-through to subsequent switch case
note: use 'break' to prevent fall-through
[fixit]
note: use 'fallthrough' attribute to silence this warning
[fixit]
If we really want to go crazy, we could look and see if 'return' is more appropriate than 'break', but I think probably these would cover the common cases.
Also, the attribute fixit would have to only use square-bracket syntax if it's supported, and possibly disabled altogether if the current language options don't support attributes at all, i.e. non-GNU. (The warning could still be disabled with pragmas, after all.)
Jordy
More information about the cfe-commits
mailing list