diff options
author | Richard Stallman <rms@gnu.org> | 1993-10-30 08:34:05 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-10-30 08:34:05 +0000 |
commit | 22ba338b8f7f2b198f14978125571c2d8a7211b6 (patch) | |
tree | 1efa7509cd70279eafc36d36b2c40fdb5bfcaa46 | |
parent | 708e813b0c299c6ac5d4b77cec5fa075a2d8bd41 (diff) | |
download | gcc-22ba338b8f7f2b198f14978125571c2d8a7211b6.zip gcc-22ba338b8f7f2b198f14978125571c2d8a7211b6.tar.gz gcc-22ba338b8f7f2b198f14978125571c2d8a7211b6.tar.bz2 |
(convert_and_check): Don't warn converting 0xff
to a signed char, etc., unless pedantic.
From-SVN: r5944
-rw-r--r-- | gcc/c-common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 86f4ed7..a6e7826 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1019,7 +1019,12 @@ convert_and_check (type, expr) if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr)) && TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr)))) - warning ("overflow in implicit constant conversion"); + /* 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"); } else unsigned_conversion_warning (t, expr); |