Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 284
Chris Avatar asked Feb 19 '12 13:02

Chris


1 Answers

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.

like image 198
Chris Avatar answered Oct 21 '22 23:10

Chris