summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/c-decl.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2002-09-01 20:53:28 +0000
committerkan <kan@FreeBSD.org>2002-09-01 20:53:28 +0000
commit474d90c51c82574fae205a03f0fe6e4865b15498 (patch)
treef845d90432c21c5d7bd7f3fd07655d7b5e28c99f /contrib/gcc/c-decl.c
parenteb9254c1592fb3df1d2d9ac9f79284d84eae8e4d (diff)
downloadFreeBSD-src-474d90c51c82574fae205a03f0fe6e4865b15498.zip
FreeBSD-src-474d90c51c82574fae205a03f0fe6e4865b15498.tar.gz
Merge FreeBSD modifications into gcc 3.2.1-prerelease:
1.2 kernel printf enchancements framework 1.3 suppress warnings on K&R main Approved by: obrien
Diffstat (limited to 'contrib/gcc/c-decl.c')
-rw-r--r--contrib/gcc/c-decl.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c
index e6a2293..a7c0510 100644
--- a/contrib/gcc/c-decl.c
+++ b/contrib/gcc/c-decl.c
@@ -3944,6 +3944,7 @@ build_compound_literal (type, init)
DECL_CONTEXT (decl) = current_function_decl;
TREE_USED (decl) = 1;
TREE_TYPE (decl) = type;
+ TREE_READONLY (decl) = TREE_READONLY (type);
store_init_value (decl, init);
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
@@ -3966,12 +3967,18 @@ build_compound_literal (type, init)
if (TREE_STATIC (decl))
{
/* This decl needs a name for the assembler output. We also need
- a unique suffix to be added to the name, for which DECL_CONTEXT
- must be set. */
- DECL_NAME (decl) = get_identifier ("__compound_literal");
- DECL_CONTEXT (decl) = complit;
+ a unique suffix to be added to the name. */
+ char *name;
+ extern int var_labelno;
+
+ ASM_FORMAT_PRIVATE_NAME (name, "__compound_literal", var_labelno);
+ var_labelno++;
+ DECL_NAME (decl) = get_identifier (name);
+ DECL_DEFER_OUTPUT (decl) = 1;
+ DECL_COMDAT (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ pushdecl (decl);
rest_of_decl_compilation (decl, NULL, 1, 0);
- DECL_CONTEXT (decl) = NULL_TREE;
}
return complit;
@@ -4650,7 +4657,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
even if it is (eg) a const variable with known value. */
size_varies = 1;
- if (pedantic)
+ if (!flag_isoc99 && pedantic)
{
if (TREE_CONSTANT (size))
pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated",
@@ -5624,8 +5631,11 @@ grokfield (filename, line, declarator, declspecs, width)
{
/* This is an unnamed decl. We only support unnamed
structs/unions, so check for other things and refuse them. */
- if (TREE_CODE (TREE_VALUE (declspecs)) != RECORD_TYPE
- && TREE_CODE (TREE_VALUE (declspecs)) != UNION_TYPE)
+ tree type = TREE_VALUE (declspecs);
+
+ if (TREE_CODE (type) == TYPE_DECL)
+ type = TREE_TYPE (type);
+ if (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE)
{
error ("unnamed fields of type other than struct or union are not allowed");
return NULL_TREE;
OpenPOWER on IntegriCloud