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]

Re: c++ vs decl_external


>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:

> The game we're playing is that we don't want the back end to see
> definitions of functions it doesn't really need to generate RTL for,
> and we prevent this by the somewhat extreme technique of setting
> DECL_EXTERNAL.  Since we didn't need the function, we didn't ever
> unset DECL_EXTERNAL, hence no warning.

Yes.

> There is also this cryptic comment in cp-tree.h:

> /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
>    so that assemble_external will work properly.  So we have this flag to
>    tell us whether the decl is really not external.  */

What's cryptic about this?  If we don't emit a definition of the function,
we need references to pass through assemble_external.  It's just like a
prototype followed by a call, which may or may not be followed by a
definition.

> Definitely this is something of a mess.  It's always bad when you play
> games with flags that are supposed to be shared in common code.

I have a plan (and partial patch) to overhaul the linkage code, which I
intend to get back to after 3.1.0 goes out.  I meant to get it into 3.1,
but it didn't happen.

Jason


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