This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix problem with trailing slashes in include paths on mingw

Joern RENNECKE <> 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 

> +  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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]