This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Wswitch and default case


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
provided.

I know somebody has wanted this before:

    http://gcc.gnu.org/ml/gcc/2000-11/msg00854.html

Has anybody tried to implement this change?
If not I'll submit a feature request.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]