This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/7652: -Wswitch-break : Warn if a switch case falls through
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: bangerth at dealii dot org, ac131313 at redhat dot com, gcc-bugs at gcc dot gnu dot org,gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Wed, 27 Nov 2002 10:46:08 -0500
- Subject: Re: c/7652: -Wswitch-break : Warn if a switch case falls through
- References: <20021127152104.9279.qmail@sources.redhat.com>
Synopsis: -Wswitch-break : Warn if a switch case falls through
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Nov 27 07:21:03 2002
State-Changed-Why:
I doubt warning if a switch case falls through is a useful
feature since it is so commonly used in a reasonable way.
Note that if you write
case 1: case 2:
you are actually using this, since the "case 1" simply falls
through to the "case 2"...
But I leave it to others to judge whether this would be
useful.
W.
I've been informed that GCC can differentiate between `case 1: case 2:'
and a fall through (something about just needing to check for a branch
at the end of a switch case block).
Please also remember that, just like all the other -W flags, this is a tool
Like all tools, it can can be used in ways that either help or hinder
the user. A skilled user (aka a toolsmith) is, however, capable of
determining if/when a tool is applicable.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7652