This is the mail archive of the gcc-patches@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: #import and PCH


Geoff Keating wrote:-

> Neil Booth <neil@daikokuya.co.uk> writes:
> 
> > Geoffrey Keating wrote:-
> > 
> > > 
> > > #import worked by setting a flag bit on cpplib's hash table.  This is
> > > somewhat annoying from a PCH perspective, and is kind of ugly too.
> > 
> > It's not that bad.  Your patch adds a lot of code in comparison.
> 
> This isn't much code compared to what would be necessary to save and
> restore the include file splay tree.

I think you need to elaborate quite a bit more.

> > How about just removing #import?  What about #pragma once?
> 
> #pragma once is a problem for another day.

But it has problems that are identical to #import in every way.  At
present, we have #include which works as well as we can make it.  Then
we have #import and #pragma once, which behave identically brokenly.

I don't think making #import different yet again is progress.  I am
convinced that two implementations of the same thing, namely multiple
inclusion, in the code base is worse than the current situation.

> > You don't need to use a real identifier.  You could prepend it with a
> > space, or anything other than "#".
> 
> I thought of that, but was worried it might cause trouble with -dM.

But you labelled it built-in.  They're not dumped with -dM.  And you
have introduced the #import <foo.h> and #import <./foo.h> inconsistency
that you noted.  We don't have that at present.

> >  What if #import <a.h> is followed by #include <a.h> ?
> 
> This is an intentional change.

Silently?  With what justification?  I don't think this is progress.
This looks like documenting around a broken implementation.

> > Things being NODE_BUILTIN induce special behaviour in other parts of
> > cpplib.  Does this affect your macros?
> 
> Yes, but only in good ways.  For instance, there are no warnings about
> these macros being unused.

You're probably right.  I just wanted to be sure you'd taken it into
account.

I had hoped we could just scrap #import and #pragma once.  Nicola's
message leaves me quite pessimistic - it seems that the stubborn
insistance of some people in Apple, which to be honest I can quite
understand, is impeding us doing the right thing in FSF GCC.  However,
this problem is not one that will go away by ignoring it.

Clearly the best solution is that everyone agrees #import and #pragma
once disappear.  But that doesn't look like it's going to happen when
90% of users view #import as working correctly.

Neil.


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