Bug#140995: gcc-3.0: -Wswitch (also part of -Wall) is broken
Package: gcc-3.0
Version: 1:3.0.4-6
Severity: normal
-Wswitch doesn't actually seem to do anything in gcc-3.0, although it
works in gcc 2.95.4. Here's what the documentation says it *should*
do:
------------------------------------------------------------------------
`-Wswitch'
Warn whenever a `switch' statement has an index of enumeral 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.
------------------------------------------------------------------------
Here's a sample program:
------------------------------------------------------------------------
enum foo {
FUBAR = 0,
SNAFU = 1
};
int main(void)
{
enum foo boop;
switch (boop) {
case FUBAR:
break;
case 3:
break;
}
return 0;
}
------------------------------------------------------------------------
and here's what happen with gcc 2.95.4:
------------------------------------------------------------------------
volition:~/tmp$ gcc -Wswitch switch.c
switch.c: In function `main':
switch.c:16: warning: enumeration value `SNAFU' not handled in switch
switch.c:16: warning: case value `3' not in enumerated type `foo'
volition:~/tmp$ gcc --version
2.95.4
volition:~/tmp$
------------------------------------------------------------------------
but here's what happens with gcc-3.0:
------------------------------------------------------------------------
volition:~/tmp$ gcc-3.0 -Wswitch switch.c
volition:~/tmp$
------------------------------------------------------------------------
I normally compile with gcc 3.0 since it has so many more warnings
that I can turn on, so this is somewhat disheartening :-(
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux volition 2.4.18volition #1 Thu Mar 28 20:13:24 PST 2002 i686
Locale: LANG=C, LC_CTYPE=
Versions of packages gcc-3.0 depends on:
ii binutils 2.12.90.0.1-1 The GNU assembler, linker and bina
ii cpp-3.0 1:3.0.4-6 The GNU C preprocessor.
ii gcc-3.0-base 1:3.0.4-6 The GNU Compiler Collection (base
ii libc6 2.2.5-3 GNU C Library: Shared libraries an
ii libgcc1 1:3.0.4-6 GCC support library.
--
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: