]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-incpath.c (add_standard_paths): Add both "translated" and non-translated header...
authorAlan Modra <amodra@bigpond.net.au>
Tue, 25 Mar 2003 23:23:23 +0000 (23:23 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Tue, 25 Mar 2003 23:23:23 +0000 (09:53 +1030)
* c-incpath.c (add_standard_paths): Add both "translated" and
non-translated header paths.

From-SVN: r64872

gcc/ChangeLog
gcc/c-incpath.c

index 273f30afa6a997ded5dd1a72f03287eefa166e88..22da035348978540be8e7bff5c7cea22e5f17d9d 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-26  Alan Modra  <amodra@bigpond.net.au>
+
+       * c-incpath.c (add_standard_paths): Add both "translated" and
+       non-translated header paths.
+
 2003-03-25  Loren James Rittle  <ljrittle@acm.org>
 
        * doc/install.texi (*-*-freebsd*): Update with known status.
index 06c9346edede9d62a7227d24ac422cd1c5622f94..abd738c027e0f11716190241ad705d81108bbce6 100644 (file)
@@ -127,10 +127,30 @@ add_standard_paths (sysroot, iprefix, cxx_stdinc)
      int cxx_stdinc;
 {
   const struct default_include *p;
-  size_t len = 0;
+  size_t len;
 
-  if (iprefix)
-    len = cpp_GCC_INCLUDE_DIR_len;
+  if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
+    {
+      /* Look for directories that start with the standard prefix.
+        "Translate" them, ie. replace /usr/local/lib/gcc... with
+        IPREFIX and search them first.  */
+      for (p = cpp_include_defaults; p->fname; p++)
+       {
+         if (!p->cplusplus || cxx_stdinc)
+           {
+             /* Should we be translating sysrooted dirs too?  Assume
+                that iprefix and sysroot are mutually exclusive, for
+                now.  */
+             if (sysroot && p->add_sysroot)
+               continue;
+             if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
+               {
+                 char *str = concat (iprefix, p->fname + len, NULL);
+                 add_path (str, SYSTEM, p->cxx_aware);
+               }
+           }
+       }
+    }
 
   for (p = cpp_include_defaults; p->fname; p++)
     {
@@ -141,11 +161,6 @@ add_standard_paths (sysroot, iprefix, cxx_stdinc)
          /* Should this directory start with the sysroot?  */
          if (sysroot && p->add_sysroot)
            str = concat (sysroot, p->fname, NULL);
-         /* Does this directory start with the prefix?  If so, search
-            "translated" versions of GNU directories.  These have
-            /usr/local/lib/gcc... replaced by iprefix.  */
-         else if (len && !strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
-           str = concat (iprefix, p->fname + len, NULL);
          else
            str = update_path (p->fname, p->component);