Tips to Find Predefines for Compilers

Two useful tips from TACC tips regarding compiler macro expanding.

Tip 120:
Want to know what MACROS are predefined by the GCC and Intel compilers? Do

gcc -dM -E - < /dev/null > gcc_defined_macros.txt
icc -dM -E - < /dev/null > icc_defined_macros.txt

The flag -E in the tip is telling the compiler to expand macros.

Tip 69:
Having trouble figuring out how a macro is being expanded? Try pasting the line into a terminal and adding a -E. For example try changing mpicc -DFOO -DBAR -c foo.c into mpicc -DFOO -DBAR -E foo.c > foo.i and look at the foo.i file.

Credits

  • TACC - Texas Advanced Computing Center