Is there a way to list all C preprocessor defines?
I’m on a mac with a compiled from source gcc and
#if defined __APPLE__
#error "Apple"
#else
#error "Ahh"
#endif
is giving me:
error: #error "Ahh"
my compile configure options are:
${PWD}/../gcc/configure --prefix="${PWD}/../build/" --exec-prefix="${PWD}/../build/" --datadir="${PWD}/../build/" --target=avr --enable-languages=c --disable-libssp --disable-lto --disable-nls --disable-libgomp --disable-gdbtk --disable-threads --enable-poison-system-directories
If you are using gnu cpp, you can pass the option
-dMto emit all defined macros. That is:will tell you everything that is defined for foo.c. There will be extra defines passed on the command line by make, and probably more things in config.h, but if you grab the output of make and rerun the commands with
-Xpreprocessor -dMadded you should see everything.