We got a large framework written in Fortran fixed format (*.f) files - where we have a lot of __FILE__
and __LINE__
to print errors, warnings etc at run time. We have so far only used ifort
and there has been no problem using the -fpp
flag for the macros used.
Now we are looking to use gfortran
by GNU and the problem has emerged where the macros __FILE__
and __LINE__
and many line do exceed the 72 column limit for the fixed format. We think gfortran
with cpp
prints the entire path to the file when using __FILE__
, which quite easily can make the 72 column limit easily exceeded.
The one option we have tried is to use -ffixed-line-length-none
which seems to overcome the latter issue but in turn create the following problem
Error: Expected expression at (1) in PARAMETER statement
mkl_vsl.f90:711:72:
mkl_vsl
is the MKL VSL library by intel
and line 711 looks like this:
PARAMETER (VSL_RNG_METHOD_EXPONENTIAL_ICDF_ACCURATE= &
&IOR(VSL_RNG_METHOD_EXPONENTIAL_ICDF,VSL_RNG_METHOD_ACCURACY_FLAG))
Is there a way to truncate __FILE__
so it only prints the filename rather than the entire path?