Is there a way to run the GCC preprocessor, but only for user-defined macros?
I have a few one-liners and some #ifdef
, etc. conditionals, and I want to see
gcc -E inputfile.c > outputfile.c
outputfile.c will have your preprocessed code, but all macros will be expanded.
I find this trick very useful when debugging compilation of large systems with tons of includes, compiler flags, and makefile variables. It will expose include files that don't have header guards, and a bunch of other problems too.