This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] improve caret diagnostics for overload failures
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Sat, 21 Apr 2012 09:22:13 -0500
- Subject: Re: [RFC] improve caret diagnostics for overload failures
- References: <CAESRpQA-bCbqMFSLD9VQ7kDPZCMmWs6zHG=4_bFqyW8-aFDp5A@mail.gmail.com>
Do no use 'char' as the type of a flag. Prefer 'unsigned int'.
On Sat, Apr 21, 2012 at 8:57 AM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
> As noticed by Jason in PR 2485. The current output with caret
> diagnostics is a bit verbose in some cases:
>
> wa2.C: In function ‘int main()’:
> wa2.C:6:6: error: no matching function for call to ‘f(int)’
> ? f(1);
> ? ? ?^
> wa2.C:6:6: note: candidates are:
> ? f(1);
> ? ? ?^
> wa2.C:1:6: note: void f()
> ?void f();
> ? ? ?^
> wa2.C:1:6: note: ? candidate expects 0 arguments, 1 provided
> ?void f();
> ? ? ?^
> wa2.C:2:6: note: void f(int, int)
> ?void f(int,int);
> ? ? ?^
> wa2.C:2:6: note: ? candidate expects 2 arguments, 1 provided
> ?void f(int,int);
> ? ? ?^
>
> Following the discussion there, this patch changes the output to:
>
> caret-overload.C:102:6: error: no matching function for call to ‘f(int)’
> ? f(1);
> ? ? ?^
> ? ? ? ? ? ? ? ? ? ? ? ?note: candidates are:
> caret-overload.C:1:6: note: void f()
> ? ? ? ? ? ? ? ? ? ? ?note: ? candidate expects 0 arguments, 1 provided
> ?void f();
> ? ? ?^
> caret-overload.C:10:6: note: void f(int, int)
> ? ? ? ? ? ? ? ? ? ? ? note: ? candidate expects 2 arguments, 1 provided
> ?void f(int,int);
> ? ? ?^
>
> (Gmail messes up the alignment, see the output in the PR as it is
> actually meant to be)
>
> I have two questions. First, is the implementation approach ok?
>
> Second, changing the output like this, requires updating tons of
> testcases. I could update the testcases to match the notes without
> prefix by simply matching the 0 line. But perhaps it is better to add
> a new { dg-notes-2 "note1" "note2" } which passes a regexp such as
> "[^\n]*note1[^\n]*\n[^\n]*note2[^\n]*" to process-message. What do you think?
>
> Cheers,
>
> Manuel.