This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -cpp and 'include'


On Mon, May 18, 2009 at 13:55, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
...
> One justification for the current behavior, IMHO, is that invoking CPP
> via the gfortran driver should behave the same way as if you run CPP
> manually before compiling, as seems to be pretty common in many
> makefiles. Hence, as CPP doesn't understand the Fortran INCLUDE
> statement, preprocessing foo.f shouldn't cause a file INCLUDE'd in
> foo.f to be preprocessed either.

Janne, that is certainly a valid argument and I probably can't rebut
it, but I'll try.

cpp with C or C++ doesn't have to consider this problem because the
'#include' statement is the only way a file can be included inline at
a desired place in a source file.  Since F95 has the 'include'
statement, and the intent of the user is to preprocess fortran source,
then I think a case can be made for doing the fortran include before
running cpp.

The only use case I can think of at the moment is pretty weak, but we
have over 50 include files, among over 4000 source files, that have
cpp #define macros in them and a few conditionals for various
non-compiler selections.  Right now we're using the '#include'
construct, but we would like to change to the 'include' statement as
we move to support f95 compilers only and gradually add f95 code.

Maybe an integrated coco preprocessor is the best solution.  Is that planned?

-Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]