[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c/7652] -Wswitch-break : Warn if a switch case falls through
From:       "michael.chapman at cortus dot com" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2014-04-30 17:20:10
Message-ID: bug-7652-4-xsPxrkTDsK () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

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:
         ....=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic