*/
tree c_global_trees[CTI_MAX];
-
-/* TRUE if a code represents a statement. The front end init
- langhook should take care of initialization of this array. */
-
-bool statement_code_p[MAX_TREE_CODES];
\f
/* Switches common to the C front ends. */
int warn_format;
+/* Warn about using __null (as NULL in C++) as sentinel. For code compiled
+ with GCC this doesn't matter as __null is guaranteed to have the right
+ size. */
+
+int warn_strict_null_sentinel;
+
/* Zero means that faster, ...NonNil variants of objc_msgSend...
calls will be used in ObjC; passing nil receivers to such calls
will most likely result in crashes. */
int flag_nil_receivers = 1;
-/* Nonzero means that we will allow new ObjC exception syntax (@throw,
- @try, etc.) in source code. */
-int flag_objc_exceptions = 0;
-
-/* Nonzero means that we generate NeXT setjmp based exceptions. */
-int flag_objc_sjlj_exceptions = -1;
-
/* Nonzero means that code generation will be altered to support
"zero-link" execution. This currently affects ObjC only, but may
affect other languages in the future. */
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning ("integer overflow in expression");
+ warning (0, "integer overflow in expression");
}
else if ((TREE_CODE (value) == REAL_CST
|| (TREE_CODE (value) == COMPLEX_CST
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning ("floating point overflow in expression");
+ warning (0, "floating point overflow in expression");
}
else if (TREE_CODE (value) == VECTOR_CST && TREE_OVERFLOW (value))
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning ("vector overflow in expression");
+ warning (0, "vector overflow in expression");
}
}
{
if (!int_fits_type_p (operand, c_common_signed_type (type)))
/* This detects cases like converting -129 or 256 to unsigned char. */
- warning ("large integer implicitly truncated to unsigned type");
- else if (warn_conversion)
- warning ("negative integer implicitly converted to unsigned type");
+ warning (0, "large integer implicitly truncated to unsigned type");
+ else
+ warning (OPT_Wconversion,
+ "negative integer implicitly converted to unsigned type");
}
}
|| !constant_fits_type_p (expr,
c_common_unsigned_type (type)))
&& skip_evaluation == 0)
- warning ("overflow in implicit constant conversion");
+ warning (0, "overflow in implicit constant conversion");
}
else
unsigned_conversion_warning (t, expr);
&& DECL_NAME (list->expr))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
- warning ("operation on %qE may be undefined", list->expr);
+ warning (0, "operation on %qE may be undefined", list->expr);
}
list = list->next;
}
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 (satured or
+ 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
if (tree_int_cst_compare (case_low, min_value) < 0
&& tree_int_cst_compare (case_high, min_value) < 0)
{
- warning ("case label value is less than minimum value for type");
+ 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 ("case label value exceeds maximum value for type");
+ 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 ("lower value in case label range"
+ 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 ("upper value in case label range"
+ warning (0, "upper value in case label range"
" exceeds maximum value for type");
case_high = max_value;
}
if (TREE_CODE (primop0) != INTEGER_CST)
{
if (val == truthvalue_false_node)
- warning ("comparison is always false due to limited range of data type");
+ warning (0, "comparison is always false due to limited range of data type");
if (val == truthvalue_true_node)
- warning ("comparison is always true due to limited range of data type");
+ warning (0, "comparison is always true due to limited range of data type");
}
if (val != 0)
&& !(TREE_CODE (primop0) == INTEGER_CST
&& !TREE_OVERFLOW (convert (c_common_signed_type (type),
primop0))))
- warning ("comparison of unsigned expression >= 0 is always true");
+ warning (0, "comparison of unsigned expression >= 0 is always true");
value = truthvalue_true_node;
break;
&& !(TREE_CODE (primop0) == INTEGER_CST
&& !TREE_OVERFLOW (convert (c_common_signed_type (type),
primop0))))
- warning ("comparison of unsigned expression < 0 is always false");
+ warning (0, "comparison of unsigned expression < 0 is always false");
value = truthvalue_false_node;
break;
{
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
- warning ("the address of %qD, will always evaluate as %<true%>",
+ warning (0, "the address of %qD, will always evaluate as %<true%>",
TREE_OPERAND (expr, 0));
return truthvalue_true_node;
}
two objects. */
if (TREE_TYPE (TREE_OPERAND (expr, 0))
== TREE_TYPE (TREE_OPERAND (expr, 1)))
- return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0),
- TREE_OPERAND (expr, 1), 1);
- return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0),
- fold (build1 (NOP_EXPR,
- TREE_TYPE (TREE_OPERAND (expr, 0)),
- TREE_OPERAND (expr, 1))), 1);
+ return fold_build2 (NE_EXPR, truthvalue_type_node,
+ TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 1));
+ return fold_build2 (NE_EXPR, truthvalue_type_node,
+ TREE_OPERAND (expr, 0),
+ fold_convert (TREE_TYPE (TREE_OPERAND (expr, 0)),
+ TREE_OPERAND (expr, 1)));
case BIT_AND_EXPR:
if (integer_onep (TREE_OPERAND (expr, 1))
break;
case MODIFY_EXPR:
- if (warn_parentheses && !TREE_NO_WARNING (expr))
- warning ("suggest parentheses around assignment used as truth value");
+ if (!TREE_NO_WARNING (expr))
+ warning (OPT_Wparentheses,
+ "suggest parentheses around assignment used as truth value");
break;
default:
mudflap_init ();
main_identifier_node = get_identifier ("main");
+
+ /* Create the built-in __null node. It is important that this is
+ not shared. */
+ null_node = make_node (INTEGER_CST);
+ TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0);
}
/* Look up the function in built_in_decls that corresponds to DECL
high_value = NULL_TREE;
if (low_value && high_value
&& !tree_int_cst_lt (low_value, high_value))
- warning ("empty range specified");
+ warning (0, "empty range specified");
/* See if the case is in range of the type of the original testing
expression. If both low_value and high_value are out of range,
TREE_INT_CST_HIGH (key), TREE_INT_CST_LOW (key));
if (TYPE_NAME (type) == 0)
- warning ("%Jcase value %qs not in enumerated type",
+ warning (0, "%Jcase value %qs not in enumerated type",
CASE_LABEL (label), buf);
else
- warning ("%Jcase value %qs not in enumerated type %qT",
+ warning (0, "%Jcase value %qs not in enumerated type %qT",
CASE_LABEL (label), buf, type);
}
return;
default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
- if (warn_switch_default && !default_node)
- warning ("%Hswitch missing default case", &switch_location);
+ if (!default_node)
+ warning (OPT_Wswitch_default, "%Hswitch missing default case",
+ &switch_location);
/* If the switch expression was an enumerated type, check that
exactly all enumeration literals are covered by the cases.
{
/* Warn if there are enumerators that don't correspond to
case expressions. */
- warning ("%Henumeration value %qE not handled in switch",
+ warning (0, "%Henumeration value %qE not handled in switch",
&switch_location, TREE_PURPOSE (chain));
}
}
that changes what the typedef is typing. */
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_COMMON (*node) = 0;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_COMMON (*node) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
TYPE_READONLY (TREE_TYPE (type)), 1));
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_UNINLINABLE (*node) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
TREE_USED (decl) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
}
TREE_THIS_VOLATILE (TREE_TYPE (type))));
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_TRANSPARENT_UNION (decl) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
*no_add_attrs = true;
if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
else
{
int j;
case MODE_VECTOR_INT:
case MODE_VECTOR_FLOAT:
- warning ("specifying vector types with __attribute__ ((mode)) "
- "is deprecated");
- warning ("use __attribute__ ((vector_size)) instead");
+ warning (OPT_Wattributes, "specifying vector types with "
+ "__attribute__ ((mode)) is deprecated");
+ warning (OPT_Wattributes,
+ "use __attribute__ ((vector_size)) instead");
valid_mode = vector_mode_valid_p (mode);
break;
}
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
{
if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
{
- warning ("%qE attribute ignored on non-class types", name);
+ warning (OPT_Wattributes, "%qE attribute ignored on non-class types",
+ name);
return NULL_TREE;
}
}
else if (decl_function_context (decl) != 0 || !TREE_PUBLIC (decl))
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
return NULL_TREE;
}
return NULL_TREE;
if (TREE_CODE (decl) == IDENTIFIER_NODE)
{
- warning ("%qE attribute ignored on types",
+ warning (OPT_Wattributes, "%qE attribute ignored on types",
name);
return NULL_TREE;
}
if (!DECL_THREAD_LOCAL (decl))
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
else
DECL_IS_MALLOC (*node) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_IS_RETURNS_TWICE (*node) = 1;
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
/* ??? TODO: Support types. */
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
what = DECL_NAME (TYPE_NAME (type));
}
if (what)
- warning ("%qE attribute ignored for %qE", name, what);
+ warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what);
else
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
}
return NULL_TREE;
if (!host_integerp (size, 1))
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
return NULL_TREE;
}
if (attr)
{
if (!params)
- warning ("missing sentinel in function call");
+ warning (0, "missing sentinel in function call");
else
{
tree sentinel, end;
}
if (pos > 0)
{
- warning ("not enough arguments to fit a sentinel");
+ warning (0, "not enough arguments to fit a sentinel");
return;
}
}
/* Validate the sentinel. */
- if (!POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (sentinel)))
- || !integer_zerop (TREE_VALUE (sentinel)))
- warning ("missing sentinel in function call");
+ if ((!POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (sentinel)))
+ || !integer_zerop (TREE_VALUE (sentinel)))
+ /* Although __null (in C++) is only an integer we allow it
+ nevertheless, as we are guaranteed that it's exactly
+ as wide as a pointer, and we don't want to force
+ users to cast the NULL they have written there.
+ We warn with -Wstrict-null-sentinel, though. */
+ && (warn_strict_null_sentinel
+ || null_node != TREE_VALUE (sentinel)))
+ warning (0, "missing sentinel in function call");
}
}
}
return;
if (integer_zerop (param))
- warning ("null argument where non-null required (argument %lu)",
+ warning (0, "null argument where non-null required (argument %lu)",
(unsigned long) param_num);
}
/* ??? TODO: Support types. */
else
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
we'd be missing too much, since we do have attribute constructor. */
if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
return NULL_TREE;
}
/* Ignore the attribute for functions not returning any value. */
if (VOID_TYPE_P (TREE_TYPE (*node)))
{
- warning ("%qE attribute ignored", name);
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
if (!params)
{
- warning ("%qE attribute requires prototypes with named arguments", name);
+ warning (OPT_Wattributes,
+ "%qE attribute requires prototypes with named arguments", name);
*no_add_attrs = true;
}
else
if (VOID_TYPE_P (TREE_VALUE (params)))
{
- warning ("%qE attribute only applies to variadic functions", name);
+ warning (OPT_Wattributes,
+ "%qE attribute only applies to variadic functions", name);
*no_add_attrs = true;
}
}
if (TREE_CODE (position) != INTEGER_CST)
{
- warning ("requested position is not an integer constant");
+ warning (0, "requested position is not an integer constant");
*no_add_attrs = true;
}
else
{
if (tree_int_cst_lt (position, integer_zero_node))
{
- warning ("requested position is less than zero");
+ warning (0, "requested position is less than zero");
*no_add_attrs = true;
}
}
if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
{
if (fdecl)
- warning ("%Hignoring return value of %qD, "
+ warning (0, "%Hignoring return value of %qD, "
"declared with attribute warn_unused_result",
EXPR_LOCUS (t), fdecl);
else
- warning ("%Hignoring return value of function "
+ warning (0, "%Hignoring return value of function "
"declared with attribute warn_unused_result",
EXPR_LOCUS (t));
}
resolve_overloaded_builtin (tree function, tree params)
{
enum built_in_function orig_code = DECL_FUNCTION_CODE (function);
+ switch (DECL_BUILT_IN_CLASS (function))
+ {
+ case BUILT_IN_NORMAL:
+ break;
+ case BUILT_IN_MD:
+ if (targetm.resolve_overloaded_builtin)
+ return targetm.resolve_overloaded_builtin (function, params);
+ else
+ return NULL_TREE;
+ default:
+ return NULL_TREE;
+ }
+
+ /* Handle BUILT_IN_NORMAL here. */
switch (orig_code)
{
case BUILT_IN_FETCH_AND_ADD_N:
}
default:
- return NULL;
+ return NULL_TREE;
}
}