https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127722

            Bug ID: 127722
           Summary: gcc --implicit-fallthrough documentation should
                    mention consecutive case labels
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Keith.S.Thompson at gmail dot com
  Target Milestone: ---

The "-Wimplicit-fallthrough" option causes gcc to warn about a 
missing "break" statement in a switch statement. It has a number
of options that are irrelevant to this report.

If you have two or more consecutive case labels, that is strictly
speaking a "fallthrough":

switch (foo) {
    case 0:
    case 1:
        // blah blah
        break;
    case 2:
        // blah blah
        break;
}

gcc quite reasonably doesn't warn about it, and I'm not suggesting 
that it should -- but the documentation doesn't mention this case.

I suggest adding some wording, probably one sentence with a brief 
example, saying that "case 0: case 1:" is not considered a 
"fallthrough" for warning purposes.

The change would be in gcc/doc/invoke.texi .

(This is not a serious problem.  I have not been inconvenienced by
it, other than a few minutes looking into it.)

Reply via email to