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 | |
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')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/doc/cppdiropts.texi | 5 | ||||
-rw-r--r-- | gcc/incpath.c | 13 |
3 files changed, 18 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b78674ee3f..a2340c0f253 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * incpath.c (add_sysroot_to_chain): Allow for $SYSROOT prefix. + * doc/cppdiropts.texi (-I @var{dir}): Document it. + 2016-06-22 Richard Biener <rguenther@suse.de> * tree-vect-loop.c (vect_model_reduction_cost): Handle diff --git a/gcc/doc/cppdiropts.texi b/gcc/doc/cppdiropts.texi index 1f72649937c..eee2b5cede8 100644 --- a/gcc/doc/cppdiropts.texi +++ b/gcc/doc/cppdiropts.texi @@ -22,8 +22,9 @@ for header files during preprocessing. @ifset cppmanual @xref{Search Path}. @end ifset -If @var{dir} begins with @samp{=}, then the @samp{=} is replaced -by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. +If @var{dir} begins with @samp{=} or @code{$SYSROOT}, then the @samp{=} +or @code{$SYSROOT} is replaced by the sysroot prefix; see +@option{--sysroot} and @option{-isysroot}. Directories specified with @option{-iquote} apply only to the quote form of the directive, @code{@w{#include "@var{file}"}}. 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, |