This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: enumeration value ... not handled in switch
- To: SchirmerH at Innovative-Systems dot de
- Subject: Re: enumeration value ... not handled in switch
- From: Joerg Faschingbauer <jfasch at aon dot at>
- Date: Wed, 26 Sep 2001 15:25:51 +0500
- Cc: gcc at gcc dot gnu dot org, hartmut dot schirmer at arcormail dot de
- References: <1F5C7ECB324CD411B58600D0B723F181779402@oehhex01.becker.de>
From: "Schirmer, Hartmut" <SchirmerH@Innovative-Systems.de>
Subject: enumeration value ... not handled in switch
Date: Mon, 24 Sep 2001 10:06:21 +0200
> Hi,
>
> is there any way to tell GCC to warn about unhandled
> enum values in switch-case statements even if a default
> case is present?
>
> Currently I have to do ugly things like
>
> flag = 0;
> switch ( e )
> {
> case e1: flag = 1; break;
> case e2: flag = 1; break;
> }
> if ( !flag )
> {
> // default case
> }
>
> to get both, the default case and the warning.
>
> Adding an attribute to default: would be ok in this case.
This is bug #3780. I'll be cleaning up my patch a bit (although it
won't become less dirty by doing so :-) and submit it. (This won't
happen before two weeks, though.)
Joerg