aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-11 22:53:39 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-11 22:53:39 +0000
commit687e51557bbf9eac1ada3863346a07ff449d7058 (patch)
tree7db5242869d02f0dedb6a86ca68076df804044f3 /gcc/c-decl.c
parent1580db92081a85dcae8a0d87bc48b7db9a26f7a6 (diff)
(duplicate_decls): Properly merge decls with differing DECL_CONTEXT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 995009a4635..427ff3a7d37 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1698,11 +1698,16 @@ duplicate_decls (newdecl, olddecl)
make_var_volatile (newdecl);
}
- /* Keep source location of definition rather than declaration. */
- if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
+ /* Keep source location of definition rather than declaration.
+ Likewise, keep decl at outer scope. */
+ if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
+ || (DECL_CONTEXT (newdecl) != 0 && DECL_CONTEXT (olddecl) == 0))
{
DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
+
+ if (DECL_CONTEXT (olddecl) == 0)
+ DECL_CONTEXT (newdecl) = 0;
}
/* Merge the unused-warning information. */