T
Theron Stanford
I've inherited a bunch of code that contains a lot of conditional
preprocessing commands.
Is there a way to run the preprocessor so that it processes the
conditionals but leaves the rest of the macros alone?
Take this code for an example:
/* start of code */
#define CONSTANT1 1
#define CONSTANT2 2
#if defined (A)
x = CONSTANT1;
#endif
#if defined (B)
x = CONSTANT2;
#endif
/*end of code */
I'd like to invoke the preprocessor with
cpp -DA
(and perhaps another option or two) and get back
/* start of code */
#define CONSTANT1 1
#define CONSTANT2 2
x = CONSTANT1;
/* end of code */
Since the #defined macros have useful names, I don't want them being
replaced by their values, namely:
/* start of code */
x = 1;
/* end of code */
Thanks in advance.
Theron
preprocessing commands.
Is there a way to run the preprocessor so that it processes the
conditionals but leaves the rest of the macros alone?
Take this code for an example:
/* start of code */
#define CONSTANT1 1
#define CONSTANT2 2
#if defined (A)
x = CONSTANT1;
#endif
#if defined (B)
x = CONSTANT2;
#endif
/*end of code */
I'd like to invoke the preprocessor with
cpp -DA
(and perhaps another option or two) and get back
/* start of code */
#define CONSTANT1 1
#define CONSTANT2 2
x = CONSTANT1;
/* end of code */
Since the #defined macros have useful names, I don't want them being
replaced by their values, namely:
/* start of code */
x = 1;
/* end of code */
Thanks in advance.
Theron