This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50422] New: -Wswitch warns about unhandled cases in nested switches
- From: "devel at fresse dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 15 Sep 2011 17:39:11 +0000
- Subject: [Bug c/50422] New: -Wswitch warns about unhandled cases in nested switches
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50422
Bug #: 50422
Summary: -Wswitch warns about unhandled cases in nested
switches
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: devel@fresse.org
Linux plutos 2.6.37.6-0.7-desktop #1 SMP PREEMPT 2011-07-21 02:17:24 +0200
x86_64 x86_64 x86_64 GNU/Linux
freundt@clyde:pts/10:~> gcc --version
gcc (GCC) 4.7.0 20110811 (experimental)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Recipe to reproduce:
freundt@clyde:pts/10:~> gcc -x c -c -Wall -o /dev/null - <<EOF
typedef enum {
NAUGHT,
ONE,
TWO,
} foo_t;
int
test(foo_t arg)
{
switch (arg) {
case NAUGHT:
case ONE:
switch (arg) {
case NAUGHT:
return 0;
case ONE:
return 1;
}
break;
case TWO:
return 2;
}
return -1;
}
EOF
<stdin>: In function 'test':
<stdin>:13:3: warning: enumeration value 'TWO' not handled in switch [-Wswitch]
This is _similar_ to bug 23577 but not quite as nested switches should be
easier to handle than separate fragments.