This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]