[Bug c/7652] -Wswitch-break : Warn if a switch case falls through
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 30 16:54:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
--- Comment #31 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #30)
> (In reply to Manuel López-Ibáñez from comment #29)
>
> > I like the previous suggestion of using "goto LABEL;". In fact, the warning
> > message could explicitly say "use %<goto %D;%> to silence this warning".
>
> Does this mean that you propose a GCC extension which allows to write this?
>
> goto 5;
> case 5:
Sorry, ignore my comment. I am not sure what I was thinking....
__builtin_fallthrough() seems fine enough. It could be mentioned by the warning
message. But as you said, it would be better to detect as many false positives
as possible to avoid forcing people to use the __builtin work-around.
More information about the Gcc-bugs
mailing list