This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/18428] No preprocessing option -cpp for gfortran
- From: "c dot lemmen at fz-juelich dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jun 2005 11:37:04 -0000
- Subject: [Bug fortran/18428] No preprocessing option -cpp for gfortran
- References: <20041111132926.18428.c.lemmen@fz-juelich.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From c dot lemmen at fz-juelich dot de 2005-06-12 11:36 -------
> "gfortran -x f95-cpp-input" works
> maybe this should be documented.
This is not the same.
1) The -x <language> option states that ALL following input files should be
treated as being of type <language">
2) The former -cpp option stated that all following SOURCE files should be
preprocessed
In many legacy Makefiles, subroutines are compiled into object files, and in a
last step the main code ist compiled and linked to all dependencies in ONE step,
like
gfortran main.f90 -o main sub1.o sub2.o sub3.o
Now, for code with preprocessor directives, with other compilers you can specify
to precompile the sources, like
f90 -cpp main.f90 -o main sub1.o sub2.o sub3.o
With gfortran and the -cpp option gone, someone who replaces the -cpp with -x
f95-cpp-input (easy to do with FLAGS), a la
gfortran -x f95-cpp-input main.f90 -o main sub1.o sub2.o sub3.o
doesn't compile properly, since the binary object files are read as source (to
be preprocessed)
You would need to specify another -x object-input (or similar) before the object
files, that makes it significantly harder to adjust or write Makefiles.
Alternatively, all source must be compiled first and linked in a separate step.
As stated above, this rather clean version is not considered in lots of existing
Makefiles.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18428