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

ac131313@redhat.com ac131313@redhat.com
Tue Aug 20 07:36:00 GMT 2002


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



More information about the Gcc-prs mailing list