m3-sys/m3cc/gcc-4.5/gcc/c-common.c
/* See if the case values LOW and HIGH are in the range of the original
   type (i.e. before the default conversion to int) of the switch testing
   expression.
   TYPE is the promoted type of the testing expression, and ORIG_TYPE is
   the type before promoting it.  CASE_LOW_P is a pointer to the lower
   bound of the case label, and CASE_HIGH_P is the upper bound or NULL
   if the case is not a case range.
   The caller has to make sure that we are not called with NULL for
   CASE_LOW_P (i.e. the default case).
   Returns true if the case label is in range of ORIG_TYPE (saturated or
   untouched) or false if the label is out of range.  */
See if the case values LOW and HIGH are in the range of the original
type  of the switch testing
expression.
TYPE is the promoted type of the testing expression, and ORIG_TYPE is
the type before promoting it.  CASE_LOW_P is a pointer to the lower
bound of the case label, and CASE_HIGH_P is the upper bound or NULL
if the case is not a case range.
The caller has to make sure that we are not called with NULL for
CASE_LOW_P .
Returns true if the case label is in range of ORIG_TYPE (saturated or
untouched) or false if the label is out of range.
See if the case values LOW and HIGH are in the range of the original type of the switch testing expression . TYPE is the promoted type of the testing expression and ORIG_TYPE is the type before promoting it . CASE_LOW_P is a pointer to the lower bound of the case label and CASE_HIGH_P is the upper bound or NULL if the case is not a case range . The caller has to make sure that we are not called with NULL for CASE_LOW_P . Returns true if the case label is in range of ORIG_TYPE ( saturated or untouched ) or false if the label is out of range .
static bool
check_case_bounds (tree type, tree orig_type,
		   tree *case_low_p, tree *case_high_p)
{
  tree min_value, max_value;
  tree case_low = *case_low_p;
  tree case_high = case_high_p ? *case_high_p : case_low;
  if (orig_type == error_mark_node)
    return true;
  min_value = TYPE_MIN_VALUE (orig_type);
  max_value = TYPE_MAX_VALUE (orig_type);
  if (tree_int_cst_compare (case_low, min_value) < 0
      && tree_int_cst_compare (case_high, min_value) < 0)
    {
      warning (0, "case label value is less than minimum value for type");
      return false;
    }
  if (tree_int_cst_compare (case_low, max_value) > 0
      && tree_int_cst_compare (case_high, max_value) > 0)
    {
      warning (0, "case label value exceeds maximum value for type");
      return false;
    }
  if (tree_int_cst_compare (case_high, min_value) >= 0
      && tree_int_cst_compare (case_low, min_value) < 0)
    {
      warning (0, "lower value in case label range"
	       " less than minimum value for type");
      case_low = min_value;
    }
  if (tree_int_cst_compare (case_low, max_value) <= 0
      && tree_int_cst_compare (case_high, max_value) > 0)
    {
      warning (0, "upper value in case label range"
	       " exceeds maximum value for type");
      case_high = max_value;
    }
  if (*case_low_p != case_low)
    *case_low_p = convert (type, case_low);
  if (case_high_p && *case_high_p != case_high)
    *case_high_p = convert (type, case_high);
  return true;
}
static bool check_case_bounds ( tree type , tree orig_type , tree * case_low_p , tree * case_high_p ) { tree min_value , max_value ; tree case_low = * case_low_p ; tree case_high = case_high_p ? * case_high_p : case_low ; if ( orig_type == error_mark_node ) return true ; min_value = TYPE_MIN_VALUE ( orig_type ) ; max_value = TYPE_MAX_VALUE ( orig_type ) ; if ( tree_int_cst_compare ( case_low , min_value ) < 0 && tree_int_cst_compare ( case_high , min_value ) < 0 ) { warning ( 0 , " " ) ; return false ; } if ( tree_int_cst_compare ( case_low , max_value ) > 0 && tree_int_cst_compare ( case_high , max_value ) > 0 ) { warning ( 0 , " " ) ; return false ; } if ( tree_int_cst_compare ( case_high , min_value ) >= 0 && tree_int_cst_compare ( case_low , min_value ) < 0 ) { warning ( 0 , " " " " ) ; case_low = min_value ; } if ( tree_int_cst_compare ( case_low , max_value ) <= 0 && tree_int_cst_compare ( case_high , max_value ) > 0 ) { warning ( 0 , " " " " ) ; case_high = max_value ; } if ( * case_low_p != case_low ) * case_low_p = convert ( type , case_low ) ; if ( case_high_p && * case_high_p != case_high ) * case_high_p = convert ( type , case_high ) ; return true ; }
See if the case values LOW and HIGH are in the range of the original
type (i.e.
See if the case values LOW and HIGH are in the range of the original type ( i . e .
/* If there was a problem with the original type, do nothing.  */ /* Case label is less than minimum for type.  */ /* Case value is greater than maximum for type.  */ /* Saturate lower case label value to minimum.  */ /* Saturate upper case label value to maximum.  */