pretty printing trends and questions

Basile STARYNKEVITCH basile@starynkevitch.net
Mon Sep 8 14:14:00 GMT 2008


Hello All,

I am correct in assuming that pretty printing & debug dumping in GCC 
tend to go thru the pretty printer abstraction of gcc/pretty-printer.h	 
hence that the old way of printing directly to a file (like e.g. dump_bb 
or debug_bb in gcc/cfg.c for printing basic_block-s) is deprecated, or 
is it the other way round (that using pretty-printer.h is deprecated in 
favor of routines with a FILE* argument)?

Also (I asked on #gcc chat), I do not understand what code is supposed 
to free the memory allocated with
   pp->buffer = XCNEW (output_buffer);
in function pp_construct of gcc/pretty-print.c. I'm supposing that this 
code is for debugging only, and a tiny memory leak does not matter in 
that case.

At last, I added (in a quick & dirty way, not tested a lot) a variant to 
be able to pretty print into a buffer (actually, thru any flushing 
routine) into the MELT branch.


> void
> pp_construct_routdata (pretty_printer *pp, const char *prefix, int maximum_length, void (*flushrout)(const char*,void*), void *flushdata) 

I would like to avoid using fmemopen; it seems very GNU GLIBC specific...

To Ian Taylor (and other C++ heroes) I suppose all the prettyprinting 
code is supposed to be replaced by some ostream trick in the C++ branch.

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***



More information about the Gcc mailing list