This is the mail archive of the gcc-prs@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]

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


>Number:         7652
>Category:       c
>Synopsis:       -Wswitch-break : Warn if a switch case falls through
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 20 07:36:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ac131313@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
Suggest a new -Wswitch variant, -Wswitch-break that warns
when one switch statement falls through to the next one vis:

case (foo)
  {
  case 1: case 2:
    printf ("case 1 and 2\n");
    break;
  case 3: case 4:
    printf ("case 3 and case 4\n");
  case 5:
    printf ("case 5 (and fallthrough for cases 3 and 4\n");
}
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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