This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wswitch-enum and -Wswitch-default
- From: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- To: "Ching, Jimen (US SSA)" <jimen dot ching at baesystems dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 31 Mar 2007 15:29:34 +0100
- Subject: Re: -Wswitch-enum and -Wswitch-default
- References: <5712874E51C67B4E8BE9408DED619D7A43943F@blums0015.bluelnk.net>
On 30/03/07, Ching, Jimen (US SSA) <jimen.ching@baesystems.com> wrote:
Hi,
I'm using g++ 4.1.1 under Fedora Core 5 in an X86 system.
I read the GCC manual and it says -Wall includes the -Wswitch-enum
and -Wswitch-default warnings. But I had to supply these command
line options explicitly before the warnings are generated. Is the
manual wrong or is there a bug in g++?
Thanks in advance for any help.
Does it really say that? Can you quote the paragraph? The manual for
GCC 4.1.1 available at
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Warning-Options.html#Warning-Options
says:
-Wswitch
Warn whenever a switch statement has an index of enumerated type
and lacks a case for one or more of the named codes of that
enumeration. (The presence of a default label prevents this warning.)
case labels outside the enumeration range also provoke warnings when
this option is used. This warning is enabled by -Wall.
-Wswitch-default
Warn whenever a switch statement does not have a default case.
-Wswitch-enum
Warn whenever a switch statement has an index of enumerated type
and lacks a case for one or more of the named codes of that
enumeration. case labels outside the enumeration range also provoke
warnings when this option is used.
Therefore, only -Wswitch is enabled by -Wall but neither of
Wswitch-default or Wswitch-enum are.
Cheers,
Manuel.