(convert_and_check): Don't warn converting 0xff
to a signed char, etc., unless pedantic. From-SVN: r5944
This commit is contained in:
parent
708e813b0c
commit
22ba338b8f
@ -1019,6 +1019,11 @@ convert_and_check (type, expr)
|
|||||||
if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr))
|
if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr))
|
||||||
&& TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
|
&& TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
|
||||||
&& TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr))))
|
&& TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr))))
|
||||||
|
/* If EXPR fits in the unsigned version of TYPE,
|
||||||
|
don't warn unless pedantic. */
|
||||||
|
if (pedantic
|
||||||
|
|| TREE_UNSIGNED (type)
|
||||||
|
|| ! int_fits_type_p (expr, unsigned_type (type)))
|
||||||
warning ("overflow in implicit constant conversion");
|
warning ("overflow in implicit constant conversion");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user