(default_conversion): Use C_PROMOTING_INTEGER_TYPE_P to decide whether a type should...
authorRichard Stallman <rms@gnu.org>
Thu, 23 Jul 1992 06:05:23 +0000 (06:05 +0000)
committerRichard Stallman <rms@gnu.org>
Thu, 23 Jul 1992 06:05:23 +0000 (06:05 +0000)
(default_conversion): Use C_PROMOTING_INTEGER_TYPE_P
to decide whether a type should promote.
(self_promoting_args_p, self_promoting_type_p): Likewise.

From-SVN: r1665

gcc/c-typeck.c

index 7b9342914a1670dec894dc69d40de70c789ac9bb..ec984d48d07b3a17e4209cd0ba564194dcce28c8 100644 (file)
@@ -601,12 +601,13 @@ self_promoting_args_p (parms)
       if (TREE_CHAIN (t) == 0 && type != void_type_node)
        return 0;
 
+      if (type == 0)
+       return 0;
+
       if (TYPE_MAIN_VARIANT (type) == float_type_node)
        return 0;
 
-      if (type
-         && TREE_CODE (type) == INTEGER_TYPE
-         && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
+      if (C_PROMOTING_INTEGER_TYPE_P (type))
        return 0;
     }
   return 1;
@@ -621,8 +622,7 @@ self_promoting_type_p (type)
   if (TYPE_MAIN_VARIANT (type) == float_type_node)
     return 0;
 
-  if (TREE_CODE (type) == INTEGER_TYPE
-      && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
+  if (C_PROMOTING_INTEGER_TYPE_P (type))
     return 0;
 
   return 1;
@@ -908,12 +908,12 @@ default_conversion (exp)
       return convert (type, exp);
     }
 
-  if (code == INTEGER_TYPE
-      && (TYPE_PRECISION (type)
-         < TYPE_PRECISION (integer_type_node)))
+  if (C_PROMOTING_INTEGER_TYPE_P (type))
     {
       /* Traditionally, unsignedness is preserved in default promotions.  */
-      if (flag_traditional && TREE_UNSIGNED (type))
+      if ((flag_traditional && TREE_UNSIGNED (type))
+         /* Also preserve unsignedness if not really getting any wider.  */
+         || (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)))
        return convert (unsigned_type_node, exp);
       return convert (integer_type_node, exp);
     }