aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-07-22 12:11:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2002-07-22 12:11:16 +0200
commitcf3c4f5609b982b1e640f5ac5a51b07711ec29de (patch)
tree3ea4f8ebfcd8cea35de19665d6ffa3cbdf453ef4 /gcc/c-decl.c
parent9f8da5fad69532eca570bb5420c23fbe41e4dc4d (diff)
downloadgcc-cf3c4f5609b982b1e640f5ac5a51b07711ec29de.zip
gcc-cf3c4f5609b982b1e640f5ac5a51b07711ec29de.tar.gz
gcc-cf3c4f5609b982b1e640f5ac5a51b07711ec29de.tar.bz2
c-decl.c (build_compound_literal): Defer compound literal decls until until file end to emit them only if...
* c-decl.c (build_compound_literal): Defer compound literal decls until until file end to emit them only if they are actually used. * gcc.dg/gnu89-init-2.c: New test. From-SVN: r55645
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c6e592a..57af611 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3669,12 +3669,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;