Commit b187f5cd by Danny Smith Committed by Nathan Froyd

re PR c/22133 (In MinGW trailing slash forward not allowed in include path)

	PR 22133
	* c-incpath.c (add_path): Strip trailing path separators.

From-SVN: r124504
parent ce2e6349
2007-05-07 Danny Smith <dannysmith@users.sourceforge.net>
Nathan Froyd <froydnj@codesourcery.com
PR 22133
* c-incpath.c (add_path): Strip trailing path separators.
2007-05-07 Eric Botcazou <ebotcazou@adacore.com> 2007-05-07 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered.
......
...@@ -389,13 +389,18 @@ add_path (char *path, int chain, int cxx_aware, bool user_supplied_p) ...@@ -389,13 +389,18 @@ add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
cpp_dir *p; cpp_dir *p;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM) #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Convert all backslashes to slashes. The native CRT stat() /* Remove unnecessary trailing slashes. On some versions of MS
function does not recognize a directory that ends in a backslash Windows, trailing _forward_ slashes cause no problems for stat().
(unless it is a drive root dir, such "c:\"). Forward slashes, On newer versions, stat() does not recognise a directory that ends
trailing or otherwise, cause no problems for stat(). */ in a '\\' or '/', unless it is a drive root dir, such as "c:/",
char* c; where it is obligatory. */
for (c = path; *c; c++) int pathlen = strlen (path);
if (*c == '\\') *c = '/'; char* end = path + pathlen - 1;
/* Preserve the lead '/' or lead "c:/". */
char* start = path + (pathlen > 2 && path[1] == ':' ? 3 : 1);
for (; end > start && IS_DIR_SEPARATOR (*end); end--)
*end = 0;
#endif #endif
p = XNEW (cpp_dir); p = XNEW (cpp_dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment