diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-09-10 14:09:17 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-09-10 14:09:17 +0200 |
commit | 2b44ab8ba02d9ef5e34dd5f54dd1b4d3759941b9 (patch) | |
tree | 1e02ee233e859fc45be42e0903c2490225a70667 /gcc/fortran/gfortran.texi | |
parent | 4326371014b6e9e8bc2583e5f83ea19ccfef5ee4 (diff) | |
download | gcc-2b44ab8ba02d9ef5e34dd5f54dd1b4d3759941b9.tar.gz |
re PR fortran/31547 (Document when CPP is called and document the f95-cpp-input option)
2007-09-10 Tobias Burnus <burnus@net-b.de>
PR fortran/31547
* gfortran.texi: Document when CPP is called.
* intrinsic.texi (IOR): Fix typos.
From-SVN: r128331
Diffstat (limited to 'gcc/fortran/gfortran.texi')
-rw-r--r-- | gcc/fortran/gfortran.texi | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 1125326235a..73ddcb0373a 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -225,6 +225,7 @@ or alternative to, the unix @command{f95} command; @menu * About GNU Fortran:: What you should know about the GNU Fortran compiler. * GNU Fortran and GCC:: You can compile Fortran, C, or other programs. +* Preprocessing and conditional compilation:: The Fortran preprocessor * GNU Fortran and G77:: Why we chose to start from scratch. * Project Status:: Status of GNU Fortran, roadmap, proposed extensions. * Standards:: Standards supported by GNU Fortran. @@ -382,6 +383,39 @@ Fortran compiler. @c --------------------------------------------------------------------- +@c Preprocessing and conditional compilation +@c --------------------------------------------------------------------- + +@node Preprocessing and conditional compilation +@section Preprocessing and conditional compilation +@cindex CPP +@cindex FPP +@cindex Conditional compilation +@cindex Preprocessing + +Many Fortran compilers including GNU Fortran allow to pass the source code +through a C preprocessor (CPP; sometimes also called Fortran preprocessor, +FPP) to allow for conditional compilation. In case of GNU Fortran +this is the GNU C Preprocessor in the traditional mode. On systems with +case-preserving file names, the preprocessor is automatically invoked if the +file extension is @code{.F}, @code{.F90}, @code{.F95} or @code{.F03}; +otherwise use for fixed-format code the option @code{-x f77-cpp-input} +and for free-format code @code{-x f95-cpp-input}. Invocation of the +preprocessor can be suppressed using @code{-x f77} or @code{-x f95}. + +If the GNU Fortran invoked the preprocessor, @code{__GFORTRAN__} +is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and +@code{__GNUC_PATCHLEVEL__} can be used to determine the version of the +compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details. + +While CPP is the de-facto standard for preprocessing Fortran code, +Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines +Conditional Compilation, which is not widely used and not directly +supported by the GNU Fortran compiler. You can use the program coco +to preprocess such files (@uref{http://users.erols.com/dnagle/coco.html}). + + +@c --------------------------------------------------------------------- @c GNU Fortran and G77 @c --------------------------------------------------------------------- |