\f
/* Switches common to the C front ends. */
-/* Nonzero if prepreprocessing only. */
+/* Nonzero if preprocessing only. */
int flag_preprocess_only;
int print_struct_values;
-/* Tells the compiler what is the constant string class for Objc. */
+/* Tells the compiler what is the constant string class for ObjC. */
const char *constant_string_class_name;
c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)),
c_common_truthvalue_conversion (TREE_OPERAND (expr, 2)));
- case CONVERT_EXPR:
- case NOP_EXPR:
+ CASE_CONVERT:
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
since that affects how `default_conversion' will behave. */
if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE
tree best = t;
int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- while ((TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR)
+ while (CONVERT_EXPR_P (t)
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
{
int thisalign;
return 1;
}
-/* Recursively examines the array elements of TYPE, until a non-array
- element type is found. */
-
-tree
-strip_array_types (tree type)
-{
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
-
- return type;
-}
-
/* Recursively remove any '*' or '&' operator from TYPE. */
tree
strip_pointer_operator (tree t)
}
/* Even though there wasn't an exact match, there might be a
- case range which includes the enumator's value. */
+ case range which includes the enumerator's value. */
node = splay_tree_predecessor (cases, (splay_tree_key) value);
if (node && CASE_HIGH ((tree) node->value))
{
int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (TREE_CODE (*node) == FUNCTION_DECL)
- DECL_IS_PURE (*node) = 1;
+ DECL_PURE_P (*node) = 1;
/* ??? TODO: Support types. */
else
{
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
- /* Ensure we have a function type, with no arguments. */
- gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE && ! TYPE_ARG_TYPES (*node));
+ tree params;
+
+ /* Ensure we have a function type. */
+ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
+
+ params = TYPE_ARG_TYPES (*node);
+ while (params && ! VOID_TYPE_P (TREE_VALUE (params)))
+ params = TREE_CHAIN (params);
+
+ /* Ensure we have a variadic function. */
+ gcc_assert (!params);
return NULL_TREE;
}
void *ctx, tree param,
unsigned HOST_WIDE_INT param_num)
{
- if ((TREE_CODE (param) == NOP_EXPR || TREE_CODE (param) == CONVERT_EXPR)
+ if (CONVERT_EXPR_P (param)
&& (TYPE_PRECISION (TREE_TYPE (param))
== TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (param, 0)))))
{
case BUILT_IN_ISFINITE:
case BUILT_IN_ISINF:
+ case BUILT_IN_ISINF_SIGN:
case BUILT_IN_ISNAN:
case BUILT_IN_ISNORMAL:
if (validate_nargs (fndecl, nargs, 1))
}
return false;
+ case BUILT_IN_FPCLASSIFY:
+ if (validate_nargs (fndecl, nargs, 6))
+ {
+ unsigned i;
+
+ for (i=0; i<5; i++)
+ if (TREE_CODE (args[i]) != INTEGER_CST)
+ {
+ error ("non-const integer argument %u in call to function %qE",
+ i+1, fndecl);
+ return false;
+ }
+
+ if (TREE_CODE (TREE_TYPE (args[5])) != REAL_TYPE)
+ {
+ error ("non-floating-point argument in call to function %qE",
+ fndecl);
+ return false;
+ }
+ return true;
+ }
+ return false;
+
default:
return true;
}
warning (OPT_Wchar_subscripts, "array subscript has type %<char%>");
}
-/* Warn about obvious array bounds errors for fixed size arrays that
- are indexed by a constant. This is a subset of similar checks in
- tree-vrp.c; by doing this here we can get some level of checking
- from non-optimized, non-vrp compilation. Returns true if a warning
- is issued. */
-
-bool
-warn_array_subscript_range (const_tree array, const_tree index)
-{
- if (skip_evaluation == 0
- && TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
- && TYPE_DOMAIN (TREE_TYPE (array)) && TREE_CODE (index) == INTEGER_CST)
- {
- const_tree max_index;
-
- max_index = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (array)));
- if (max_index && TREE_CODE (max_index) == INTEGER_CST
- && tree_int_cst_lt (max_index, index)
- && !tree_int_cst_equal (index, max_index)
- /* Always allow off-by-one. */
- && !tree_int_cst_equal (int_const_binop (PLUS_EXPR,
- max_index,
- integer_one_node,
- 0),
- index)
- /* Accesses after the end of arrays of size 0 (gcc
- extension) and 1 are likely intentional ("struct
- hack"). Note that max_index is array dimension - 1. */
- && compare_tree_int (max_index, 1) >= 0)
- {
- warning (OPT_Warray_bounds,
- "array subscript is above array bounds");
- return true;
- }
- else
- {
- const_tree min_index;
-
- min_index = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (array)));
- if (min_index && TREE_CODE (min_index) == INTEGER_CST
- && tree_int_cst_lt (index, min_index))
- {
- warning (OPT_Warray_bounds,
- compare_tree_int (min_index, 0) == 0
- ? "array subscript is negative"
- : "array subscript is below array bounds");
- return true;
- }
- }
- }
-
- return false;
-}
-
/* Implement -Wparentheses for the unexpected C precedence rules, to
cover cases like x + y << z which readers are likely to
misinterpret. We have seen an expression in which CODE is a binary