This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH diagnostics/Fortran] Implement Fortran prefix/caret style using the common diagnostics machinery
- From: Tobias Burnus <burnus at net-b dot de>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Dodji Seketeli <dodji at redhat dot com>, "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>
- Date: Tue, 19 Aug 2014 21:21:28 +0200
- Subject: Re: [PATCH diagnostics/Fortran] Implement Fortran prefix/caret style using the common diagnostics machinery
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQDk1v4BwQX5jzxFGQEADFb2rsEMsZxr_yc6UU0KDeFqGA at mail dot gmail dot com>
Hi,
Manuel López-Ibáñez wrote:
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.
Looks good to me. Thanks for the patch!
- snprintf (buffer, len, "%s %*c%s", caret_cs, s.column, '^', caret_ce);
+ snprintf (buffer, len, "%s %*c%s", caret_cs, s.column, context->caret_char, caret_ce);
That line is too long, please break it.
[Side remark: By itself, using "^" would be fine also for gfortran;
however, it uses a digit like "1" because it also has a few error
messages of the kind "Duplicate statement label %d at %L and %L", which
uses two locations with the labels "1" and "2", which can be in the same
line or in different lines.]
Tobias
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.