Preprocess, but do not expand macros?

Larry Riedel larryr@saturn.sdsu.edu
Tue Jul 2 18:43:00 GMT 2002


> > Is there a simple way for me to tell gcc/cpp to run
> > the preprocessor, but do nothing more than remove the
> > code which would not be present after if/ifdef/ifndef?
> 
> Well the macros, namely "define" statements, are part
> of the preprocessor directives. [...]

To clarify, I would want the #define directives to be
processed, since otherwise the if/ifdef/ifndef might
not be meaningfully evaluated.  I simply do not want
the symbols defined by the #defines to be expanded.

before:
    #define PI 3.14
    #ifdef PI
        a = PI
    #endif

after:
        a = PI

instead of:
        a = 3.14


Larry



More information about the Gcc-help mailing list