+2012-08-01 Thomas König <tkoenig@gcc.gnu.org>
+
+ PR fortran/54033
+ * scanner.c (add_path_to_list): Emit warning if an error occurs
+ for an include path, if it is not present or if it is not a
+ directory. Do not add the path in these cases.
+
2012-07-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/42418
{
gfc_directorylist *dir;
const char *p;
-
+ struct stat st;
+
p = path;
while (*p == ' ' || *p == '\t') /* someone might do "-I include" */
if (*p++ == '\0')
return;
+ if (stat (p, &st))
+ {
+ if (errno != ENOENT)
+ gfc_warning_now ("Include directory \"%s\": %s", path,
+ xstrerror(errno));
+ else
+ /* FIXME: Also support -Wmissing-include-dirs. */
+ gfc_warning_now ("Nonexistent include directory \"%s\"", path);
+ return;
+ }
+ else if (!S_ISDIR (st.st_mode))
+ {
+ gfc_warning_now ("\"%s\" is not a directory", path);
+ return;
+ }
+
if (head || *list == NULL)
{
dir = XCNEW (gfc_directorylist);
+2012-08-01 Thomas König <tkoenig@gcc.gnu.org>
+
+ PR fortran/54033
+ * gfortran.dg/include_6.f90: New test case.
+ * gfortran.dg/include_7.f90: New test case.
+ * gfortran.dg/include_3.f90: Add dg-warning for missing directory.
+
2012-08-01 Tom de Vries <tom@codesourcery.com>
* gcc.dg/tree-ssa/vrp76.c: New test.
! { dg-do compile }
! { dg-options "-fpreprocessed -g3" }
+! { dg-warning "Nonexistent include directory" "missing directory" { target *-*-* } 0 }
--- /dev/null
+! { dg-do compile }
+! { dg-options "-I gfortran.log" }
+! { dg-warning "is not a directory" "" { target *-*-* } 0 }
+end
+
--- /dev/null
+! { dg-do compile }
+! { dg-options "-I nothere" }
+! { dg-warning "Nonexistent include directory" "missing directory" { target *-*-* } 0 }
+end
+