Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28457 Discussions

Possible to list preprocessor symbols/macros defined by ifort?

Bob_A_1
Beginner
865 Views

Hi,

I'm working with a mixed C/Fortran project which uses waf as its cross-platform build system. While trying to resolve issues with ifort on Windows, the waf developers asked if there was a way to get ifort to list the preprocessor symbols or macros it defines because they need that info to support compilation with ifort.

As an example, if one runs

    gfortran.exe -dM -E - < a.f90

where a.f90 is an empty file, gfortran helpfully dumps out a long list of #defines (see attached).

Is this a thing ifort can do? I've looked into

    ifort /E /fpp a.f90 /dryrun

but I don't think that's doing quite the same thing.

There's more info on this issue at https://github.com/waf-project/waf/issues/1672 which revolves around the inability to get version information, etc. from ifort.

Thanks much,

 

0 Kudos
8 Replies
mecej4
Honored Contributor III
865 Views

Have you tried ifort /# a.f90?

0 Kudos
Steven_L_Intel1
Employee
865 Views

You can also use /list when compiling a source and look at the .lst file.

0 Kudos
Bob_A_1
Beginner
865 Views

@mecej4 - no; where is /# documented? I don't think I've seen that before

@Steve - thanks, I've passed that to the project maintainers; we'll see what they say

0 Kudos
mecej4
Honored Contributor III
865 Views

Whether documented or not, -# and -### are used by many compilers to turn on verbose output. See, for example, https://docs.oracle.com/cd/E18659_01/html/821-1384/bjapr.html#bjaps .

0 Kudos
JVanB
Valued Contributor II
865 Views

The ifort executable is not encrypted and the command-line switches are all in the same place in the file. A little experimentation and...

 

0 Kudos
Bob_A_1
Beginner
865 Views

I asked where the compiler options were documented so I'd know next time where to look for this information rather than making a forum post. The answer appears that /# is undocumented, for whatever reason (deprecated, under development, etc.)

I hope that expecting users to filter their compiler binary through `strings` to discover legal options is more sarcasm than serious. Having been fighting with msvc, ifort, lib, and link for the past 2 days, I can't honestly tell anymore.

0 Kudos
Steven_L_Intel1
Employee
865 Views

/# is indeed not documented, but it is not deprecated. I'll ask if it should be documented. We (Intel) don't expect users to run the compiler through "strings" - we document hundreds of options. I also gave you a documented way of getting the predefined symbols.

0 Kudos
Lorri_M_Intel
Employee
865 Views

It is purposefully undocumented; it's intended to be an internal-only switch because its meaning could change at a whim.

The one that is documented is /watch

 

              --Lorri

0 Kudos
Reply