Preprocessor
C is single-pass, and #define creates a rather dumb substitution that is not yet processed - your macro MY_CHK_DEF (flag) inserts the #if operator in a string into pre-processed code that is interpreted by the C compiler and invalid C.
You can either rephrase it as a single-pass, or, if you cannot, run the preprocessor twice, manually - once through cpp -P and a second time through the normal compilation process.
source share