This is the mail archive of the gcc-patches@gcc.gnu.org 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 <joern.rennecke@st.com> writes:

> Sorry, I missed that when I typed in the tests.
> / and \ are OK, but // and \\ don't work.  Otherwise the
> leading-(back)slash scenario
> is the same as with leading-drive-and-backslash.  Likewise with leading
> drive letter but no leading slash.  FWIW, I'm running these tests on
> MS Windows XP.

Thanks.

>>>/* While the native stat() on NT4 accepts trailing slashes, the
>>>   one on MS Windows 2000 / XP does not accept any trailing slashes
>>>   or backslashes, neither single nor double, except where they appear
>>>   as a drive root directory designator. So remove any trailing slashes
>>>   except for the first one after a colon.  */
>>
>>Better, but still not ideal, especially with your observation below
>>that this is cygwin-specific.  (Just the trailing slashes, or slashes
>>and backslashes both?)  On the theory that the whole problem is Cygwin
>>specific, I would say something like
>
> NT4 accepts trailing slashes, but no trailing backslashes.

Okay, so how's this for the comment?

 /* The native stat() on NT4 accepts trailing slashes, but not
    backslashes.  Cygwin's stat on Windows 2000/XP doesn't accept
    either trailing slashes or backslashes.  (C:/ and C:\ are of
    course fine, but C:\\ and C:// are not.)  It is harmless to
    remove trailing slashes on systems that do accept them, so we
    do it unconditionally.  */

And this for the code (after the existing slash canonicalizer):

  while (*c == '/' && c > path)
    c--;
  if (c == path+1 && ISALPHA (path[0]) && path[1] == ':')
    c++;
  if (c[1] == '/')
    c[1] = '\0';

?

zw


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