[PATCH diagnostics/Fortran] Implement Fortran prefix/caret style using the common diagnostics machinery

Tobias Burnus burnus@net-b.de
Tue Aug 19 19:21:00 GMT 2014


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.



More information about the Fortran mailing list