[Patch, Fortran] Show better error location

Tobias Burnus burnus@net-b.de
Sat Jun 1 12:51:00 GMT 2013


I am still not happy with changing the length of the displayed 
source-code in error messages to infinity if not terminal is available. 
One reason is that for long lines (e.g. generated code or long trailing 
comment lines) - the output is not very readable. And that the terminal 
is not available happens quite often, e.g. if one uses pipes to "less" 
or "tee" - or redirects to a file. Admittedly, in Fortran code, the line 
length is typically not extremely long; thus, the trimming usually does 
not cause - nor does increasing the limit.

  * * *

I think that one reason for the wish to extend the displayed lines lies 
elsewhere: gfortran sometimes does a bad job with the column location in 
error messages. That's especially visible in the test suite which uses 
long dg-error/dg-warning comments after the actual code.

Thus, I think we should fix the bad column location. (That's beneficial, 
independent whether one increased the trim length or not.) This patch 
fixes a bunch of those isses, but one can surely do more.

Comments?

One example is:

   END BLOCK ! { dg-error "Expected block name of 'myname2'" }
                                                              1
Error: Expected block name of 'myname2' in END BLOCK statement at (1)


for which one gets with the patch:

   END ASSOCIATE ! { dg-error "Expected block name of 'myname'" }
                1
Error: Expected block name of 'myname' in END ASSOCIATE statement at (1)


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

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locus.diff
Type: text/x-patch
Size: 6609 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130601/5b100b57/attachment.bin>


More information about the Fortran mailing list