On Wed, Jun 6, 2012 at 9:15 AM, Steven Bosscher <stevenb....@gmail.com> wrote:
> On Tue, Jun 5, 2012 at 10:59 AM, Richard Guenther
> <richard.guent...@gmail.com> wrote:
>> On Mon, Jun 4, 2012 at 8:23 PM, Steven Bosscher <stevenb....@gmail.com> 
>> wrote:
>>> Hello,
>>>
>>> The attached patch removes one more #include output.h, this time from
>>> c-family/c-pch.c.
>>>
>>> Anything written out to asm_out_file between pch_init and
>>> c_common_write_pch is read back in by c_common_write_pch and dumped to
>>> the PCH that's being written out. In c_common_read_pch this data is
>>> written out verbatim to asm_out_file again.
>>>
>>> But nothing should write to asm_out_file between pch_init and
>>> c_common_write_pch. I suppose this happened before unit-at-a-time
>>> became the only supported compilation mode, but these days there's
>>> nothing, AFAICT, that should be written to asm_out_file by a front end
>>> during PCH generation.
>>>
>>> This patch was bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for 
>>> trunk?
>>
>> I think the patch is reasonable but I'll defer to Joseph for approval.  Out 
>> of
>> curiosity - what about that #ident thing?  I suppose we'd ICE until you
>> have fixed that part, no?
>
> Actually, I simply overlooked that problem, because I've already been
> playing around with different ways to fix it, and one of those was in
> my test tree. The full patch I tested is attached. Now that this
> problem comes up anyway, perhaps you can have a look at this and share
> your thoughts, whether this approach looks acceptable to you :-)
>
> Let's consider the patch withdrawn for the moment, until the #ident
> situation is solved.

The patch looks good to me, but I wonder what piece I missed that makes
you use pretty-printers for

+/* Pretty-vprint a string to a top-level asm.  */
+
+struct asm_node *
+add_asm_vprintf (const char *p, va_list ap)
+{
+  pretty_printer pp;
+  const char *asm_string;
+  tree t;
+
+  pp_construct (&pp, NULL, 0);
+  pp_vprintf (&pp, p, ap);
+  asm_string = pp_formatted_text (&pp);
+  t = build_string (strlen (asm_string), asm_string);
+
+  /* FIXME: We have to free PP, but is there a more elegant way than this?  */
+  pp_clear_output_area (&pp);
+  free (pp.buffer);
+
+  return add_asm_node (t);

instead of simply using sprintf...

OTOH all other dumpers never free their pretty-printers so you could use
a local static pretty_printer and an initialized flag ...

Please split up the patch into one dealing with #ident exclusively and
a followup
with the other pieces.

Richard.

> Ciao!
> Steven

Reply via email to