]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc.c (add_sysrooted_prefix): Remove trailing dir separator from system root.
authorMatthias Klose <doko@ubuntu.com>
Thu, 26 Jan 2012 23:34:58 +0000 (23:34 +0000)
committerMatthias Klose <doko@gcc.gnu.org>
Thu, 26 Jan 2012 23:34:58 +0000 (23:34 +0000)
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.

From-SVN: r183591

gcc/ChangeLog
gcc/gcc.c
gcc/incpath.c

index d849d96d6c8bf1744962c86237407b678c85fdb5..82fc2ad5d5b8871142e19239dab7090f7f8b5f14 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2012-01-27  Richard Henderson  <rth@redhat.com>
 
        * config/m68k/m68k.c (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New.
index 6cdd9592cd5071d72d6e60edcd1a18d44b5b2f64..bea9b4642070ea5634299809078a48b09cb070b8 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2445,9 +2445,17 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
 
   if (target_system_root)
     {
+      char *sysroot_no_trailing_dir_separator = xstrdup (target_system_root);
+      size_t sysroot_len = strlen (target_system_root);
+
+      if (sysroot_len > 0
+         && target_system_root[sysroot_len - 1] == DIR_SEPARATOR)
+       sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0';
+
       if (target_sysroot_suffix)
          prefix = concat (target_sysroot_suffix, prefix, NULL);
-      prefix = concat (target_system_root, prefix, NULL);
+      prefix = concat (sysroot_no_trailing_dir_separator, prefix, NULL);
+      free (sysroot_no_trailing_dir_separator);
 
       /* We have to override this because GCC's notion of sysroot
         moves along with GCC.  */
index 6b683a053dcc007363ae3bcb0034d9f4f3fe6786..6693bf524503857fe84b316a4c79ef7902de390e 100644 (file)
@@ -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))
            {