diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2017-06-22 14:37:17 +0000 |
---|---|---|
committer | Rainer Orth <ro@gcc.gnu.org> | 2017-06-22 14:37:17 +0000 |
commit | a055692a25c10bcd8fd90825cc39709f455335b2 (patch) | |
tree | d64fa4392ab92ef4e859af226d5e16ae03bd3b82 /gcc/incpath.c | |
parent | c8a47c4877889b42afc5e3804c0fc575770564f2 (diff) |
Support $SYSROOT for = in -I etc.
* incpath.c (add_sysroot_to_chain): Allow for $SYSROOT prefix.
* doc/cppdiropts.texi (-I @var{dir}): Document it.
From-SVN: r249560
Diffstat (limited to 'gcc/incpath.c')
-rw-r--r-- | gcc/incpath.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/incpath.c b/gcc/incpath.c index 98fe5ec9ab3..47942e2547d 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -314,7 +314,7 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, } /* Add SYSROOT to any user-supplied paths in CHAIN starting with - "=". */ + "=" or "$SYSROOT". */ static void add_sysroot_to_chain (const char *sysroot, int chain) @@ -322,8 +322,15 @@ 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); + { + if (p->user_supplied_p) + { + if (p->name[0] == '=') + p->name = concat (sysroot, p->name + 1, NULL); + if (strncmp (p->name, "$SYSROOT", strlen ("$SYSROOT")) == 0) + p->name = concat (sysroot, p->name + strlen ("$SYSROOT"), NULL); + } + } } /* Merge the four include chains together in the order quote, bracket, |