m3-sys/m3cc/gcc-4.5/gcc/c-common.c
/* Validate the expression after `case' and apply default promotions.  */
Validate the expression after `case' and apply default promotions.
Validate the expression after ` case ' and apply default promotions .
static tree
check_case_value (tree value)
{
  if (value == NULL_TREE)
    return value;
  STRIP_TYPE_NOPS (value);
  if (c_dialect_cxx ())
    {
      value = decl_constant_value (value);
      STRIP_TYPE_NOPS (value);
      value = fold (value);
    }
  if (TREE_CODE (value) == INTEGER_CST)
    value = perform_integral_promotions (value);
  else if (value != error_mark_node)
    {
      error ("case label does not reduce to an integer constant");
      value = error_mark_node;
    }
  constant_expression_warning (value);
  return value;
}
static tree check_case_value ( tree value ) { if ( value == NULL_TREE ) return value ; STRIP_TYPE_NOPS ( value ) ; if ( c_dialect_cxx ( ) ) { value = decl_constant_value ( value ) ; STRIP_TYPE_NOPS ( value ) ; value = fold ( value ) ; } if ( TREE_CODE ( value ) == INTEGER_CST ) value = perform_integral_promotions ( value ) ; else if ( value != error_mark_node ) { error ( " " ) ; value = error_mark_node ; } constant_expression_warning ( value ) ; return value ; }
Validate the expression after `case' and apply default promotions.
Validate the expression after ` case ' and apply default promotions .
/* ??? Can we ever get nops here for a valid case value?  We
     shouldn't for C.  */ /* In C++, the following is allowed:

       const int i = 3;
       switch (...) { case i: ... }

     So, we try to reduce the VALUE to a constant that way.  */ /* Promote char or short to int.  */