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: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Jun 2013 06:43:52 +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
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcb314 at hotmail dot com
--- Comment #17 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Daniel MarjamÃki from comment #7)
> In my experience this type of check is really noisy if there is a warning
> for every fall through.
>
> I recommend that the warning is written only if the fall through cause
> redundant or bad behaviour. such as:
>
> switch (foo) {
> case 1: x = y; // <- redundant assignment
> case 2: x = z;
> };
I'd be happy with gcc warning for this kind of problem.
This specific case should be easier to catch than the
general case.