GCC dump preprocessor defines

Yes, use -E -dM options instead of -c.
Example (outputs them to stdout):

 echo | gcc -dM -E -
 echo | clang -dM -E -

For C++

 echo | g++ -dM -E -x c++ -
 echo | clang++ -dM -E -x c++ -

From the gcc manual:

Instead of the normal output, generate
a list of `#define’ directives for all
the macros defined during the
execution of the preprocessor,
including predefined macros. This
gives you a way of finding out what is
predefined in your version of the
preprocessor. Assuming you have no
file foo.h, the command

touch foo.h; cpp -dM foo.h

will show all the predefined macros.

If you use -dM without the -E option,
-dM is interpreted as a synonym for -fdump-rtl-mach.

Leave a Comment