Preliminary processing! DEC $ directives in gfortran

I have a large Fortran database that was originally intended for the Intel compiler. Now I'm getting ready to compile with gfortran. Unfortunately, the code is littered with Intel preprocessing directives, such as:

!DEC$ IF DEFINED (MYDIRECTIVE) REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var !DEC$ ENDIF 

From what I can tell through googling and gfortran docs, there is no internal gfortran support for anything other than C-style preprocessing, for example:

 #if defined MYDIRECTIVE REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var #endif 

Has anyone else encountered this problem and came up with an elegant solution? Obviously, I could write a shell script that calls an external preprocessor before passing the code to gfortran for compilation, but that just doesn't seem like a terrific solution to me.

Any thoughts? Thanks SO guru!

+4
source share
1 answer

Intel ifort understands C-style preprocessor directives, so it would be easier to convert your files to this style. Then you will have one code base that will work with both compilers. There will be some regression of work checking the converted code with ifort.

+2
source

Source: https://habr.com/ru/post/1302767/


All Articles