Commit 24bc4c7f by Richard Stallman

(duplicate_decls, grokdeclarator, finish_struct):

Use C_PROMOTING_INTEGER_TYPE_P to decide whether a type promotes.
(start_function): Likewise.

From-SVN: r1666
parent d627ed1b
...@@ -1312,9 +1312,7 @@ duplicate_decls (newdecl, olddecl) ...@@ -1312,9 +1312,7 @@ duplicate_decls (newdecl, olddecl)
} }
if (TYPE_MAIN_VARIANT (type) == float_type_node if (TYPE_MAIN_VARIANT (type) == float_type_node
|| (TREE_CODE (type) == INTEGER_TYPE || C_PROMOTING_INTEGER_TYPE_P (type))
&& (TYPE_PRECISION (type)
< TYPE_PRECISION (integer_type_node))))
{ {
error ("An argument type that has a default promotion"); error ("An argument type that has a default promotion");
error ("can't match an empty parameter name list declaration."); error ("can't match an empty parameter name list declaration.");
...@@ -4049,11 +4047,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4049,11 +4047,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
/* Don't use TYPE_PREISION to decide whether to promote, /* Don't use TYPE_PREISION to decide whether to promote,
because we should convert short if it's the same size as int, 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. */ but we should not convert long if it's the same size as int. */
else if (main_type == char_type_node else if (C_PROMOTING_INTEGER_TYPE_P (main_type))
|| main_type == signed_char_type_node
|| main_type == unsigned_char_type_node
|| main_type == short_integer_type_node
|| main_type == short_unsigned_type_node)
{ {
if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node) if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)
&& TREE_UNSIGNED (type)) && TREE_UNSIGNED (type))
...@@ -4843,9 +4837,7 @@ finish_struct (t, fieldlist) ...@@ -4843,9 +4837,7 @@ finish_struct (t, fieldlist)
/* Promote each bit-field's type to int if it is narrower than that. */ /* Promote each bit-field's type to int if it is narrower than that. */
for (x = fieldlist; x; x = TREE_CHAIN (x)) for (x = fieldlist; x; x = TREE_CHAIN (x))
if (DECL_BIT_FIELD (x) if (DECL_BIT_FIELD (x)
&& TREE_CODE (TREE_TYPE (x)) == INTEGER_TYPE && C_PROMOTING_INTEGER_TYPE_P (TREE_TYPE (x)))
&& (TYPE_PRECISION (TREE_TYPE (x))
< TYPE_PRECISION (integer_type_node)))
TREE_TYPE (x) = integer_type_node; TREE_TYPE (x) = integer_type_node;
/* If this structure or union completes the type of any previous /* If this structure or union completes the type of any previous
...@@ -5214,8 +5206,7 @@ start_function (declspecs, declarator, nested) ...@@ -5214,8 +5206,7 @@ start_function (declspecs, declarator, nested)
restype = TREE_TYPE (TREE_TYPE (current_function_decl)); restype = TREE_TYPE (TREE_TYPE (current_function_decl));
/* Promote the value to int before returning it. */ /* Promote the value to int before returning it. */
if (TREE_CODE (restype) == INTEGER_TYPE if (C_PROMOTING_INTEGER_TYPE_P (restype))
&& TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
restype = integer_type_node; restype = integer_type_node;
DECL_RESULT (current_function_decl) DECL_RESULT (current_function_decl)
= build_decl (RESULT_DECL, NULL_TREE, restype); = build_decl (RESULT_DECL, NULL_TREE, restype);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment