(duplicate_decls, grokdeclarator, finish_struct):
authorRichard Stallman <rms@gnu.org>
Thu, 23 Jul 1992 06:05:54 +0000 (06:05 +0000)
committerRichard Stallman <rms@gnu.org>
Thu, 23 Jul 1992 06:05:54 +0000 (06:05 +0000)
Use C_PROMOTING_INTEGER_TYPE_P to decide whether a type promotes.
(start_function): Likewise.

From-SVN: r1666

gcc/c-decl.c

index 5a730e81d583c76b82906a4106eb4d1f616833e3..41afaa3cac5587599e78dd565a84c177bf956abc 100644 (file)
@@ -1312,9 +1312,7 @@ duplicate_decls (newdecl, olddecl)
                }
 
              if (TYPE_MAIN_VARIANT (type) == float_type_node
-                 || (TREE_CODE (type) == INTEGER_TYPE
-                     && (TYPE_PRECISION (type)
-                         < TYPE_PRECISION (integer_type_node))))
+                 || C_PROMOTING_INTEGER_TYPE_P (type))
                {
                  error ("An argument type that has a default promotion");
                  error ("can't match an empty parameter name list declaration.");
@@ -4049,11 +4047,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
        /* Don't use TYPE_PREISION to decide whether to promote,
           because we should convert short if it's the same size as int,
           but we should not convert long if it's the same size as int.  */
-       else if (main_type == char_type_node
-                || main_type == signed_char_type_node
-                || main_type == unsigned_char_type_node
-                || main_type == short_integer_type_node
-                || main_type == short_unsigned_type_node)
+       else if (C_PROMOTING_INTEGER_TYPE_P (main_type))
          {
            if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)
                && TREE_UNSIGNED (type))
@@ -4843,9 +4837,7 @@ finish_struct (t, fieldlist)
   /* Promote each bit-field's type to int if it is narrower than that.  */
   for (x = fieldlist; x; x = TREE_CHAIN (x))
     if (DECL_BIT_FIELD (x)
-       && TREE_CODE (TREE_TYPE (x)) == INTEGER_TYPE
-       && (TYPE_PRECISION (TREE_TYPE (x))
-           < TYPE_PRECISION (integer_type_node)))
+       && C_PROMOTING_INTEGER_TYPE_P (TREE_TYPE (x)))
       TREE_TYPE (x) = integer_type_node;
 
   /* If this structure or union completes the type of any previous
@@ -5214,8 +5206,7 @@ start_function (declspecs, declarator, nested)
 
   restype = TREE_TYPE (TREE_TYPE (current_function_decl));
   /* Promote the value to int before returning it.  */
-  if (TREE_CODE (restype) == INTEGER_TYPE
-      && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
+  if (C_PROMOTING_INTEGER_TYPE_P (restype))
     restype = integer_type_node;
   DECL_RESULT (current_function_decl)
     = build_decl (RESULT_DECL, NULL_TREE, restype);