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

--- Comment #3 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
I've been studying the C23 wording.

In C17 and earlier, "case 1: break;" is a labeled-statement, and control
jumps to that statement when foo==0. This is arguably a "fallthrough",
but it seems clear that gcc should not warn about it.

In C23, "case 1: break;" is a sequence of two block-items, and control
jumps directly to the "break;" statement, so there is no fallthrough.
(C23 still has the syntactic construct "labeled-statement", but it
occurs rarely, only when the label is not at the top level of an enclosing
compound-statement.)

I don't suggest going into all this detail in the documentation.
I suggest that there should be some *brief* wording pointing out that

    case 0:
    case 1:
        some_statement;

is not considered "fallthrough" for purposes of the "-Wimplicit-fallthrough"
option.

Or just leave the documentation as it is, since I may well be the only
person who's noticed this.

Reply via email to