This patchlet has print_c_tree use non-static local variable for its pretty-printer object. The code is much simpler that way. (A follow up will add destructor so we stop leaking storage.)
Tested on an x86_64-suse-linux. Applied to trunk. -- Gaby 2013-08-05 Gabriel Dos Reis <g...@integrable-solutions.net> * c-pretty-print.c (print_c_tree): Simplify. Use non-static local c_pretty_printer variable. Index: c-family/c-pretty-print.c =================================================================== --- c-family/c-pretty-print.c (revision 201479) +++ c-family/c-pretty-print.c (working copy) @@ -2359,22 +2359,13 @@ void print_c_tree (FILE *file, tree t) { - static c_pretty_printer pp_rec; - static bool initialized = 0; - c_pretty_printer *pp = &pp_rec; - - if (!initialized) - { - initialized = 1; - pp_construct (pp, NULL, 0); - pp_c_pretty_printer_init (pp); - pp_needs_newline (pp) = true; - } - pp->buffer->stream = file; - - pp_statement (pp, t); - - pp_newline_and_flush (pp); + c_pretty_printer pp; + pp_construct (&pp, NULL, 0); + pp_c_pretty_printer_init (&pp); + pp_needs_newline (&pp) = true; + pp.buffer->stream = file; + pp_statement (&pp, t); + pp_newline_and_flush (&pp); } /* Print the tree T in full, on stderr. */