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/doc | |
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/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4acb941..ba98eab 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6459,10 +6459,12 @@ int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; This warning is enabled by @option{-Wall}. -@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} +@item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)} @opindex Wmissing-include-dirs @opindex Wno-missing-include-dirs -Warn if a user-supplied include directory does not exist. +Warn if a user-supplied include directory does not exist. This opions is disabled +by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially +enabled by default by warning for -I and -J, only. @item -Wno-missing-profile @opindex Wmissing-profile |