This is the mail archive of the mailing list for the GCC 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: [Fortran, Patch] Fix CPP <include_path> (PR 37821)

Hi all,

first I would like to know how gfortran should handle the following:


$ gfortran dir1/source_file1 dir2/source_file2

In "gcc" an
    #include "include_file"
succeeds for source_file1 but fails for source_file2.

In "gfortran" a
   INCLUDE  "include_file"
will work for both source_file1 as for source_file2

The question is what should happen for
   #include "include_file"
in gfortran?  The same as for C's #include "..." or the same as for
gfortran's INCLUDE?

That determines whether one should use
  + if (quote)
  +    return;
  + add_path (path, BRACKET, cxx_aware, user_supplied);
  + add_path (path, quote ? QUOTE : BRACKET, cxx_aware, user_supplied);
in gfc_cpp_add_include_path.

In any case I would be delighted if someone could give some feedback.
Except for this point, the patch can also be reviewed...


Tobias Burnus wrote:
> Hi all,
> attached a revised patch as the previous patch broke "include"
> ("#include" worked) for ".".
> The new patch features:
> * #include "..." and  include '...' test cases
> * directories where the source files resist come first
>   in the include list (both #include "..." and include)
> * "." is not added for #include "..." as licpp does so
>   automatically
> * the location of the sourcefile is not added for
>   #include <...> but -I dir is also used for <...>
>   (This was the problem reported in the PR.)
> * With explicit -cpp the -I dir are only passed once
>   to f951 (still twice for the implict (.F etc.) cpp
>   calling).
> Bootstrapped and regtested on x86-64-linux
> I also did several manual tests (for -cpp the "-v" option
> shows the search paths). [I would not mind if someone could
> also playround with include (w/ and w/o -cpp) and with
> #include "..." and #include <...>. I think everything should
> work, but I'm not positive.]
> OK for the trunk?
> Tobias
> PS: I have just started wondering whether libcpp automatically
>   adds "subdir" to the search path for  "gfortran subdir/file.F".
>   I'm not sure whether I tested this; I think with this
>   patch the path is added, which might not be needed but it
>   does not harm (= does what is should and shows no warning
>   with -v [this is also tested for by the new test case]).

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