This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/7652] -Wswitch-break : Warn if a switch case falls through


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:
         ....

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]