diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-11-11 17:53:39 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-11-11 17:53:39 -0500 |
commit | e3c56d1b513077e7b7c4e0face59484e8597a8f4 (patch) | |
tree | 7db5242869d02f0dedb6a86ca68076df804044f3 /gcc | |
parent | 199b61d8f811486ec839a45acd9e0889ab804580 (diff) | |
download | gcc-e3c56d1b513077e7b7c4e0face59484e8597a8f4.zip gcc-e3c56d1b513077e7b7c4e0face59484e8597a8f4.tar.gz gcc-e3c56d1b513077e7b7c4e0face59484e8597a8f4.tar.bz2 |
(duplicate_decls): Properly merge decls with differing DECL_CONTEXT.
From-SVN: r8428
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-decl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 995009a..427ff3a 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. */ |