哪个gfortran编译器标志与警告“非法预处理器指令"相关联? [英] Which gfortran compiler flag is associated with the warning "Illegal preprocessor directive"?

查看:97
本文介绍了哪个gfortran编译器标志与警告“非法预处理器指令"相关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用pFUnit(3.2.9)测试我的Fortran代码时,我收到许多非法预处理器指令"警告,例如

When using pFUnit (3.2.9) to test my Fortran code, I get many "Illegal preprocessor directive" warnings, e.g.

Warning: Illegal preprocessor directive
/path/to/my/file/test.f90:37:2:

 #line 26 "/path/to/my/file/test.f90"
  1

代码可以编译并正常运行,因此我想关闭这些警告,同时仍然看到其他编译器警告.哪个gfortran编译器标志会关闭此特定警告?我正在使用gfortran 7.3.1.

The code compiles and runs fine, so I would like to turn off these warnings, while still seeing other compiler warnings. Which gfortran compiler flag turns this specific warning off? I am working with gfortran 7.3.1.

推荐答案

这不是应该关闭警告,因为不使用预处理器通常会对使用最常见指令(例如#if.据我所知,不可能将其关闭.

This is not the kind of warning that one should turn off because not using a preprocessor has usually very bad consequences on codes that use the most common directives like #define and #if. And as far as I know it isn't possible to turn it off.

使用-cpp标志启用预处理器更为明智.不仅警告会停止,而且在进一步的诊断中您还将获得正确的行号,这些行号将引用您的原始代码.

It is much wiser to enable the preprocessor using the -cpp flag. Not only the warnings will stop but you will get the correct line numbers in further diagnostics as well, the line numbers will refer to your original code.

这篇关于哪个gfortran编译器标志与警告“非法预处理器指令"相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆