This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[Patch, Fortran] Fix CPP <include_path> (PR 37821)


Hi all,

using -I dir  was not adding the directory to the #include <...>  search
path but only to the  #include "..."  search path, which is a regression.

The patch fixes this by adding the path to the chain BRACKET instead of
to QUOTE. Additionally, I removed the adding of "." which is automatically
searched for  #include "..."  and thus does not need to be added.

Build on x86-64-linux and regtested.
OK for the trunk?

 * * *

There is one harmless problem left: gfortran -I dir  passes the -I twice
to f951 for -cpp (but only once for -nocpp). I think it is due to:

#define F951_OPTIONS     "%(cc1_options) %{J*} %{I*}\

The %{I*}  causes the second -I, I don't know where the first -I comes from,
maybe from cc1_options? In any case it only appears for -cpp. The effect is
a warning that the duplicated -I has been removed, which is only shown when
compiled with "-v". I fill a bug for this.

Tobias
2008-08-15  Tobias Burnus  <burnus@net-b.de>

	PR fortran/37821
	* cpp.c (gfc_cpp_add_include_path): Fix BRACKET include path.
	* options.c (gfc_post_options): Remove superflous include path.

Index: gcc/fortran/cpp.c
===================================================================
--- gcc/fortran/cpp.c	(Revision 141117)
+++ gcc/fortran/cpp.c	(Arbeitskopie)
@@ -628,10 +628,9 @@ gfc_cpp_add_include_path (char *path, bo
 {
   /* CHAIN sets cpp_dir->sysp which differs from 0 if PATH is a system
      include path. Fortran does not define any system include paths.  */
-  int chain = 0;
   int cxx_aware = 0;
 
-  add_path (path, chain, cxx_aware, user_supplied);
+  add_path (path, BRACKET, cxx_aware, user_supplied);
 }
 
 void
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c	(Revision 141117)
+++ gcc/fortran/options.c	(Arbeitskopie)
@@ -266,8 +266,6 @@ gfc_post_options (const char **pfilename
       source_path[i] = 0;
       gfc_add_include_path (source_path, true);
     }
-  else
-    gfc_add_include_path (".", true);
 
   if (canon_source_file != gfc_source_file)
     gfc_free (CONST_CAST (char *, canon_source_file));

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