* [diagnostic patch] PR 54941
@ 2013-09-08 13:41 Paolo Carlini
2013-09-08 14:07 ` Gabriel Dos Reis
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2013-09-08 13:41 UTC (permalink / raw)
To: gcc-patches; +Cc: Gabriel Dos Reis
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
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.
////////////////////////
[-- Attachment #2: CL_54941 --]
[-- Type: text/plain, Size: 295 bytes --]
2013-09-08 Paolo Carlini <paolo.carlini@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.carlini@oracle.com>
PR c++/54941
* g++.dg/overload/new1.C: Adjust.
[-- Attachment #3: patch_54941 --]
[-- Type: text/plain, Size: 1226 bytes --]
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 "" }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [diagnostic patch] PR 54941
2013-09-08 13:41 [diagnostic patch] PR 54941 Paolo Carlini
@ 2013-09-08 14:07 ` Gabriel Dos Reis
2013-09-08 14:23 ` Paolo Carlini
0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Dos Reis @ 2013-09-08 14:07 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
On Sun, Sep 8, 2013 at 8:00 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> 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.
For builtins, we probably do not want to print the line number
and the column number (both of which are zero).
>
> Tested x86_64-linux.
>
> Thanks,
> Paolo.
>
> ////////////////////////
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [diagnostic patch] PR 54941
2013-09-08 14:07 ` Gabriel Dos Reis
@ 2013-09-08 14:23 ` Paolo Carlini
2013-09-08 14:44 ` Gabriel Dos Reis
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2013-09-08 14:23 UTC (permalink / raw)
To: Gabriel Dos Reis; +Cc: gcc-patches
Hi Gaby,
On 09/08/2013 03:41 PM, Gabriel Dos Reis wrote:
> On Sun, Sep 8, 2013 at 8:00 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>> 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.
> For builtins, we probably do not want to print the line number
> and the column number (both of which are zero).
I agree. This is exactly what my patch does, isn't it?
Thanks,
Paolo.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [diagnostic patch] PR 54941
2013-09-08 14:23 ` Paolo Carlini
@ 2013-09-08 14:44 ` Gabriel Dos Reis
0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2013-09-08 14:44 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
On Sun, Sep 8, 2013 at 8:59 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi Gaby,
>
>
> On 09/08/2013 03:41 PM, Gabriel Dos Reis wrote:
>>
>> On Sun, Sep 8, 2013 at 8:00 AM, Paolo Carlini <paolo.carlini@oracle.com>
>> wrote:
>>>
>>> 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.
>>
>> For builtins, we probably do not want to print the line number
>> and the column number (both of which are zero).
>
> I agree. This is exactly what my patch does, isn't it?
What I meant is that we should not showing a location at all.
I misread the original hunk
+ : !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)
Sorry. Patch OK.
>
> Thanks,
> Paolo.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-08 14:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-08 13:41 [diagnostic patch] PR 54941 Paolo Carlini
2013-09-08 14:07 ` Gabriel Dos Reis
2013-09-08 14:23 ` Paolo Carlini
2013-09-08 14:44 ` Gabriel Dos Reis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).