On 4 December 2014 at 00:25, Tobias Burnus <bur...@net-b.de> wrote:
> Manuel López-Ibáñez wrote:
>>
>> In any case, the current patch fixes these ICEs and I couldn't trigger
>> new ones. Bootstrapped and regression tested.
>> OK for Fortran?
>
>
> OK. Thanks.

It is still not clear to me if line_len is the length of the line read
or not, is it? If not, is there any way to actually get the length of
the line?

> Namely, the previous code trims the output to show only the code around the
> error location while the common-diagnostics code shows the whole line.

The code in the common diagnostics will trim the caret line on both
sides as needed depending on your COLUMNS, to show at least 10
characters after the '1'. In particular, MAX_WIDTH will be COLUMNS-1,
if COLUMN is the column pointed by the '1', then:

/* If LINE is longer than MAX_WIDTH, and COLUMN is not smaller than
   MAX_WIDTH by some margin, then adjust the start of the line such
   that the COLUMN is smaller than MAX_WIDTH minus the margin.  The
   margin is either 10 characters or the difference between the column
   and the length of the line, whatever is smaller.  The length of
   LINE is given by LINE_WIDTH.  */

But perhaps the defaults for Fortran are different if COLUMNS is not
set. The common diagnostics defaults to no limit in that case
(MAX_WIDTH == INT_MAX).

Moreover, the caret is always printed indented by one whitespace (so
one can easily grep -v out the caret info), thus it is very strange
that you get the output that you pasted.

By forcing the maximum MAX_WIDTH to 80 columns I get:

$ f951 -Wtabs test.f90 -fmessage-length=80
test.f90:1:1:

  print *, "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ", "jgk
 1
Warning: Nonconforming tab character at (1) [-Wtabs]

which is exactly what you pasted for (old) except for the indentation
of the caret line. (The indentation sounded like a good idea at the
beginning of using the caret, but now I'm not so sure if it is that
useful).

Cheers,

Manuel.

Reply via email to