Pre-processing !DEC$ directives in gfortran
I've got a large Fortran codebase that originally targeted Intel's compiler. I'm now gearing up to compile with gfortran. Unfortunately, the code is littered with Intel-style pre-processing directives like:
!DEC$ IF DEFINED (MYDIRECTIVE)
REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
!DEC$ ENDIF
From what I can tell via googling and the gfortran docs, there is no internal gfortran support for anything besides C-style pre-processing, like:
#if defined MYD开发者_运维百科IRECTIVE
REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
#endif
Has anyone else encountered this problem and come up with an elegant solution? Obviously, I could write a shell script which calls an external pre-processor before passing code to gfortran for compile, but this just doesn't seem like a terrific solution to me.
Any thoughts? Thanks SO gurus!
Intel ifort understands the C-style preprocessor directives, so it might be easiest to convert your files to that style. Then you would have a single code base that would work with both compilers. There would be some work regression testing the converted code with ifort.
精彩评论