Commit e3c56d1b by Richard Kenner

(duplicate_decls): Properly merge decls with differing DECL_CONTEXT.

From-SVN: r8428
parent 199b61d8
...@@ -1698,11 +1698,16 @@ duplicate_decls (newdecl, olddecl) ...@@ -1698,11 +1698,16 @@ duplicate_decls (newdecl, olddecl)
make_var_volatile (newdecl); make_var_volatile (newdecl);
} }
/* Keep source location of definition rather than declaration. */ /* Keep source location of definition rather than declaration.
if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) 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_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
if (DECL_CONTEXT (olddecl) == 0)
DECL_CONTEXT (newdecl) = 0;
} }
/* Merge the unused-warning information. */ /* Merge the unused-warning information. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment