simplecpp
simplecpp copied to clipboard
Do not abort when there is #ifdef in macro expansion list
Example code:
#define dostuff(X) X
dostuff(
#ifdef A
1
#endif
-1
)
simplecpp writes an error message and aborts:
1.c:5: syntax error: failed to expand 'dostuff', it is invalid to use a preprocessor directive as macro parameter
This error message is correct and it's great that simplecpp warns for this.
But customers don't like that simplecpp aborts. Compilers will typically preprocess it without warnings. gcc preprocess it to 1-1 if A is defined, and -1 if A is not defined.