Message ID | 50FC4A52.8010201@netcologne.de |
---|---|
State | New |
Headers | show |
On Sun, Jan 20, 2013 at 08:49:38PM +0100, Thomas Koenig wrote: > Hello world, > > the attached patch fixes a regression where -J dirpath/ would > issue a warning on Windows because of the trailing dir separator. > > Regression-tested, but only on Linux. I would appreciate if > somebody could also test it on Windows (and run the test case, > of course). > > OK for trunk? > The patch looks OK to me. As this is a Windows, hopefully someone will confirm that the patch fixes the Windows issue before you commit.
Hi Steve, > The patch looks OK to me. As this is a Windows, > hopefully someone will confirm that the patch > fixes the Windows issue before you commit. Thanks! Committed as rev. 195348 after Brad's confirmation that the patch works on Windows. One more regression down, 24 to go. Thomas
Index: scanner.c =================================================================== --- scanner.c (Revision 195319) +++ scanner.c (Arbeitskopie) @@ -310,14 +310,26 @@ add_path_to_list (gfc_directorylist **list, const { gfc_directorylist *dir; const char *p; + char *q; struct stat st; + size_t len; + int i; p = path; while (*p == ' ' || *p == '\t') /* someone might do "-I include" */ if (*p++ == '\0') return; - if (stat (p, &st)) + /* Strip trailing directory separators from the path, as this + will confuse Windows systems. */ + len = strlen (p); + q = (char *) alloca (len + 1); + memcpy (q, p, len + 1); + i = len - 1; + while (i >=0 && IS_DIR_SEPARATOR(q[i])) + q[i--] = '\0'; + + if (stat (q, &st)) { if (errno != ENOENT) gfc_warning_now ("Include directory \"%s\": %s", path,