Ada: Preprocessor

The Fortran source file names suffixed by  .fpp, .F, .FOR, .FTN, .FPP or .F90 language are automatically preprocessed. The Fortran source file names suffixed by  .f, .for, .ftn or .f90, require the addition of the option  -fpp for them to be preprocessed.

The option  -Wp of the C and Fortran compilation systems allows specifying the options passed to the preprocessor component fpp.


$ ifort -Wp,-DDIM=5,-DDOUBLE trucc.F90
$ ifort -fpp -Wp,-DDIM=5,-DDOUBLE trucc.f90
$ cat trucc.F90
#define VAL 1.
#ifdef DOUBLE
#  define MYKIND 8
#  define MYKIND 4
  program trucc
   implicit none
   real(kind=MYKIND),dimension(DIM) :: tab
   print *, kind(tab)
   print *, tab
  end program trucc

The options -E/-P of the Fortran and C compilation systems only allow executing the preprocessor component fpp. The option -E produces the transformed source on the standard output, while the option -P writes it in a file with the same name but suffixed by the character .i or .i90.

Here are two equivalent examples for Fortran, and two equivalent examples for C:

$ ifort -E -DDEBUG source.F > source.i
$ ifort -P -DDEBUG source.F
$ icc -E -DDEBUG source.c > source.i
$ icc -P -DDEBUG source.c