Hi all, Gaby,

in this bug Manuel noticed that the zeros in the diagnostic lines of the form:

<built-in>:0:0: ....

don't provide useful information. Thus the below just avoids printing the zeros basing directly on the file name: admittedly, it may seem a bit gross, but in practice the strcmp would often fail early, and should be rather efficient anyway because the second argument is known at compile-time.

Tested x86_64-linux.

Thanks,
Paolo.

////////////////////////
2013-09-08  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/54941
        * diagnostic.c (diagnostic_build_prefix): When s.file is
        "<built-in>" don't output line and column numbers.

/testsuite
2013-09-08  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/54941
        * g++.dg/overload/new1.C: Adjust.
Index: diagnostic.c
===================================================================
--- diagnostic.c        (revision 202358)
+++ diagnostic.c        (working copy)
@@ -245,6 +245,9 @@ diagnostic_build_prefix (diagnostic_context *conte
     (s.file == NULL
      ? build_message_string ("%s%s:%s %s%s%s", locus_cs, progname, locus_ce,
                             text_cs, text, text_ce)
+     : !strcmp (s.file, N_("<built-in>"))
+     ? build_message_string ("%s%s:%s %s%s%s", locus_cs, s.file, locus_ce,
+                            text_cs, text, text_ce)
      : context->show_column
      ? build_message_string ("%s%s:%d:%d:%s %s%s%s", locus_cs, s.file, s.line,
                             s.column, locus_ce, text_cs, text, text_ce)
Index: testsuite/g++.dg/overload/new1.C
===================================================================
--- testsuite/g++.dg/overload/new1.C    (revision 202358)
+++ testsuite/g++.dg/overload/new1.C    (working copy)
@@ -17,6 +17,5 @@ void f(X *x = new (3) X(6));   // { dg-error "" }
 
 void f(X *x = new (2) X[10]);  // { dg-error "" } 
 // { dg-message "candidate" "candidate note" { target *-*-* } 18 }
-// { dg-message "operator new|candidate expects" "match candidate text" { 
target *-*-* } 00 }
 
 void f(X *x = new X[10][5]);   // { dg-error "" } 

Reply via email to