The Fortran preprocessor, FPP, is provided as part of the Intel® Fortran product. When you use a preprocessor for Intel Fortran source files, the generated output files are used as input source files by the Compiler.
Preprocessing performs such tasks as preprocessor symbol (macro) substitution, conditional compilation, and file inclusion. Intel Fortran predefined symbols as described in Predefined Preprocessor Symbols.
The FPP preprocessor can process both free- and fixed-form Fortran source files.
You can explicitly run FPP in these ways:
On the ifort command line, use the ifort command with the -fpp (Linux and Mac OS) or /fpp (Windows) option. By default, the specified files are then compiled and linked. To retain the intermediate (.i or .i90) file, specify the -save-temps (Linux and Mac OS) or /Qsave_temps (Windows) option.
On the command line, use the FPP command. In this case, the compiler is not invoked. When using the FPP command line, you need to specify the input file and the intermediate (.i or .i90) output file. For more information, type FPP/HELP on the command line.
In the Microsoft Visual Studio* IDE, set the Preprocess Source File option to Yes in the Fortran Preprocessor Option Category. To retain the intermediate files, add /Qsave_temps to Additional Options in the Fortran Command Line Category.
In addition, the Intel Fortran compiler automatically preprocesses source files that have a filename extension of .fpp, and, on Linux and Mac OS systems, uppercase file extensions of .F, .F90, .FOR, .FTN, or .FPP. For example, the following command preprocesses a source file that contains standard Fortran preprocessor directives, then passes the preprocessed file to the compiler and linker:
ifort source.fpp
If you want to preprocess files that have other Fortran extensions than those listed, you have to explicitly specify the preprocessor.
FPP has some of the capabilities of the ANSI C preprocessor and supports a similar set of directives.
The following lists some common cpp features that are supported by fpp as well as common features that are not supported.
Supported cpp features: | Unsupported cpp features: |
#define, #undef, #ifdef, #ifndef, #if, #elif, #else, #endif, #include, #error, #warning, #line | #pragma, #ident |
# (stringsize) and ## (concatenation) operators | spaces or tab characters preceding the initial "#" character
# followed by empty line |
! as negation operator | \ backslash-newline |
You do not usually need to specify preprocessing for Fortran source programs unless your program uses C-style preprocessing commands, such as those listed above.
If you choose to preprocess your source programs, use the preprocessor fpp, which is the preprocessor supplied with the Intel® Fortran Compiler, or the preprocessing capability of the Fortran compiler. It is recommended that you use fpp.
Using a preprocessor that does not support Fortran can damage your Fortran code, especially with FORMAT statements. For example, FORMAT (\\I4) changes the meaning of the program because the double backslash "\\" indicates end-of-record with most C/C++ preprocessors.