This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Fix problem with trailing slashes in include paths on mingw
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Joern RENNECKE <joern dot rennecke at st dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 May 2005 23:58:56 -0700
- Subject: Re: RFA: Fix problem with trailing slashes in include paths on mingw
- References: <4284D81E.2070608@st.com>
Joern RENNECKE <joern.rennecke@st.com> writes:
> The appended patch was needed to get a 3.4.3 based mingw compiler to
> properly handle options like -I some/include/path/ . Without it,
> the stat call to test for the existence of the directory would fail,
> thus resulting in the include path being left out.
I want to be sure I understand the problem cases:
C:\ -- ok
C:/ -- ok?
C:\\ -- ?
C:// -- ?
C:\foo\bar -- ok
C:/foo/bar -- ok (or you have bigger problems)
C:\foo\bar\ -- ?
C:/foo/bar/ -- not ok
C:\foo\\bar -- ?
C:/foo//bar -- ?
C:\foo\bar\\ -- ?
C:/foo/bar// -- presumably not ok
Please check which, if any, of the ? cases are affected. (The comment
immediately above the code you added purports to explain, but since we
have already determined that the code is buggy, I don't trust what the
comment says.)
Please also check all the above cases with a leading slash (or
backslash) but no drive letter; with a drive letter but no leading
slash (or backslash); and with neither a drive letter nor a leading
slash (or backslash); omitting, of course, those paths that when
transformed are vacuous or identical to already-tested cases.
> +/* While the native stat() on NT4 accepts slashes, the one on
> + MS Windows 2000 / XP does not. So remove any trailing slashes
> + except for the first one after a colon. */
Once you've checked, please modify this comment to be clearer about
what works and what doesn't.
> +#if 1
Remove, unnecessary (we're already inside #ifdef HAVE_DOS_BASED_FILE_SYSTEM
here).
> + while (c != path && *--c == '/');
> + if (c != path && c[-1] == ':' && *c)
> + c++;
> + *c = '\0';
And I'll have something to say about making this less confusing, and
consolidating it with the code immediately above, once you check into
the above queries.
zw