[PATCH] Fix visibility of constructors/destructors with
Richard Guenther
rguenther@suse.de
Sat Mar 27 21:54:00 GMT 2010
On Sat, 27 Mar 2010, Jan Hubicka wrote:
> > > Hmm, I see it was applied already, but this imply that attribute used on functions
> > > now imply externally_visible, while on variables it does not.
> >
> > It only implies externally_visible with -fwhole-program if the declaration
> > was originally externally visible.
> >
> > The documentation for attribute used says:
> >
> > @item used
> > @cindex @code{used} attribute.
> > This attribute, attached to a function, means that code must be emitted
> > for the function even if it appears that the function is not referenced.
> > This is useful, for example, when the function is referenced only in
> > inline assembly.
>
> Well, the manual says nothing about external visibility. It only says that you
> can reffer it from assembly (as given in the example bellow). I would say that
> for -fwhole-program we can still bring it local as long as all the assembly
> refering it is part of the unit and otherwise user is required to add the
> externally visible attribute same way as he has to add to anything else refered
> outside the unit compiled with -fwhole-program.
>
> "used" attribute is IMO intended primarily for static variables/functions
> refered from inline assembly. For functions referred from assembly in .s unit
> no decoration is needed.
Well, I think "used" means used in ways not visible to the compiler.
So I think making that imply "externally_visible" is reasonable
(and as we can't do anything useful with "used" things not bringing
it local with -fwhole-program shouldn't be something to worry about).
But yes, the change should probably be applied to variables as well.
Richard.
More information about the Gcc-patches
mailing list