This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: pre-processor wishlist ?
On 26-Jun-2001, Neil Booth <neil@daikokuya.demon.co.uk> wrote:
> Adam wrote:-
>
> > I had this nice wish for 'gcc -E' to be able to do:
> >
> > I would want to be able to specify what kind of parsing
> > it can do. So that say I first can have it process all
> > #ifdef's, and then separately have it process all
> > #defines and #includes.
>
> I don't understand what you're saying. How could #ifdef succeed
> without a preceding #define?
The #defines would have to be processed (i.e. the macro definitions would need
to be recorded in the appropriate symbol table), but I think the idea is that
macros would only be expanded in conditions of #if statements; macro
invocations in ordinary source code would remain unchanged.
P.S.
Currently you can almost get it to not process #includes by
using the `-nostdinc' and `-I-' options. With those options,
it reports errors for #include statements, which you can ignore,
and obviously it doesn't replace #include statements with the
header file contents, since it can't find the header files.
But it probably doesn't do quite what the original poster wanted,
since the #include statements are stripped out rather than being
copied to the output.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.