aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-incpath.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2003-03-25 23:23:23 +0000
committerAlan Modra <amodra@gcc.gnu.org>2003-03-26 09:53:23 +1030
commit611f07298ca64e3f8317f4ad7ed2da36d3d7d7fc (patch)
tree94d2a6fe6464db5a0f0fc7b4f2eb92e669194577 /gcc/c-incpath.c
parente4e7d312cd684d267e661faa08db332ddf347856 (diff)
downloadgcc-611f07298ca64e3f8317f4ad7ed2da36d3d7d7fc.zip
gcc-611f07298ca64e3f8317f4ad7ed2da36d3d7d7fc.tar.gz
gcc-611f07298ca64e3f8317f4ad7ed2da36d3d7d7fc.tar.bz2
c-incpath.c (add_standard_paths): Add both "translated" and non-translated header paths.
* c-incpath.c (add_standard_paths): Add both "translated" and non-translated header paths. From-SVN: r64872
Diffstat (limited to 'gcc/c-incpath.c')
-rw-r--r--gcc/c-incpath.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c
index 06c9346..abd738c 100644
--- a/gcc/c-incpath.c
+++ b/gcc/c-incpath.c
@@ -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);