[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: diagnostics: display suggested update after the caret-info
From: |
Akim Demaille |
Subject: |
Re: RFC: diagnostics: display suggested update after the caret-info |
Date: |
Mon, 18 Feb 2019 08:27:09 +0100 |
Hi Paul,
> Le 17 févr. 2019 à 21:16, Paul Eggert <address@hidden> a écrit :
>
> Akim Demaille wrote:
>> This commit changes the warning from:
>>> foo.yy:1.5-18: warning: deprecated directive, use '%define parse.error
>>> verbose' [-Wdeprecated]
>>> %error-verbose
>>> ^~~~~~~~~~~~~~
>> to:
>>> foo.yy:1.5-18: warning: deprecated directive [-Wdeprecated]
>>> %error-verbose
>>> ^~~~~~~~~~~~~~
>>> %define parse.error verbose
>
>> For the records, when caret-errors are disabled, we have (independently of
>> this proposed change):
>>> foo.yy:1.1-14: warning: deprecated directive: '%error-verbose', use
>>> '%define parse.error verbose' [-Wdeprecated]
>
>
> I find the new diagnostic confusing, as it's not clear to the non-expert what
> the "%define parse.error verbose" means. The old diagnostic (or the one with
> caret-errors disabled) is clearer.
Yes, I agree, it was better before. I tried to have something that
takes less width, but it's also less clear. For substitutions in the
source, gcc and clang do this:
$ cat /tmp/foo.cc
int my_function() { return 42;}
int main ()
{
return myfunction();
}
$ clang++-mp-7.0 -Wall /tmp/foo.cc
/tmp/foo.cc:4:10: error: use of undeclared identifier 'myfunction'; did you
mean 'my_function'?
return myfunction();
^~~~~~~~~~
my_function
/tmp/foo.cc:1:5: note: 'my_function' declared here
int my_function() { return 42;}
^
1 error generated.
$ g++-mp-8 -Wall /tmp/foo.cc
/tmp/foo.cc: In function 'int main()':
/tmp/foo.cc:4:10: error: 'myfunction' was not declared in this scope
return myfunction();
^~~~~~~~~~
/tmp/foo.cc:4:10: note: suggested alternative: 'my_function'
return myfunction();
^~~~~~~~~~
my_function