Search code examples
cfortranpreprocessoriccintel-fortran

Generate list of preprocessor macros defined by the compiler


With gcc and gfortran I can generate a list of preprossesor macros defined by the compiler using (edited to reflect ouah's answer)

gcc -E -dM - < /dev/null

and

gfortran -cpp -E -dM /dev/null

respectively (on Linux at least).

How can I do the same with the Intel compilers icc and ifort? I know that for ifort these macros are defined here, but I would like to be able to generate this list myself, since the exact macros in use and their values will depend on the compiler options used. I am also aware of the predef project.


Solution

  • With the Intel Fortran compiler, ifort, the following can be used:

    ifort -E -fpp /dev/null -dryrun 2>&1 | grep -e -D | cut -c 5-
    

    It seems than ifort does not have an equivalent -dM flag like icc, gfortran and gcc do.