From 5f7f600e3703fbfc4ae4c731e419b996c6708a85 Mon Sep 17 00:00:00 2001 From: steven Date: Tue, 7 Aug 2012 22:14:29 +0000 Subject: [PATCH] gcc/ * cfg.c (debug_bb): Do not set TDF_BLOCKS. * cfghooks.c (dump_bb): Honor ~TDF_BLOCKS. * pretty-print.c (pp_base_flush): Do not add a newline, and do not clear pp_needs_newline. * pretty-print.h (pp_newline_and_flush): New macro with the behavior of pp_base_flush before the above change. * langhooks.c (lhd_print_error_function): Use pp_newline_and_flush instead of pp_flush. * diagnostic.c (diagnostic_finish): Likewise. (diagnostic_report_diagnostic): Likewise. (verbatim): Likewise. (error_recursion): Likewise. * tree-pretty-print.c (print_generic_stmt): Likewise. (print_generic_stmt_indented): LIkewise. * gimple-pretty-print.c (print_gimple_stmt): Likewise. (print_gimple_seq): Likewise. (gimple_dump_bb_buff): Likewise. c-family/ * c-pretty-print.c (pp_c_function_definition): Use pp_newline_and_flush instead of separate pp_newline and pp_flush. (print_c_tree): Likewise. cp/ * error.c (print_instantiation_context): Pretty-print a newline before diagnostic_flush_buffer. * cxx-pretty-print.c (pp_cxx_function_definition): Use pp_newline_and_flush instead of separate pp_newline and pp_flush. testsuite/ * gcc.dg/tree-prof/update-loopch.c: Ask for dump with blocks info. * gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise. * gcc.dg/tree-ssa/pr18133-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190215 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-pretty-print.c | 6 ++---- gcc/cfg.c | 2 +- gcc/cfghooks.c | 6 ++++-- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/cxx-pretty-print.c | 7 ++----- gcc/cp/error.c | 1 + gcc/diagnostic.c | 10 +++++----- gcc/gimple-pretty-print.c | 6 +++--- gcc/langhooks.c | 2 +- gcc/pretty-print.c | 2 -- gcc/pretty-print.h | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/tree-prof/update-loopch.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c | 2 +- gcc/tree-pretty-print.c | 4 ++-- 18 files changed, 69 insertions(+), 28 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 295efad..1bffab7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2012-08-07 Steven Bosscher + + * cfg.c (debug_bb): Do not set TDF_BLOCKS. + * cfghooks.c (dump_bb): Honor ~TDF_BLOCKS. + * pretty-print.c (pp_base_flush): Do not add a newline, and do not + clear pp_needs_newline. + * pretty-print.h (pp_newline_and_flush): New macro with the behavior + of pp_base_flush before the above change. + * langhooks.c (lhd_print_error_function): Use pp_newline_and_flush + instead of pp_flush. + * diagnostic.c (diagnostic_finish): Likewise. + (diagnostic_report_diagnostic): Likewise. + (verbatim): Likewise. + (error_recursion): Likewise. + * tree-pretty-print.c (print_generic_stmt): Likewise. + (print_generic_stmt_indented): LIkewise. + * gimple-pretty-print.c (print_gimple_stmt): Likewise. + (print_gimple_seq): Likewise. + (gimple_dump_bb_buff): Likewise. + 2012-08-07 Uros Bizjak PR debug/54177 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 983a93e..7181930 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2012-08-07 Steven Bosscher + + * c-pretty-print.c (pp_c_function_definition): Use pp_newline_and_flush + instead of separate pp_newline and pp_flush. + (print_c_tree): Likewise. + 2012-07-26 Richard Henderson * c-common.c (handle_hot_attribute): Allow labels. diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index d445187..e040a37 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -846,8 +846,7 @@ pp_c_function_definition (c_pretty_printer *pp, tree t) pp_declarator (pp, t); pp_needs_newline (pp) = true; pp_statement (pp, DECL_SAVED_TREE (t)); - pp_newline (pp); - pp_flush (pp); + pp_newline_and_flush (pp); } @@ -2361,8 +2360,7 @@ print_c_tree (FILE *file, tree t) pp_statement (pp, t); - pp_newline (pp); - pp_flush (pp); + pp_newline_and_flush (pp); } /* Print the tree T in full, on stderr. */ diff --git a/gcc/cfg.c b/gcc/cfg.c index f861407..2b4e908 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -652,7 +652,7 @@ free_aux_for_edges (void) DEBUG_FUNCTION void debug_bb (basic_block bb) { - dump_bb (stderr, bb, 0, dump_flags | TDF_BLOCKS); + dump_bb (stderr, bb, 0, dump_flags); } DEBUG_FUNCTION basic_block diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index be117cf..a7b653b 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -271,10 +271,12 @@ verify_flow_info (void) void dump_bb (FILE *outf, basic_block bb, int indent, int flags) { - dump_bb_info (outf, bb, indent, flags, true, false); + if (flags & TDF_BLOCKS) + dump_bb_info (outf, bb, indent, flags, true, false); if (cfg_hooks->dump_bb) cfg_hooks->dump_bb (outf, bb, indent, flags); - dump_bb_info (outf, bb, indent, flags, false, true); + if (flags & TDF_BLOCKS) + dump_bb_info (outf, bb, indent, flags, false, true); fputc ('\n', outf); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5452a1c..db335c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2012-08-07 Steven Bosscher + + * error.c (print_instantiation_context): Pretty-print a newline before + diagnostic_flush_buffer. + * cxx-pretty-print.c (pp_cxx_function_definition): Use + pp_newline_and_flush instead of separate pp_newline and pp_flush. + 2012-08-06 Dodji Seketeli Avoid crashing on erroneous static_assert usage diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index eef3489..03d9149 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1625,11 +1625,8 @@ pp_cxx_function_definition (cxx_pretty_printer *pp, tree t) if (DECL_SAVED_TREE (t)) pp_cxx_statement (pp, DECL_SAVED_TREE (t)); else - { - pp_cxx_semicolon (pp); - pp_needs_newline (pp) = true; - } - pp_flush (pp); + pp_cxx_semicolon (pp); + pp_newline_and_flush (pp); pp->enclosing_scope = saved_scope; } diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 58f0aff..17646e2 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -3194,6 +3194,7 @@ print_instantiation_context (void) { print_instantiation_partial_context (global_dc, current_instantiation (), input_location); + pp_base_newline (global_dc->printer); diagnostic_flush_buffer (global_dc); } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 4913eed..b3ae86c 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -172,7 +172,7 @@ diagnostic_finish (diagnostic_context *context) pp_verbatim (context->printer, _("%s: some warnings being treated as errors"), progname); - pp_flush (context->printer); + pp_newline_and_flush (context->printer); } } @@ -530,7 +530,7 @@ diagnostic_report_diagnostic (diagnostic_context *context, try to flush out the previous error, then let this one through. Don't do this more than once. */ if (diagnostic->kind == DK_ICE && context->lock == 1) - pp_flush (context->printer); + pp_newline_and_flush (context->printer); else error_recursion (context); } @@ -650,7 +650,7 @@ diagnostic_report_diagnostic (diagnostic_context *context, pp_output_formatted_text (context->printer); diagnostic_show_locus (context, diagnostic); (*diagnostic_finalizer (context)) (context, diagnostic); - pp_flush (context->printer); + pp_newline_and_flush (context->printer); diagnostic_action_after_output (context, diagnostic); diagnostic->message.format_spec = saved_format_spec; diagnostic->x_data = NULL; @@ -708,7 +708,7 @@ verbatim (const char *gmsgid, ...) text.locus = NULL; text.x_data = NULL; pp_format_verbatim (global_dc->printer, &text); - pp_flush (global_dc->printer); + pp_newline_and_flush (global_dc->printer); va_end (ap); } @@ -986,7 +986,7 @@ error_recursion (diagnostic_context *context) diagnostic_info diagnostic; if (context->lock < 3) - pp_flush (context->printer); + pp_newline_and_flush (context->printer); fnotice (stderr, "Internal compiler error: Error reporting routines re-entered.\n"); diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index a9b071c..af7c39a 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -97,7 +97,7 @@ print_gimple_stmt (FILE *file, gimple g, int spc, int flags) { maybe_init_pretty_print (file); dump_gimple_stmt (&buffer, g, spc, flags); - pp_flush (&buffer); + pp_newline_and_flush (&buffer); } @@ -143,7 +143,7 @@ print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags) { maybe_init_pretty_print (file); dump_gimple_seq (&buffer, seq, spc, flags); - pp_flush (&buffer); + pp_newline_and_flush (&buffer); } @@ -2247,7 +2247,7 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent, INDENT (curr_indent); dump_gimple_stmt (buffer, stmt, curr_indent, flags); - pp_flush (buffer); + pp_newline_and_flush (buffer); dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt); } diff --git a/gcc/langhooks.c b/gcc/langhooks.c index a34733f..a9e60f9 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -472,7 +472,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file, } diagnostic_set_last_function (context, diagnostic); - pp_flush (context->printer); + pp_newline_and_flush (context->printer); context->printer->prefix = old_prefix; free ((char*) new_prefix); } diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index 4033ba3..c1282c7 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -575,9 +575,7 @@ pp_base_flush (pretty_printer *pp) { pp_write_text_to_stream (pp); pp_clear_state (pp); - fputc ('\n', pp->buffer->stream); fflush (pp->buffer->stream); - pp_needs_newline (pp) = false; } /* Sets the number of maximum characters per line PRETTY-PRINTER can diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index a7b5a9f..e0fd2e9 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -256,6 +256,12 @@ pp_base_get_prefix (const pretty_printer *pp) { return pp->prefix; } #define pp_quote(PP) pp_character (PP, '\'') #define pp_backquote(PP) pp_character (PP, '`') #define pp_doublequote(PP) pp_character (PP, '"') +#define pp_newline_and_flush(PP) \ + do { \ + pp_newline (PP); \ + pp_flush (PP); \ + pp_needs_newline (PP) = false; \ + } while (0) #define pp_newline_and_indent(PP, N) \ do { \ pp_indentation (PP) += N; \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5eeb526..61ac4e7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-08-07 Steven Bosscher + + * gcc.dg/tree-prof/update-loopch.c: Ask for dump with blocks info. + * gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise. + * gcc.dg/tree-ssa/pr18133-1.c: Likewise. + 2012-08-06 Cary Coutant * g++.dg/debug/dwarf2/non-virtual-thunk.C: New test case. diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c index 3388996..cc06ea7 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c +++ b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile-details -fdump-tree-optimized-details" } */ +/* { dg-options "-O2 -fdump-ipa-profile-blocks-details -fdump-tree-optimized-blocks-details" } */ int max = 33333; int a[8]; int diff --git a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c index 84327fe..27c4bfa 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-profile_estimate-details" } */ +/* { dg-options "-O2 -fdump-ipa-profile_estimate-blocks-details" } */ void g(void); void h(void); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c index 8a26479..8bae014 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-optimized-details" } */ +/* { dg-options "-O1 -fdump-tree-optimized-blocks-details" } */ void foo (void) { diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 4ac601c..c7bb520 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -133,7 +133,7 @@ print_generic_stmt (FILE *file, tree t, int flags) { maybe_init_pretty_print (file); dump_generic_node (&buffer, t, 0, flags, true); - pp_flush (&buffer); + pp_newline_and_flush (&buffer); } /* Print tree T, and its successors, on file FILE. FLAGS specifies details @@ -150,7 +150,7 @@ print_generic_stmt_indented (FILE *file, tree t, int flags, int indent) for (i = 0; i < indent; i++) pp_space (&buffer); dump_generic_node (&buffer, t, indent, flags, true); - pp_flush (&buffer); + pp_newline_and_flush (&buffer); } /* Print a single expression T on file FILE. FLAGS specifies details to show -- 2.7.4