aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r--gcc/fortran/scanner.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 008e91f..0467f8a 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -310,14 +310,26 @@ add_path_to_list (gfc_directorylist **list, const char *path,
{
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,