enumeration value ... not handled in switch

Schirmer, Hartmut SchirmerH@Innovative-Systems.de
Mon Sep 24 01:04:00 GMT 2001


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.

Thanks,
Hartmut



More information about the Gcc mailing list