哪个 gfortran 编译器标志与警告 "Illegal preprocessor directive" 相关联?

Which gfortran compiler flag is associated with the warning "Illegal preprocessor directive"?

当使用 pFUnit (3.2.9) 测试我的 Fortran 代码时,我收到许多 "Illegal preprocessor directive" 警告,例如

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。

这不是那种应该关闭的警告,因为不使用预处理器通常会对使用 #define#if 等最常见指令的代码产生非常糟糕的后果。据我所知,无法将其关闭。

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