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]

Re: Merge cpplib and front end hashtables, part 1


On Sat, May 12, 2001 at 11:34:20PM +0100, Joseph S. Myers wrote:
> On Sat, 12 May 2001, Zack Weinberg wrote:
> 
> > C front end logic could certainly make calls to cpp_define().  The
> > difficulty is in ensuring that -save-temps generates an accurate
> > intermediate file.  Perhaps this is what you mean by making cc1 do
> > cpp0's job.
> 
> Yes, that's the point - for such a use of integrated cpp to work properly
> with -E and -save-temps, a separate cpp0 - not knowing what macros the C
> front end would define - causes problems.

I thought about this a bit more and it shouldn't be too hard.  All the
C-ish front ends interface with cpplib via c-lex.c.  You'd just need
to arrange things so that each routine, in addition to its normal
processing, calls the analogous routine to generate text output.  At
the moment those all live in cppmain.c but they could be moved back
into the library.

The hardest part would be #pragma processing; right now #pragma
callbacks read the line themselves (they have to, because cpplib core
doesn't know anything about the syntax after #pragma).  Each one would
have to be tweaked to repeat the directive in the intermediate file as
a side effect.  (This would not be necessary for directives that are
handled completely inside cpplib.)

-- 
zw   You can tell [the lunatic] by the liberties he takes with common sense,
     his flashes of inspiration, and by the fact that sooner or later he
     brings up the Templars.
     	-- Umberto Eco, _Foucault's Pendulum_


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