public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions
@ 2004-06-21 18:14 trt at acm dot org
2004-06-25 21:01 ` [Bug c/16119] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: trt at acm dot org @ 2004-06-21 18:14 UTC (permalink / raw)
To: gcc-bugs
I want to add (or enhance) warnings to gcc, such as:
warning ("operation on %qE may be undefined", written);
but the pretty-printer %E aborts on anything more complicated
than an identifier node.
I would like %E to handle general expressions.
Here is how I fixed it in gcc-3.5-20040620:
chaos$ diff -c1 c-objc-common.c.orig c-objc-common.c
*** c-objc-common.c.orig Sun Jun 20 04:34:43 2004
--- c-objc-common.c Mon Jun 21 13:05:45 2004
***************
*** 274,280 ****
case 'E':
! if (TREE_CODE (t) == IDENTIFIER_NODE)
! n = IDENTIFIER_POINTER (t);
! else
! return false;
! break;
--- 274,278 ----
case 'E':
! dump_generic_node (pp, t, 0, 0, false);
! return true;
!
==================
Unfortunately that exposed glitches in the handling of `line_length'
in pretty-print.c line_length is zero initially, incremented as characters
are accumulated, and reset to zero by pp_newline.
But pp_write_text_to_stream/pp_base_clear_output_area also resets it to zero,
which I think is a bug. So I removed the reset in pp_base_clear_output_area,
and changed pp_base_flush to call pp_newline rather than fputc.
Here is the diff for that:
chaos$ diff -c1 pretty*.orig pretty*.c
*** pretty-print.c.orig Sat May 29 16:10:10 2004
--- pretty-print.c Mon Jun 21 13:06:14 2004
***************
*** 367,371 ****
{
pp_write_text_to_stream (pp);
pp_clear_state (pp);
- fputc ('\n', pp->buffer->stream);
fflush (pp->buffer->stream);
--- 367,371 ----
{
+ pp_newline (pp);
pp_write_text_to_stream (pp);
pp_clear_state (pp);
fflush (pp->buffer->stream);
***************
*** 389,391 ****
obstack_free (&pp->buffer->obstack, obstack_base (&pp->buffer->obstack));
- pp->buffer->line_length = 0;
}
--- 389,390 ----
==================
Regardless of how this is fixed, I think it should be.
Thanks much for considering this,
Tom Truscott
trt@sas.com
--
Summary: In C language diagnostic messages, %E should but cannot
display general expressions
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trt at acm dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
@ 2004-06-25 21:01 ` pinskia at gcc dot gnu dot org
2004-06-25 21:01 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-25 21:01 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |16202
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
2004-06-25 21:01 ` [Bug c/16119] " pinskia at gcc dot gnu dot org
@ 2004-06-25 21:01 ` pinskia at gcc dot gnu dot org
2004-06-26 0:09 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-25 21:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-25 21:01 -------
Patches goto gcc-patches@.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
2004-06-25 21:01 ` [Bug c/16119] " pinskia at gcc dot gnu dot org
2004-06-25 21:01 ` pinskia at gcc dot gnu dot org
@ 2004-06-26 0:09 ` pinskia at gcc dot gnu dot org
2004-09-24 12:49 ` jsm28 at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-26 0:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-26 00:09 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-06-26 00:09:13
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (2 preceding siblings ...)
2004-06-26 0:09 ` pinskia at gcc dot gnu dot org
@ 2004-09-24 12:49 ` jsm28 at gcc dot gnu dot org
2004-09-24 17:07 ` trt at acm dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2004-09-24 12:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2004-09-24 12:49 -------
%E has now been changed to handle expressions.
There is a problem with the formatting from %E, see
<http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02087.html>; the PR about
this may not yet have been opened.
I do not know whether the problem for which this PR includes a patch
still applies, and if so whether the patch is correct.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org,
| |jsm28 at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (3 preceding siblings ...)
2004-09-24 12:49 ` jsm28 at gcc dot gnu dot org
@ 2004-09-24 17:07 ` trt at acm dot org
2004-10-03 2:56 ` gdr at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: trt at acm dot org @ 2004-09-24 17:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From trt at acm dot org 2004-09-24 17:07 -------
Close but not quite right, a bogus ({anonymous}) appears.
In c-objc-common.c the suspect code is:
case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE)
n = IDENTIFIER_POINTER (t);
else
pp_expression (cpp, t);
break;
I think that should instead be
case 'E':
pp_expression (cpp, t);
return true;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (4 preceding siblings ...)
2004-09-24 17:07 ` trt at acm dot org
@ 2004-10-03 2:56 ` gdr at gcc dot gnu dot org
2004-10-03 2:57 ` gdr at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-10-03 2:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-10-03 02:56 -------
(In reply to comment #0)
>
> --- 274,278 ----
> case 'E':
> ! dump_generic_node (pp, t, 0, 0, false);
I consider it a bug to attempt to use dump_generic_node() in diagnotics
(and in general). Please consider pp_expression() or pp_declaration(),
whichever suits best.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (5 preceding siblings ...)
2004-10-03 2:56 ` gdr at gcc dot gnu dot org
@ 2004-10-03 2:57 ` gdr at gcc dot gnu dot org
2004-10-03 2:59 ` gdr at gcc dot gnu dot org
2004-10-03 3:01 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-10-03 2:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-10-03 02:57 -------
(In reply to comment #4)
> Close but not quite right, a bogus ({anonymous}) appears.
JSM just fixed that part.
I'm closing this PR as fixed.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (6 preceding siblings ...)
2004-10-03 2:57 ` gdr at gcc dot gnu dot org
@ 2004-10-03 2:59 ` gdr at gcc dot gnu dot org
2004-10-03 3:01 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-10-03 2:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-10-03 02:59 -------
.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/16119] In C language diagnostic messages, %E should but cannot display general expressions
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
` (7 preceding siblings ...)
2004-10-03 2:59 ` gdr at gcc dot gnu dot org
@ 2004-10-03 3:01 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 3:01 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16119
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-10-03 3:01 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-21 18:14 [Bug c/16119] New: In C language diagnostic messages, %E should but cannot display general expressions trt at acm dot org
2004-06-25 21:01 ` [Bug c/16119] " pinskia at gcc dot gnu dot org
2004-06-25 21:01 ` pinskia at gcc dot gnu dot org
2004-06-26 0:09 ` pinskia at gcc dot gnu dot org
2004-09-24 12:49 ` jsm28 at gcc dot gnu dot org
2004-09-24 17:07 ` trt at acm dot org
2004-10-03 2:56 ` gdr at gcc dot gnu dot org
2004-10-03 2:57 ` gdr at gcc dot gnu dot org
2004-10-03 2:59 ` gdr at gcc dot gnu dot org
2004-10-03 3:01 ` pinskia at gcc dot gnu dot org
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).