[PPL-devel] Re: Behaviors of `gcc -E -C'

Neil Booth neil at daikokuya.demon.co.uk
Fri Oct 12 08:30:57 CEST 2001


Zack Weinberg wrote:-

> I don't remember why we tried to do this in the first place.  Until
> someone can remember why, turning them off again seems like a sensible
> plan.

The NetBSD project added a -CC option to cccp, which would preserve
comments in macros so that they are output wherever the macro is used,
rather than not at all or only where the macro is defined (I can't
remember what cccp does).  Which seems like a not unreasonable
improvement, to me at least.  Mainline CPP drops comments in
directives completely, even with -C, including #define.

> All very doable.
> 
> I'd kind of like to see directives call a different function from
> cpp_get_token, but for a different reason: right now profiling the
> preprocessor is hindered by the gargantuan recursive cycle between all
> the directive handlers (and their children) and cpp_get_token.  If
> there were an internal version that did do macro expansion but
> didn't do directive processing, and they used it, the cycle would go
> away.

Hmmm.  Directive processing is presently handled at the lexer level
rather than at the get_token / macro expansion level, since the
indicator of a directive is a '#' at the beginning of a logical line.
In other words, it's natural that directive processing can't happen in
directives, because in a directive you're not at the start of the
line.

So I'm not sure there is an clean split like that.

Neil.



More information about the PPL-devel mailing list