[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] Fix caret errors

From: Akim Demaille
Subject: Re: [PATCH 0/4] Fix caret errors
Date: Sun, 21 Apr 2019 20:05:03 +0200

Hi Paul,

Thanks for your answer.

> Le 21 avr. 2019 à 19:22, Paul Eggert <address@hidden> a écrit :
> Akim Demaille wrote:
>> 2.  How should we quote source?
>>     a. Do like Clang
>>     b. Do like GCC
>>     c. Do like Bison, i.e., consider this is an unimportant issue,
>>        people should not use tabs anyway :)
> There's another option:
>   d. Do like GCC, except indent with a tab instead of a space.
> (d) is used by 'diff -T'.

But that's a lot of horizontal space wasted :(

> If I understand things correctly, (c) is of course the easiest but messes up 
> alignment, which is annoying. (a) is nearly as easy and fixes the alignment 
> but looks a bit worse and perhaps might introduce an ambiguity in the 
> diagnostic output.

Fully agreed.

> (d) is also nearly as easy and fixes the appearance and ambiguity issues. (b) 
> chews up fewer columns of output than (d), but is by far the most work to 
> implement and requires Bison knowing the user's tab settings, which is 
> fragile.
> I suggest (d) as it fixes the alignment messup and is easy to do and this 
> issue is not worth the hassle of (b). But that's just my opinion.

I just discovered that GCC9 has yet another approach (I just saw your
message when I came to answer my own message about this).  This blog
describes many details about it:

Unfortunately it fails to compile on my machine, but as far as I can
tell, with the new output, the quoted source also starts at column 8,
but all the space is not "wasted", it is used to add information such
as line number and insertion tags:

$ gcc-9 -xc++ -c incomplete.c
incomplete.c:1:6: error: ‘string’ in namespace ‘std’ does not name a type
    1 | std::string test(void)
      |      ^~~~~~
incomplete.c:1:1: note: ‘std::string’ is defined in header ‘<string>’; did you 
forget to ‘#include <string>’?
  +++ |+#include <string>
    1 | std::string test(void)

I like this very much.  It's like an improved version of (d).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]