[Patch, Fortran] Convert gfc_fatal_error to common diagnostics

Tobias Burnus burnus@net-b.de
Sat Nov 15 10:06:00 GMT 2014


Especially since color diagnostic is now the default [1], it makes sense 
to convert more gfortran diagnostics to use the common diagnostics.

For an example, see [1]. That also brings all the nice features like 
placing the warning option in brackets:
   Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
Adding -Werror changes it to:
   Error: USE statement at (1) has no ONLY qualifier 
[-Werror=use-without-only]
-fno-diagnostics-show-caret compactifies the error into a single line 
without showing the source code – and other nice features.
[Thanks Manuel!]


This patch converts all gfc_fatal_error to the new scheme, except for 
those few using %L. As most calls could be converted, I renamed the old 
one to _1 instead of using the _2 name for the new one.

Additionally, I changed quoted strings from '%s' to %qs and added quotes 
around -farguments via %< … %>. That also has a colouring effect 
(default: black and bold).

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

PS: Manuel is working on %L support and buffered output (gfc_error, 
gfc_warning); thus, expect more colors in the next weeks. While I intent 
to convert gfc_intrinsic_error and the remaining gfc_{error,warning}_now 
(all which do not use %L).

PPS: Turning on colors comes too late for the command-line diagnostic - 
they always come up in blank and white.

[1] See https://gcc.gnu.org/gcc-5/changes.html under "Fortran" and under 
"C family".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fatal-error.diff
Type: text/x-patch
Size: 24151 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141115/44d142df/attachment.bin>


More information about the Gcc-patches mailing list