This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/7652] -Wswitch-break : Warn if a switch case falls through
- From: "fweimer at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Apr 2014 16:18:03 +0000
- Subject: [Bug c/7652] -Wswitch-break : Warn if a switch case falls through
- Auto-submitted: auto-generated
- References: <bug-7652-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
--- Comment #25 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Matthew Woehlke from comment #22)
> case B:
> ...
> [[gcc:fallthrough]] // suppress warning for fall-through to 'case C'
Do we have such attributes in the C compiler?
I contemplated using any comment whatsoever as an indicator that fall-through
is expected.
In the end, need general (syntax-based) unreachable-code detection, so that
return statements and no-return functions suppress the warning as well, and so
on. At least if this will be part of -Wall.