I'd like to get a list of the preprocessor variables that are predefined when using the nagfor Fortran compiler. The equivalent with gfortran is
gfortran -E -dM foo.F90
but with
nagfor -F -Wp,-dM foo.F90
I get
NAG Fortran Compiler Release 5.3(854)
fpp: warning: bad option: -dM , ignored.
I looked in the nagfor documentation and the fpp documentation but couldn't find the answer.
What I'm looking for is some variable to determine that the file is being compiled with nagfor, so the equivalent of the gfortran __GFORTRAN__
, the ifort __INTEL_COMPILER
and the pgf90 __PGI
.
Buried in the documentation for fpp I find (4.5.4 Macro definition for the release 6.2, section 5.4 of the question's linked documentation for version 5.3)
The macro NAGFOR is defined by default.
Sure enough
#ifdef NAGFOR
print '("nagfor says hello")'
#endif
end
has the desired result when passed through the preprocessor. In my case the macro takes the value 1
, but I don't know how consistent that may be.
As Themos Tsikas comments, there are also the macros __NAG_COMPILER_RELEASE
and __NAG_COMPILER_BUILD
which do take well-defined values.