This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
merge_translation_unit_decls / duplicate_decls
- From: Per Bothner <pbothner at apple dot com>
- To: Geoffrey Keating <geoffk at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 17 Nov 2003 21:53:59 -0800
- Subject: merge_translation_unit_decls / duplicate_decls
I'm trying to "finish" my duplicate_decls patch (so it [almost]
always return the newdecl), and I'm exmining the entire function.
(It appears to be overdue ...)
I trying figout last part, where TREE_ASM_WRITTEN is being set,
of the following:
if (DECL_EXTERNAL (newdecl))
{
if (! different_binding_level || different_tu)
{
/* Don't mess with these flags on local externs; they remain
external even if there's a declaration at file scope which
isn't. */
TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
}
/* An extern decl does not override previous storage class. */
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
if (! DECL_EXTERNAL (newdecl))
{
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
/* If we have two non-EXTERNAL file-scope decls that are
the same, only one of them should be written out. */
if (different_tu)
TREE_ASM_WRITTEN (newdecl) = 1;
}
It seems to me that TREE_ASM_WRITTEN only when we had [before
this code is executed], because of the earlier assignment:
DECL_EXTERNAL (newdecl) && ! DECL_EXTERNAL (olddecl)
Yet the comment says "if we had two non-EXTERNAL file-scope decls".
I don't see what setting TREE_ASM_WRITTEN is trying to do, and
so I don't know what to replace it with.
--
--Per Bothner
per@bothner.com pbothner@apple.com http://per.bothner.com/