diff options
author | doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-26 23:34:58 +0000 |
---|---|---|
committer | doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-26 23:34:58 +0000 |
commit | c5698d9fdbf23c990473f383da45580515114ca1 (patch) | |
tree | 2fc10497db064ce149773544b78b0900ecfbf688 /gcc/incpath.c | |
parent | abbb0ba2b726a9a2fa2ccc01a58db448e8599c1e (diff) | |
download | gcc-c5698d9fdbf23c990473f383da45580515114ca1.tar.gz |
2012-01-27 Matthias Klose <doko@ubuntu.com>
* gcc.c (add_sysrooted_prefix): Remove trailing dir separator from
system root.
* incpath.c (add_standard_paths): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183591 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/incpath.c')
-rw-r--r-- | gcc/incpath.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/incpath.c b/gcc/incpath.c index 6b683a053dc..6693bf52450 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -1,6 +1,6 @@ /* Set up combined include path chain for the preprocessor. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 Free Software Foundation, Inc. Broken out of cppinit.c and cppfiles.c and rewritten Mar 2003. @@ -166,7 +166,15 @@ add_standard_paths (const char *sysroot, const char *iprefix, /* Should this directory start with the sysroot? */ if (sysroot && p->add_sysroot) - str = concat (sysroot, p->fname, NULL); + { + char *sysroot_no_trailing_dir_separator = xstrdup (sysroot); + size_t sysroot_len = strlen (sysroot); + + if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR) + sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0'; + str = concat (sysroot_no_trailing_dir_separator, p->fname, NULL); + free (sysroot_no_trailing_dir_separator); + } else if (!p->add_sysroot && relocated && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len)) { |