summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/c-decl.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2005-06-03 03:50:42 +0000
committerkan <kan@FreeBSD.org>2005-06-03 03:50:42 +0000
commitf8dd8336e3484d2d7f4887c5583585521dd055d0 (patch)
tree56d842dca34faa3e40f969e13617dfdbb051d690 /contrib/gcc/c-decl.c
parenta101babe926f42d1c4b46f430425c21fdcda6f97 (diff)
downloadFreeBSD-src-f8dd8336e3484d2d7f4887c5583585521dd055d0.zip
FreeBSD-src-f8dd8336e3484d2d7f4887c5583585521dd055d0.tar.gz
Stock files.
Diffstat (limited to 'contrib/gcc/c-decl.c')
-rw-r--r--contrib/gcc/c-decl.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c
index 63253db..bbfe617 100644
--- a/contrib/gcc/c-decl.c
+++ b/contrib/gcc/c-decl.c
@@ -3622,10 +3622,6 @@ grokdeclarator (tree declarator, tree declspecs,
}
}
- /* Check the type and width of a bit-field. */
- if (bitfield)
- check_bitfield_type_and_width (&type, width, orig_name);
-
/* Figure out the type qualifiers for the declaration. There are
two ways a declaration can become qualified. One is something
like `const int i' where the `const' is explicit. Another is
@@ -3985,7 +3981,17 @@ grokdeclarator (tree declarator, tree declspecs,
}
else if (TREE_CODE (declarator) == CALL_EXPR)
{
+ /* Say it's a definition only for the declarator closest to
+ the identifier, apart possibly from some attributes. */
+ bool really_funcdef = false;
tree arg_types;
+ if (funcdef_flag)
+ {
+ tree t = TREE_OPERAND (declarator, 0);
+ while (TREE_CODE (t) == TREE_LIST)
+ t = TREE_VALUE (t);
+ really_funcdef = (TREE_CODE (t) == IDENTIFIER_NODE);
+ }
/* Declaring a function type.
Make sure we have a valid type for the function to return. */
@@ -4011,11 +4017,7 @@ grokdeclarator (tree declarator, tree declspecs,
inner layer of declarator. */
arg_types = grokparms (TREE_OPERAND (declarator, 1),
- funcdef_flag
- /* Say it's a definition
- only for the CALL_EXPR
- closest to the identifier. */
- && TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE);
+ really_funcdef);
/* Type qualifiers before the return type of the function
qualify the return type, not the function type. */
if (type_quals)
@@ -4129,6 +4131,10 @@ grokdeclarator (tree declarator, tree declspecs,
/* Now TYPE has the actual type. */
+ /* Check the type and width of a bit-field. */
+ if (bitfield)
+ check_bitfield_type_and_width (&type, width, orig_name);
+
/* Did array size calculations overflow? */
if (TREE_CODE (type) == ARRAY_TYPE
@@ -5128,7 +5134,7 @@ finish_struct (tree t, tree fieldlist, tree attributes)
make it one, warn and turn off the flag. */
if (TREE_CODE (t) == UNION_TYPE
&& TYPE_TRANSPARENT_UNION (t)
- && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))
+ && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))))
{
TYPE_TRANSPARENT_UNION (t) = 0;
warning ("union cannot be made transparent");
@@ -5280,9 +5286,19 @@ finish_enum (tree enumtype, tree values, tree attributes)
TYPE_MIN_VALUE (enumtype) = minnode;
TYPE_MAX_VALUE (enumtype) = maxnode;
- TYPE_PRECISION (enumtype) = precision;
TREE_UNSIGNED (enumtype) = unsign;
TYPE_SIZE (enumtype) = 0;
+
+ /* If the precision of the type was specific with an attribute and it
+ was too small, give an error. Otherwise, use it. */
+ if (TYPE_PRECISION (enumtype))
+ {
+ if (precision > TYPE_PRECISION (enumtype))
+ error ("specified mode too small for enumeral values");
+ }
+ else
+ TYPE_PRECISION (enumtype) = precision;
+
layout_type (enumtype);
if (values != error_mark_node)
OpenPOWER on IntegriCloud