This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Clean up pretty printers [6/n]
- From: Gabriel Dos Reis <gdr at axiomatics dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 05 Aug 2013 04:01:15 -0500
- Subject: Clean up pretty printers [6/n]
Same topics as from previous patch; this time for the graphiz outputter.
-- Gaby
2013-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
* graph.c (init_graph_slim_pretty_print): Remove.
(print_graph_cfg): Do not call it. Use local pretty printer.
(start_graph_dump): Likewise.
Index: gcc/graph.c
===================================================================
--- gcc/graph.c (revision 201481)
+++ gcc/graph.c (working copy)
@@ -56,26 +56,6 @@
return fp;
}
-/* Return a pretty-print buffer for output to file FP. */
-
-static pretty_printer *
-init_graph_slim_pretty_print (FILE *fp)
-{
- static bool initialized = false;
- static pretty_printer graph_slim_pp;
-
- if (! initialized)
- {
- pp_construct (&graph_slim_pp, /*prefix=*/NULL, /*linewidth=*/0);
- initialized = true;
- }
- else
- gcc_assert (! pp_last_position_in_text (&graph_slim_pp));
-
- graph_slim_pp.buffer->stream = fp;
- return &graph_slim_pp;
-}
-
/* Draw a basic block BB belonging to the function with FUNCDEF_NO
as its unique number. */
static void
@@ -297,7 +277,10 @@
{
const char *funcname = function_name (fun);
FILE *fp = open_graph_file (base, "a");
- pretty_printer *pp = init_graph_slim_pretty_print (fp);
+ pretty_printer graph_slim_pp;
+ pp_construct (&graph_slim_pp, /*prefix=*/NULL, /*linewidth=*/0);
+ graph_slim_pp.buffer->stream = fp;
+ pretty_printer *const pp = &graph_slim_pp;
pp_printf (pp, "subgraph \"%s\" {\n"
"\tcolor=\"black\";\n"
"\tlabel=\"%s\";\n",
@@ -313,7 +296,10 @@
static void
start_graph_dump (FILE *fp, const char *base)
{
- pretty_printer *pp = init_graph_slim_pretty_print (fp);
+ pretty_printer graph_slim_pp;
+ pp_construct (&graph_slim_pp, /*prefix=*/NULL, /*linewidth=*/0);
+ graph_slim_pp.buffer->stream = fp;
+ pretty_printer *const pp = &graph_slim_pp;
pp_string (pp, "digraph \"");
pp_write_text_to_stream (pp);
pp_string (pp, base);