at Preprocessor Options (Using the GNU Compiler Collection (GCC)) we can find a flag
-fpreprocessed Indicate to the preprocessor that the input file has already been preprocessed. This suppresses things like macro expansion, trigraph conversion, escaped newline splicing, and processing of most directives. The preprocessor still recognizes and removes comments, so that you can pass a file preprocessed with -C to the compiler without problems. In this mode the integrated preprocessor is little more than a tokenizer for the front ends. -fpreprocessed is implicit if the input file has one of the extensions ‘.i’, ‘.ii’ or ‘.mi’. These are the extensions that GCC uses for preprocessed files created by -save-temps.
any flag on clang have the same behavior: “just want run preprocessor -E and do not check the macro”
//////example.cpp #include "1.h" #if TEST_MACRO == 2 #else #error "unsupport TEST_MACRO" #endif
- when use command: gcc -w -x c -fpreprocessed -dD -E
we can get preprocessor
- when use command: clang -w -x c -dD -E
will get error like:
#error "unsupport TEST_MACRO"
so any flag on clang can do the same things