This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Warn if switch has boolean value (PR c/60439)
- From: Marek Polacek <polacek at redhat dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 18 Apr 2014 08:00:45 +0200
- Subject: Re: [C PATCH] Warn if switch has boolean value (PR c/60439)
- Authentication-results: sourceware.org; auth=none
- References: <20140418053021 dot GH20332 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1404180742210 dot 3692 at laptop-mg dot saclay dot inria dot fr>
On Fri, Apr 18, 2014 at 07:49:22AM +0200, Marc Glisse wrote:
> On Fri, 18 Apr 2014, Marek Polacek wrote:
>
> >This patch implements a new warning that warns when controlling
> >expression of a switch has boolean value. (Intentionally I don't
> >warn if the controlling expression is (un)signed:1 bit-field.)
> >I guess the question is if this should be enabled by default or
> >deserves some new warning option. Since clang does the former,
> >I did it too and currently this warning is enabled by default.
>
> It can be enabled by -Wsome-name which is itself enabled by default but
> at least gives the possibility to use -Wno-some-name, -Werror=some-name,
> etc. No? I believe Manuel insists regularly that no new warning should
> use 0 (and old ones should progressively lose it).
Yes, that's the other possibility and exactly what I wanted to
discuss. I think I'll prepare another version with -Wswitch-bool (and
documentation).
Marek