diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-08-01 21:43:50 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-08-01 21:43:50 +0000 |
commit | ff9e56a94f37789b5c6a95807f6b386ee06f4c63 (patch) | |
tree | a5368a8af9bbaa6f65552a5f9215bfcbed995783 /gcc/fortran/scanner.c | |
parent | fdd195f49b06618c0ec8a30cbc6c5495038e34b5 (diff) | |
download | gcc-ff9e56a94f37789b5c6a95807f6b386ee06f4c63.zip gcc-ff9e56a94f37789b5c6a95807f6b386ee06f4c63.tar.gz gcc-ff9e56a94f37789b5c6a95807f6b386ee06f4c63.tar.bz2 |
re PR fortran/54033 (gfortran: Passing file as include directory - add diagnostic and ICE with -cpp)
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-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.
From-SVN: r190054
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r-- | gcc/fortran/scanner.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 4fad58b..d4a27a8 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -311,12 +311,29 @@ add_path_to_list (gfc_directorylist **list, const char *path, { 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); |