This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH diagnostics/fortran] Move gfc_warning (buffered) to the common diagnostics machinery


This is the final patch. Bootstrapped and regression tested.

The diagnostics part is the same as in
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg03416.html, except for
fixing the minor nit in a comment pointed out by Dodji.

I decided that the best testing would be to convert all calls (except
for a few that use multiple locations) and see what it breaks.
Surprisingly nothing broke, which suggests that either is working as
expected or the Fortran testsuite needs many more testcases ;-)

Since I needed to check every gfc_warning call for the use of multiple
locations, I took the opportunity to replace replace '%s' with %qs and
add the appropriate OPT_W* option (I may have missed some, they can be
added later as a follow-up).

OK?



gcc/testsuite/ChangeLog:

2014-12-03  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * gfortran.dg/warnings_are_errors_1.f90: Update warnings to errors.
    * gfortran.dg/warnings_are_errors_1.f: Likewise.

gcc/fortran/ChangeLog:

2014-12-03  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * gfortran.h (gfc_warning): Now returns bool. Add overload that
    accepts opt.
    (gfc_warning_1): Declare.
    * error.c
    (pp_warning_buffer,warningcount_buffered,werrorcount_buffered):    New.
    (gfc_buffer_error): Set pp_warning_buffer.flush_p.
    (gfc_clear_pp_buffer): New.
    (gfc_warning_1): Renamed from gfc_warning.
    (gfc_warning): Add three new overloads. One that takes just a
    format string and ellipsis, another that takes also a warning
    option, and another that takes also va_list instead of ellipsis.
    (gfc_clear_warning): Clear pp_warning_buffer.
    (gfc_warning_check): Flush pp_warning_buffer and update warning
    and werror counters.
    (gfc_diagnostics_init): Init pp_warning_buffer.

    * Update all gfc_warning calls that do not have multiple
    locations to use %qs and OPT_W*, otherwise use gfc_warning_1.

gcc/ChangeLog:

2014-12-03  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * pretty-print.c (output_buffer::output_buffer): Init flush_p to true.
    (pp_flush): Flush only if flush_p.
    (pp_really_flush): New.
    * pretty-print.h (struct output_buffer): Add flush_p.
    (pp_really_flush): Declare.

Attachment: fortran-diagnostics-warning-buffer.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]