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: #pragma interface/implementation broken if --enable-mapped-location


On Sep 29, 2004, at 11:14 AM, Zack Weinberg wrote:

Per Bothner <per@bothner.com> writes:

Zack Weinberg wrote:

Given all that, I think it makes sense for all pragmas to become
token sequences.

How close are we to having this?


I'm hoping to check in today my gcc/java changes to handle
--enable-mapped-location.  That would allow bootstrapping gcc
with the default set of languages.  But that requires a fix
or workaround for the #pragma interface/implementation bug,
since otherwise libjava won't build.

If we're not close to the #pragma-as-token change, I could
implement a quickie fix to for example temporarily clear
cb.line_change during cpp_handle_deferred_pragma.

I think we're at least a couple weeks away from #pragma-as-tokens. A quickie fix would be fine by me.

The reason I didn't implement pragma-as-tokens was pretty simple: I thought it would involve fairly tricky changes in both libcpp and the front end.

First, the libcpp changes: it's easy to get libcpp to do parsing
the same way it normally does but using a different source of
characters; the infrastructure is already there.  I didn't see an
easy way of getting the pragma handlers to use an alternate
mechanism for getting tokens.  There is no such infrastructure in
the existing libcpp, and creating something new, just for this
purpose, didn't seem worth it.

Second, the front end changes.  If a pragma is a single token,
then it's very easy for the front end to skip past it and to
only evaluate it once.  If it's a stream of tokens, then it's
harder.  (But possibly that concern is no longer valid now that
Zack made the changes so that pragmas may only appear in specific
places.)

I still find pragmas-as-strings simpler and more elegant than
pragmas-as-tokens, and I don't quite understand why it's
necessary to move to pragmas-as-tokens to fix #pragma interface/
implementation in the presence of --enable-mapped-location.  But
if other people think this change is a good idea, I'm not going
to stand in the way.

--Matt


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