diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-09-22 20:58:35 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-09-22 20:58:35 +0200 |
commit | 83aac698835edcdb3e6d96b856bef1c5f92e5e24 (patch) | |
tree | 0bb8c1f54a51c10b9d945bea4d7ca160711dcc5e /gcc/fortran/gfortran.h | |
parent | 8f571e64713cc72561f84241863496e473eae4c6 (diff) | |
download | gcc-83aac698835edcdb3e6d96b856bef1c5f92e5e24.zip gcc-83aac698835edcdb3e6d96b856bef1c5f92e5e24.tar.gz gcc-83aac698835edcdb3e6d96b856bef1c5f92e5e24.tar.bz2 |
Fortran: Improve -Wmissing-include-dirs warnings [PR55534]
It turned out that enabling the -Wmissing-include-dirs for libcpp did output
too many warnings – at least as run with -B and similar options during the
GCC build and warning for internal include dirs like finclude, unlikely of
relevance to for a real-world user.
This patch now only warns for -I and -J by default but permits to get the
full warnings including libcpp ones with -Wmissing-include-dirs. It
additionally documents this in the manual.
With that change, the -Wno-missing-include-dirs could be removed
from libgfortran's configure and libgomp's testsuite always cflags.
This reverts those bits of the previous
commit r12-3722-g417ea5c02cef7f000e66d1af22b066c2c1cda047
Additionally, it turned out that all call to load_file called exit
explicitly - except for the main file via gfc_init -> gfc_new_file. The
latter also output a file not existing fatal error, such that two errors
where printed. Now exit is called in line with the other users of
load_file.
Finally, when compileing with "nonexisting/file.f90", first a warning that
"nonexisting" does not exist as include path was printed before the file
not found error was printed. Now the directory in which the physical file
is located is added silently, relying on the file-not-found diagnostic for
those.
PR fortran/55534
gcc/ChangeLog:
* doc/invoke.texi (-Wno-missing-include-dirs.): Document Fortran
behavior.
gcc/fortran/ChangeLog:
* cpp.c (gfc_cpp_register_include_paths, gfc_cpp_post_options):
Add new bool verbose_missing_dir_warn argument.
* cpp.h (gfc_cpp_post_options): Update prototype.
* f95-lang.c (gfc_init): Remove duplicated file-not found diag.
* gfortran.h (gfc_check_include_dirs): Takes bool
verbose_missing_dir_warn arg.
(gfc_new_file): Returns now void.
* options.c (gfc_post_options): Update to warn for -I and -J,
only, by default but for all when user requested.
* scanner.c (gfc_do_check_include_dir):
(gfc_do_check_include_dirs, gfc_check_include_dirs): Take bool
verbose warn arg and update to avoid printing the same message
twice or never.
(load_file): Fix indent.
(gfc_new_file): Return void and exit when load_file failed
as all other load_file users do.
libgfortran/ChangeLog:
* configure.ac (AM_FCFLAGS): Revert r12-3722 by removing
-Wno-missing-include-dirs.
* configure: Regenerate.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/fortran.exp (ALWAYS_CFLAGS): Revert
r12-3722 by removing -Wno-missing-include-dirs.
* testsuite/libgomp.oacc-fortran/fortran.exp (ALWAYS_CFLAGS): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/include_14.f90: Add -J testcase and update dg-output.
* gfortran.dg/include_15.f90: Likewise.
* gfortran.dg/include_16.f90: Likewise.
* gfortran.dg/include_17.f90: Likewise.
* gfortran.dg/include_18.f90: Likewise.
* gfortran.dg/include_19.f90: Likewise.
Diffstat (limited to 'gcc/fortran/gfortran.h')
-rw-r--r-- | gcc/fortran/gfortran.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 3c7a843..7ef835b 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -3032,7 +3032,7 @@ void gfc_scanner_init_1 (void); void gfc_add_include_path (const char *, bool, bool, bool, bool); void gfc_add_intrinsic_modules_path (const char *); void gfc_release_include_path (void); -void gfc_check_include_dirs (void); +void gfc_check_include_dirs (bool); FILE *gfc_open_included_file (const char *, bool, bool); int gfc_at_end (void); @@ -3064,7 +3064,7 @@ gfc_char_t gfc_peek_char (void); char gfc_peek_ascii_char (void); void gfc_error_recovery (void); void gfc_gobble_whitespace (void); -bool gfc_new_file (void); +void gfc_new_file (void); const char * gfc_read_orig_filename (const char *, const char **); extern gfc_source_form gfc_current_form; |