[committed] diagnostics: add line numbers to source (PR other/84889)
Manuel López-Ibáñez
lopezibanez@gmail.com
Fri Aug 17 17:49:00 GMT 2018
On 17/08/18 17:50, Andreas Schwab wrote:
> On Aug 17 2018, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
>
>> However, I see that GCC trunk still counts tabs as 1-column, probably
>> because emacs counts tabs as one column when interpreting column numbers
>> in the output of GCC.
>
> That is not true. Emacs is using screen columns by default for almost
> 20 years now (see compilation-error-screen-columns).
Maybe I didn't properly explain what I mean. I mean that Emacs counts a tab as
a "GCC" column, whatever number of visual columns the tab is configured to be
in Emacs. The following code (with a tab before 'a'):
/* ñ /* */
/* a /* */
a
With gcc -c test.c -Wcomment, it gives:
test.c:1:10: warning: "/*" within comment [-Wcomment]
/* ñ /* */
^
test.c:2:9: warning: "/*" within comment [-Wcomment]
/* a /* */
^
test.c:3:2: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â at end of input
a
^
When the above appears in a compilation-mode buffer, I can click (or press
enter) on each diagnostic and Emacs will jump exactly to what is pointed by the
"^". That is, for Emacs, 3:2 does not mean line 3, *visual* column 2. In my
Emacs, it jumps to column 8 (where the "a" is).
Changing the output to be 3:9 (if GCC starts interpreting tabs as 8 spaces as
recommended by the GCS or to the value given by -ftabstop) will make Emacs jump
to the wrong place.
This is independent of multi-byte characters. GCC is pointing to the wrong
place when the line contains "ñ".
I hope the above is clearer,
Manuel.
More information about the Gcc-patches
mailing list