This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/7652] -Wswitch-break : Warn if a switch case falls through
- From: "michael.chapman at cortus dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Apr 2014 17:20:10 +0000
- Subject: [Bug c/7652] -Wswitch-break : Warn if a switch case falls through
- Auto-submitted: auto-generated
- References: <bug-7652-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
--- Comment #33 from Michael Chapman <michael.chapman at cortus dot com> ---
(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:
>
> I'm not sure if the extension is worth it, and it creates another source of
> errors/unclarities if another switch branch is inserted before "case 5:".
> It looks like fall-through, but it isn't one because the case labels aren't
> aligned.
Why an extension? What is wrong with:-
goto case_5;
case 5: case_5:
....