]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* c-incpath.c (add_sysroot_to_chain): New.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2007 20:38:27 +0000 (20:38 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2007 20:38:27 +0000 (20:38 +0000)
(merge_include_chains): Add sysroot argument.  Call
add_sysroot_to_chain if sysrooted.
(register_include_chains): Update call to merge_include_chains.
* doc/cppopts.texi: Document use of '=' in include directory
arguments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123134 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-incpath.c
gcc/doc/cppopts.texi

index f88b0ed5dc254133b2fa831e13113fdccabeef88..047a1ffcfe9c52efa57c3191ecc181ae65a2e733 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-22  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-incpath.c (add_sysroot_to_chain): New.
+       (merge_include_chains): Add sysroot argument.  Call
+       add_sysroot_to_chain if sysrooted.
+       (register_include_chains): Update call to merge_include_chains.
+       * doc/cppopts.texi: Document use of '=' in include directory
+       arguments.
+
 2007-03-22  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (cmp<mode>): Rename from cmpsf and cmpdf.
index 3a9585bd26de23edf8778804a9bbe61e71a1d4f5..3e819cec8380f8d8490436d649b9f3b51d13dac1 100644 (file)
@@ -51,7 +51,8 @@ static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
 static void add_env_var_paths (const char *, int);
 static void add_standard_paths (const char *, const char *, const char *, int);
 static void free_path (struct cpp_dir *, int);
-static void merge_include_chains (cpp_reader *, int);
+static void merge_include_chains (const char *, cpp_reader *, int);
+static void add_sysroot_to_chain (const char *, int);
 static struct cpp_dir *remove_duplicates (cpp_reader *, struct cpp_dir *,
                                           struct cpp_dir *,
                                           struct cpp_dir *, int);
@@ -282,6 +283,19 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
   return head;
 }
 
+/* Add SYSROOT to any user-supplied paths in CHAIN starting with
+   "=".  */
+
+static void
+add_sysroot_to_chain (const char *sysroot, int chain)
+{
+  struct cpp_dir *p;
+
+  for (p = heads[chain]; p != NULL; p = p->next)
+    if (p->name[0] == '=' && p->user_supplied_p)
+      p->name = concat (sysroot, p->name + 1, NULL);
+}
+
 /* Merge the four include chains together in the order quote, bracket,
    system, after.  Remove duplicate dirs (as determined by
    INO_T_EQ()).
@@ -293,8 +307,17 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
    written -iquote bar -Ifoo -Iquux.  */
 
 static void
-merge_include_chains (cpp_reader *pfile, int verbose)
+merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
 {
+  /* Add the sysroot to user-supplied paths starting with "=".  */
+  if (sysroot)
+    {
+      add_sysroot_to_chain (sysroot, QUOTE);
+      add_sysroot_to_chain (sysroot, BRACKET);
+      add_sysroot_to_chain (sysroot, SYSTEM);
+      add_sysroot_to_chain (sysroot, AFTER);
+    }
+
   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
      resulting SYSTEM chain.  */
   if (heads[SYSTEM])
@@ -419,7 +442,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
 
   target_c_incpath.extra_includes (sysroot, iprefix, stdinc);
 
-  merge_include_chains (pfile, verbose);
+  merge_include_chains (sysroot, pfile, verbose);
 
   cpp_set_include_chains (pfile, heads[QUOTE], heads[BRACKET],
                          quote_ignores_source_dir);
index fbd6f80790af0648c341e676ecdb138e752eb52a..17235bdae589b44ec257d2da17d2ae96117431d4 100644 (file)
@@ -65,6 +65,8 @@ of system headers are not defeated
 (@pxref{System Headers})
 @end ifset
 .
+If @var{dir} begins with @code{=}, then the @code{=} will be replaced
+by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
 
 @item -o @var{file}
 @opindex o
@@ -464,6 +466,8 @@ specified by @option{-include}.
 Search @var{dir} for header files, but do it @emph{after} all
 directories specified with @option{-I} and the standard system directories
 have been exhausted.  @var{dir} is treated as a system include directory.
+If @var{dir} begins with @code{=}, then the @code{=} will be replaced
+by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
 
 @item -iprefix @var{prefix}
 @opindex iprefix
@@ -499,6 +503,8 @@ is applied to the standard system directories.
 @ifset cppmanual
 @xref{System Headers}.
 @end ifset
+If @var{dir} begins with @code{=}, then the @code{=} will be replaced
+by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
 
 @item -iquote @var{dir}
 @opindex iquote
@@ -509,6 +515,8 @@ Search @var{dir} only for header files requested with
 @ifset cppmanual
 @xref{Search Path}.
 @end ifset
+If @var{dir} begins with @code{=}, then the @code{=} will be replaced
+by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
 
 @item -fdollars-in-identifiers
 @opindex fdollars-in-identifiers