Error preprocessing a fortran comment

Angelo Graziosi angelo.graziosi@alice.it
Wed Feb 1 08:39:00 GMT 2017


I have the following test case which fails to build as follow:

$ cat prep_test.f90
!
!   rm -rf {*.mod,~/programming/modules/*} && \
!   gfortran[-mp-X] [-Warray-temporaries] -O3 -Wall \
!     -Wno-unused-dummy-argument $BLD_OPTS -J ~/programming/modules \
!     ~/programming/basic-modules/{kind,math}_consts.f90 \
!     ~/programming/ode-modules/{everhart_integrator,\
!       cernlib_integrators}.f90 test_jsunp.f90 -o test_jsunp$EXE && \
!     rm -rf {*.mod,~/programming/modules/*}
!
!   ./test_jsunp$EXE

!
! gfortran -cpp prep_test.f90 -o prep_test.out
!
program prep_test
   implicit none
#if defined(PRINT_MSG)
   print *, 'Hello World'
#endif
   print *, 'NO MSG'
end program prep_test

$ gfortran -cpp -DPRINT_MSG prep_test.f90 -o prep_test.out
prep_test.f90:2:0: error: unterminated comment
  !   rm -rf {*.mod,~/programming/modules/*} && \
  ^

To have it builds, I have to remove the comment lines containing

   rm -rf {*.mod,~/programming/modules/*}


I wonder if this is to be expected... or if one can exclude comment from 
preprocessing.


Thanks,
   Angelo.



More information about the Fortran mailing list