Discussion:
[PATCH Fortran] move more diagnostics to the common machinery (try 2)
Manuel López-Ibáñez
2014-10-04 17:27:56 UTC
Permalink
The following patch adds two new functions. One of them is an overload
of gfc_warning_cmdline() that takes an option. Thus now we get:

f951: Warning: Nonexistent include directory
'C:\msys\1.0.10\home\FX\ibin\i586-pc-mingw32\libgfortran/../../../trunk/libgfortran/generated'
[-Wmissing-include-dirs]

plus colors!

and of course, with -Werror=missing-include-dirs you get:

f951: Error: Nonexistent include directory
'C:\msys\1.0.10\home\FX\ibin\i586-pc-mingw32\libgfortran/../../../trunk/libgfortran/generated'
[-Werror=missing-include-dirs]
f951: some warnings being treated as errors

plus colors!

The other new function is for errors instead of warnings. Perhaps
there are more places where these functions can be used.

Surprisingly, options that are not Common and not handled explicitly
in gfc_handle_option were rejected. This is fixed by this patch since
such options are handled automatically by the common options
machinery.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/fortran/ChangeLog:

2014-10-04 Manuel López-Ibáñez <***@gcc.gnu.org>

* gfortran.h (gfc_warning_cmdline): Add overload that takes an
option.
(gfc_error_cmdline): Declare.
* error.c (gfc_warning_cmdline): New overload that takes an option.
(gfc_error_cmdline): New.
* lang.opt (Wmissing-include-dirs): New.
* scanner.c (add_path_to_list): Use the new functions.
(load_file): Likewise.
* options.c (gfc_init_options): Wmissing-include-dirs is enabled
by default in Fortran.
(gfc_handle_option): Accept automatically handled options.
Tobias Burnus
2014-10-07 11:36:23 UTC
Permalink
f951: Error: Nonexistent include directory [...]
[-Werror=missing-include-dirs]
f951: some warnings being treated as errors
plus colors!
Awesome!
Bootstrapped and regression tested on x86_64-linux-gnu.
OK?
OK. Thanks for the patch!

Tobias
* gfortran.h (gfc_warning_cmdline): Add overload that takes an
option.
(gfc_error_cmdline): Declare.
* error.c (gfc_warning_cmdline): New overload that takes an option.
(gfc_error_cmdline): New.
* lang.opt (Wmissing-include-dirs): New.
* scanner.c (add_path_to_list): Use the new functions.
(load_file): Likewise.
* options.c (gfc_init_options): Wmissing-include-dirs is enabled
by default in Fortran.
(gfc_handle_option): Accept automatically handled options.
Loading...