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.

Attachment: caret-overload.diff
Description: Binary data

Reply via email to