【问题标题】:How to list predefined preprocessor variables with nagfor如何使用 nagfor 列出预定义的预处理器变量
【发布时间】:2018-07-27 17:13:14
【问题描述】:

我想获得使用 nagfor Fortran 编译器时预定义的预处理器变量的列表。与 gfortran 等价的是

gfortran -E -dM foo.F90

但有

nagfor -F -Wp,-dM foo.F90

我明白了

NAG Fortran Compiler Release 5.3(854)
fpp: warning: bad option: -dM , ignored.

我查看了nagfor documentationfpp documentation,但找不到答案。

我正在寻找一些变量来确定文件正在使用 nagfor 编译,因此相当于 gfortran __GFORTRAN__、ifort __INTEL_COMPILER 和 pgf90 __PGI

【问题讨论】:

    标签: compilation fortran preprocessor nag-fortran


    【解决方案1】:

    埋在我找到的 fpp 文档中(4.5.4 Macro definition 用于 6.2 版,5.3 版问题链接文档的第 5.4 节)

    宏 NAGFOR 是默认定义的。

    果然

    #ifdef NAGFOR
      print '("nagfor says hello")'
    #endif
    end
    

    通过预处理器时具有所需的结果。在我的例子中,宏取值1,但我不知道这可能有多一致。

    作为Themos Tsikas cmets,有also the macros __NAG_COMPILER_RELEASE__NAG_COMPILER_BUILD 确实采用明确定义的值。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 2021-05-25
    • 2011-07-09
    • 1970-01-01
    • 2021-12-29
    • 1970-01-01
    相关资源
    最近更新 更多