aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-07-18 18:10:11 +0000
committerRichard Stallman <rms@gnu.org>1993-07-18 18:10:11 +0000
commit366185286aab4ceeb94d98eb54fd9c59708f152a (patch)
tree946b52405b7212d1a870b567e708061872e551b8 /gcc
parentedbc355b88bb2e18409a5a7dde52d5fd779c3d1c (diff)
downloadgcc-366185286aab4ceeb94d98eb54fd9c59708f152a.zip
gcc-366185286aab4ceeb94d98eb54fd9c59708f152a.tar.gz
gcc-366185286aab4ceeb94d98eb54fd9c59708f152a.tar.bz2
(common_type): Use TYPE_MAIN_VARIANT when preferring
long int to int (when width is the same). (check_format): With -Wformat, warn about printf("%ld", 1) even if sizeof (int) == sizeof (long), since the code isn't portable. Similarly for "%d" vs 1L. (convert_arguments) [PROMOTE_PROTOTYPES]: With -Wconversion, use unpromoted type to check for signedness changes. From-SVN: r4935
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 85d2058..af934e3 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -231,12 +231,12 @@ common_type (t1, t2)
/* Same precision. Prefer longs to ints even when same size. */
- if (t1 == long_unsigned_type_node
- || t2 == long_unsigned_type_node)
+ if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node
+ || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node)
return long_unsigned_type_node;
- if (t1 == long_integer_type_node
- || t2 == long_integer_type_node)
+ if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node
+ || TYPE_MAIN_VARIANT (t2) == long_integer_type_node)
{
/* But preserve unsignedness from the other type,
since long cannot hold all the values of an unsigned int. */
@@ -1787,7 +1787,8 @@ check_format (info, params)
/* Don't warn about differences merely in signedness. */
&& !(TREE_CODE (wanted_type) == INTEGER_TYPE
&& TREE_CODE (cur_type) == INTEGER_TYPE
- && TYPE_PRECISION (wanted_type) == TYPE_PRECISION (cur_type)))
+ && (wanted_type == (TREE_UNSIGNED (wanted_type)
+ ? unsigned_type : signed_type) (cur_type))))
{
register char *this;
register char *that;
@@ -1998,6 +1999,7 @@ convert_arguments (typelist, values, name, fundecl)
else
{
tree parmname;
+ tree type0 = type;
#ifdef PROMOTE_PROTOTYPES
/* Rather than truncating and then reextending,
convert directly to int, if that's the type we will want. */