https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432
Peter Eisentraut <peter at eisentraut dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |peter at eisentraut dot org
--- Comment #9 from Peter Eisentraut <peter at eisentraut dot org> ---
I came across this issue. Indeed, other compilers (clang, MSVC) warn about
this. Now that C and C++ have quasi-standardized the fall-through warnings, it
would be great if compilers handled the edge cases consistently.
A reading of C23 suggests that a warning is recommended here. The description
of the fallthrough attribute (6.7.13.6 in C23) says:
"""
The use of a fallthrough declaration is intended to suppress a diagnostic that
an implementation may otherwise issue for a case or default label that is
reachable from another case or default label along some path of execution.
"""
Note that it talks about whether a case or default label is reachable from
another case or default label, but not about whether the reached case or
default label does anything of substance. (Of course, this is only a
recommendation.)