Message ID | 50117B5D.8030304@netcologne.de |
---|---|
State | New |
Headers | show |
On 07/26/2012 10:16 AM, Thomas Koenig wrote: > No test case because I couldn't figure out how to test for a > warning with no line number. Try using line number 0. Janis
Hi Janis, > On 07/26/2012 10:16 AM, Thomas Koenig wrote: > >> No test case because I couldn't figure out how to test for a >> warning with no line number. > > Try using line number 0. That didn't work for me. Using ! { dg-do compile } ! { dg-options "-I include_6.f90 -I missing_dir" } ! { dg-warning "not a directory" "missing directory" target *-*-* 0 } ! { dg-warning "does not exist" "nonexisting directory" target *-*-* 0 } end got me Warning: Include directory "include_6.f90" does not exist^M Warning: Include directory "missing_dir" does not exist^M output is: Warning: Include directory "include_6.f90" does not exist^M Warning: Include directory "missing_dir" does not exist^M FAIL: gfortran.dg/include_6.f90 -O (test for excess errors) Excess errors: :0:0: Warning: Include directory "include_6.f90" does not exist :0:0: Warning: Include directory "missing_dir" does not exist and ! { dg-do compile } ! { dg-options "-I include_6.f90 -I missing_dir" } ! { dg-warning "not a directory" "missing directory" target *-*-* 0 } ! { dg-warning "does not exist" "nonexisting directory" target *-*-* 0 } ! { dg-excess-errors "Include directory" } end resulted in an XFAIL: Warning: Include directory "include_6.f90" does not exist^M Warning: Include directory "missing_dir" does not exist^M output is: Warning: Include directory "include_6.f90" does not exist^M Warning: Include directory "missing_dir" does not exist^M XFAIL: gfortran.dg/include_6.f90 -O (test for excess errors) Excess errors: :0:0: Warning: Include directory "include_6.f90" does not exist :0:0: Warning: Include directory "missing_dir" does not exist so dg-excess-errors seems to imply XFAIL. The problem may be related to the fact that, when we process the options, we do not yet have a file name, so dejagnu may have trouble parsing the warning. Any other ideas? Thomas
On 07/27/2012 01:06 PM, Thomas Koenig wrote: > Hi Janis, > >> On 07/26/2012 10:16 AM, Thomas Koenig wrote: >> >>> No test case because I couldn't figure out how to test for a >>> warning with no line number. >> >> Try using line number 0. > > That didn't work for me. Using > > ! { dg-do compile } > ! { dg-options "-I include_6.f90 -I missing_dir" } > ! { dg-warning "not a directory" "missing directory" target *-*-* 0 } > ! { dg-warning "does not exist" "nonexisting directory" target *-*-* 0 } > end > > got me > > Warning: Include directory "include_6.f90" does not exist^M > Warning: Include directory "missing_dir" does not exist^M > output is: > Warning: Include directory "include_6.f90" does not exist^M > Warning: Include directory "missing_dir" does not exist^M > > FAIL: gfortran.dg/include_6.f90 -O (test for excess errors) > Excess errors: > :0:0: Warning: Include directory "include_6.f90" does not exist > :0:0: Warning: Include directory "missing_dir" does not exist Use "{ target *-*-* }" instead of "target *-*-*". Notice that the two warnings have the same text, so the directive looking for "not a directory" will fail. Janis
Index: scanner.c =================================================================== --- scanner.c (Revision 189754) +++ scanner.c (Arbeitskopie) @@ -311,12 +311,31 @@ add_path_to_list (gfc_directorylist **list, const { 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 ("Include directory \"%s\" does not exist", + 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);