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: Getting 3.3 out the door


On Thu, 2003-04-10 at 15:41, Joe Buck wrote:
> On Thu, Apr 10, 2003 at 03:33:03PM -0700, Mark Mitchell wrote:
> > These functions get external linkage because the C++ standard says they
> > do.  On the other hand, I've never been able to figure out whether a
> > conforming program could actually *tell*.  Adding "export" into the mix
> > makes it more complicated; now an export template defined in that file
> > but instantiated somewhere else can see the members of the anonymous
> > namespace.
> 
> Exactly!  In the majority of cases there is no conforming program that
> can tell the difference between file-static and anonymous namespace.
> It appears that exported templates can tell, and there may be a couple
> of other similar cases.
> 
> My suggestion is to avoid emitting globals for anonymous namespace members
> until the end of the unit, at which point any that must be generated are
> generated.  Names are flagged as "must be generated" when a situation
> like a use in an exported template occurs.  There may be others, but
> I expect them to be rare.

This is all a good idea, and I agree, but I don't think it's appropriate
for 3.3.  It's not a trivial change, and the C++ front end is fragile
with respect to emission order, due to the interplay between the varasm
routines and the front end.  You can also mess up things like
initialized constants and template instantiation if you're not careful.

Jan's worked on this for 3.4, and doing what you suggest there would
likely make sense.

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com


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