This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Implement Fortran prefix/caret style using the common diagnostics machinery


Hi,

This patch is relative to this one here:
https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01652.html

It implements the Fortran style of prefix and caret line in the
gfc_diagnostic_starter by using the common pretty-printer.

This requires making configurable the caret character in the
diagnostics machinery.

The immediate effect is that now when using Fortran, the rest of the
compiler follows Fortran style:

[Before]

src/gcc/testsuite/gfortran.dg/pr25923.f90:22:0: Warning: 'res.yr' may
be used uninitialized in this function [-Wmaybe-uninitialized]
   end function baz ! { dg-warning "res.yr' may be" }
 ^
src/gcc/testsuite/gfortran.dg/pr25923.f90:13:0: note: 'res.yr' was declared here
   function baz(arg) result(res) ! { dg-bogus "res.yr' may be" }
 ^

[After]

src/gcc/testsuite/gfortran.dg/pr25923.f90:22:0:

   end function baz ! { dg-warning "res.yr' may be" }
 1
Warning: 'res.yr' may be used uninitialized in this function
[-Wmaybe-uninitialized]
src/gcc/testsuite/gfortran.dg/pr25923.f90:13:0:

   function baz(arg) result(res) ! { dg-bogus "res.yr' may be" }
 1
note: 'res.yr' was declared here

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

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

    PR fortran/44054
    * diagnostic.c: Set default caret.
    (diagnostic_show_locus): Use it. Tell pretty-printer that a new
    line is needed.
    * diagnostic.h (struct diagnostic_context):


gcc/fortran/ChangeLog:

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

    PR fortran/44054
    * error.c (gfc_diagnostic_build_locus_prefix): New function.
    (gfc_diagnostic_starter): Follow Fortran FE diagnostics.
    (gfc_diagnostic_finalizer): Do not call default finalizer.

Attachment: fortran-diagnostics-part3rel.diff
Description: Text document


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