This is the mail archive of the
mailing list for the GCC project.
-Wswitch and default case
- From: Tom Tromey <tromey at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: 23 Nov 2001 15:12:46 -0700
- Subject: -Wswitch and default case
- Reply-to: tromey at redhat dot com
I've run into a case where I'd like to use -Wswitch but also have a
default case in my switch.
Suppose I have a switch for something like a bytecode interpreter (my
actual situation is the Java bytecode verifier). I have a large
number of bytecodes, which are in an enum. I'd like to make sure I
don't forget one of the opcodes in one of my switches, so I'd like to
use -Wswitch. But at the same time if there is a bogus bytecode, I'd
like to catch that in a `default' case. Unfortunately the presence of
a default case eliminates whatever utility -Wswitch might have
I know somebody has wanted this before:
Has anybody tried to implement this change?
If not I'll submit a feature request.