Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usual causes for bad preprocessor warning

I am unfamiliar with what causes the following warning:

warning #5117: Bad # preprocessor line
#include "rtt_alloc_rad.interface"

I've looked at the obvious problems such as the #include is flushed left. I would love to get some tips for where to look for possible causes.

I'm using an Intel compiler: ifort version 15.0.1

The code is with a large climate model linked to an external library. It is difficult to know what to post, but the warning comes from the following snippet:

MODULE rtt_interface

use rtt_types,    only : rtt_options, rtt_coefs, profile_Type, &
transmission_Type, radiance_Type,rtt_coef_scatt_ir,rtt_optpar_ir, &       
rtt_chanprof, rtt_emissivity, rtt_reflectance
use rtt_const,    only : errorstatus_success, errorstatus_fatal, & 
platform_name,inst_name
use rtt_unix_env, only : rtt_exit
use cosp_kinds,     only : wp,wi,wl

IMPLICIT NONE

real(wp), parameter :: tmin_baran = 193.1571_wp  

#include "rtt_alloc_rad.interface" 
#include "rtt_alloc_transmission.interface"
#include "rtt_alloc_prof.interface"
#include "rtt_dealloc_coefs.interface"
#include "rtt_direct.interface"
#include "rtt_print_opts.interface"

! snip...

END MODULE rtt_interface

I compile with the flags: f90flags=-g -fp-model precise -traceback -r8 -O0

like image 721
Shejo284 Avatar asked Apr 11 '16 19:04

Shejo284


1 Answers

The message

warning #5117: Bad # preprocessor line

is potentially a little misleading. It suggests that the code has been passed through the preprocessor and it's the preprocessor that's unhappy. That isn't always the case: ifort also produces this warning message when preprocessor directives occur in the source file but the preprocessor isn't invoked.

To ensure that the preprocessor is run you have a couple of options:

  • add the flag -fpp (or -cpp) to the compilation command;
  • name the free-form source file with the suffix .F90 (note the capital).
like image 154
francescalus Avatar answered Sep 22 '22 19:09

francescalus