Fixes missing DIR_SEPARATOR if --with-gxx-include-dir configured as subdir of sysroot.

2013-12-10  Ryan Mansfield  <rmansfi...@qnx.com>

        PR preprocessor/56896
* incpath.c (add_standard_paths): Strip trailing sysroot DIR_SEPARATOR
        only if appended path begins with DIR_SEPARATOR.

Regards,

Ryan Mansfield
Index: incpath.c
===================================================================
--- incpath.c	(revision 205857)
+++ incpath.c	(working copy)
@@ -179,7 +179,8 @@
 	      char *sysroot_no_trailing_dir_separator = xstrdup (sysroot);
 	      size_t sysroot_len = strlen (sysroot);
 
-	      if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR)
+	      if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR
+		  && p->fname[0] == 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);

Reply via email to