Commit 07838b13 by Gabriel Dos Reis Committed by Gabriel Dos Reis

pretty-print.h (pp_underscore): New.

	* pretty-print.h (pp_underscore): New.
	(pp_comma): Tidy.
	* gimple-pretty-print.c (dump_unary_rhs): Use specialized pretty
	printer functions instead of pp_character.
	(dump_binary_rhs): Likewise.
	(dump_ternary_rhs): Likewise.
	(dump_gimple_call_args): Likewise.
	(pp_points_to_solution): Likewise.
	(dump_gimple_call): Likewise.
	(dump_gimple_switch): Likewise.
	(dump_gimple_cond): Likewise.
	(dump_gimple_bind): Likewise.
	(dump_gimple_try): Likewise.
	(dump_gimple_omp_for): Likewise.
	(dump_gimple_omp_continue): Likewise.
	(dump_gimple_omp_single): Likewise.
	(dump_gimple_omp_sections): Likewise.
	(dump_gimple_omp_block): Likewise.
	(dump_gimple_omp_critical): Likewise.
	(dump_gimple_transaction): Likewise.
	(dump_gimple_asm): Likewise.
	(dump_gimple_phi): Likewise.
	(dump_gimple_omp_parallel): Likewise.
	(dump_gimple_omp_task): Likewise.
	(dump_gimple_omp_atomic_load): Likewise.
	(dump_gimple_omp_atomic_store): Likewise.
	(dump_gimple_mem_ops): Likewise.
	(pp_gimple_stmt_1): Likewise.
	(pp_cfg_jump): Likewise.
	(dump_implicit_edges): Likewise.
	(gimple_dump_bb_for_graph): Likewise.
	* graph.c (draw_cfg_node): Likewise.
	* langhooks.c (lhd_print_error_function): Likewise.
	* sched-vis.c (print_exp): Likewise.
	(print_value): Likewise.
	(print_pattern): Likewise.
	(print_insn): Likewise.
	(rtl_dump_bb_for_graph): Likewise.
	* tree-pretty-print.c (dump_function_declaration): Likewise.
	(dump_array_domain): Likewise.
	(dump_omp_clause): Likewise.
	(dump_location): Likewise.
	(dump_generic_node): Likewise.
	(print_struct_decl): Likewise.
	* diagnostic.c (diagnostic_show_locus): Use pp_space.

c-family/
	* c-ada-spec.c (print_ada_macros): Use specialized pretty printer
	functions instead of pp_character.
	(pp_ada_tree_identifier): Likewise.
	(dump_ada_double_name): Likewise.
	(dump_ada_function_declaration): Likewise.
	(dump_ada_array_domains): Likewise.
	(dump_template_types): Likewise.
	(dump_generic_ada_node): Likewise.
	(print_ada_declaration): Likewise.
	(print_ada_struct_decl): Likewise.
	* c-pretty-print.c (pp_c_integer_constant): Likewise.

cp/
	* error.c (dump_aggr_type): Use specialized pretty printer
	functions instead of pp_character.
	(dump_type_prefix): Likewise.
	(dump_simple_decl): Likewise.
	(type_to_string): Likewise.

From-SVN: r201467
parent bb0d2039
2013-08-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* pretty-print.h (pp_underscore): New.
(pp_comma): Tidy.
* gimple-pretty-print.c (dump_unary_rhs): Use specialized pretty
printer functions instead of pp_character.
(dump_binary_rhs): Likewise.
(dump_ternary_rhs): Likewise.
(dump_gimple_call_args): Likewise.
(pp_points_to_solution): Likewise.
(dump_gimple_call): Likewise.
(dump_gimple_switch): Likewise.
(dump_gimple_cond): Likewise.
(dump_gimple_bind): Likewise.
(dump_gimple_try): Likewise.
(dump_gimple_omp_for): Likewise.
(dump_gimple_omp_continue): Likewise.
(dump_gimple_omp_single): Likewise.
(dump_gimple_omp_sections): Likewise.
(dump_gimple_omp_block): Likewise.
(dump_gimple_omp_critical): Likewise.
(dump_gimple_transaction): Likewise.
(dump_gimple_asm): Likewise.
(dump_gimple_phi): Likewise.
(dump_gimple_omp_parallel): Likewise.
(dump_gimple_omp_task): Likewise.
(dump_gimple_omp_atomic_load): Likewise.
(dump_gimple_omp_atomic_store): Likewise.
(dump_gimple_mem_ops): Likewise.
(pp_gimple_stmt_1): Likewise.
(pp_cfg_jump): Likewise.
(dump_implicit_edges): Likewise.
(gimple_dump_bb_for_graph): Likewise.
* graph.c (draw_cfg_node): Likewise.
* langhooks.c (lhd_print_error_function): Likewise.
* sched-vis.c (print_exp): Likewise.
(print_value): Likewise.
(print_pattern): Likewise.
(print_insn): Likewise.
(rtl_dump_bb_for_graph): Likewise.
* tree-pretty-print.c (dump_function_declaration): Likewise.
(dump_array_domain): Likewise.
(dump_omp_clause): Likewise.
(dump_location): Likewise.
(dump_generic_node): Likewise.
(print_struct_decl): Likewise.
* diagnostic.c (diagnostic_show_locus): Use pp_space.
2013-08-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
* gimple-ssa-strength-reduction.c (replace_mult_candidate): Update
......
2013-08-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-ada-spec.c (print_ada_macros): Use specialized pretty printer
functions instead of pp_character.
(pp_ada_tree_identifier): Likewise.
(dump_ada_double_name): Likewise.
(dump_ada_function_declaration): Likewise.
(dump_ada_array_domains): Likewise.
(dump_template_types): Likewise.
(dump_generic_ada_node): Likewise.
(print_ada_declaration): Likewise.
(print_ada_struct_decl): Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
2013-07-23 Tom Tromey <tromey@redhat.com>
* c-common.h (enum rid) <RID_GENERIC>: New constant.
......
......@@ -418,7 +418,7 @@ print_ada_macros (pretty_printer *pp, cpp_hashnode **macros, int max_ada_macros)
pp_string (pp, "; -- ");
pp_string (pp, sloc.file);
pp_character (pp, ':');
pp_colon (pp);
pp_scalar (pp, "%d", sloc.line);
pp_newline (pp);
}
......@@ -1253,7 +1253,7 @@ pp_ada_tree_identifier (pretty_printer *buffer, tree node, tree type,
{
append_withs (s1, limited_access);
pp_string (buffer, s1);
pp_character (buffer, '.');
pp_dot (buffer);
}
free (s1);
}
......@@ -1375,7 +1375,7 @@ dump_ada_double_name (pretty_printer *buffer, tree t1, tree t2, const char *s)
pp_scalar (buffer, "%d", TYPE_UID (TREE_TYPE (t1)));
}
pp_character (buffer, '_');
pp_underscore (buffer);
if (DECL_NAME (t1))
pp_ada_tree_identifier (buffer, DECL_NAME (t2), t2, false);
......@@ -1489,7 +1489,7 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
if (num_args > 0)
{
pp_space (buffer);
pp_character (buffer, '(');
pp_left_paren (buffer);
}
if (TREE_CODE (func) == FUNCTION_DECL)
......@@ -1550,7 +1550,7 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
if (num < num_args)
{
pp_character (buffer, ';');
pp_semicolon (buffer);
if (num_args > 2)
newline_and_indent (buffer, spc + INDENT_INCR);
......@@ -1566,7 +1566,7 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
}
if (num_args > 0)
pp_character (buffer, ')');
pp_right_paren (buffer);
return num_args;
}
......@@ -1577,7 +1577,7 @@ static void
dump_ada_array_domains (pretty_printer *buffer, tree node, int spc)
{
int first = 1;
pp_character (buffer, '(');
pp_left_paren (buffer);
for (; TREE_CODE (node) == ARRAY_TYPE; node = TREE_TYPE (node))
{
......@@ -1606,7 +1606,7 @@ dump_ada_array_domains (pretty_printer *buffer, tree node, int spc)
else
pp_string (buffer, "size_t");
}
pp_character (buffer, ')');
pp_right_paren (buffer);
}
/* Dump in BUFFER file:line information related to NODE. */
......@@ -1706,7 +1706,7 @@ dump_template_types (pretty_printer *buffer, tree types,
for (i = 0; i < len; i++)
{
tree elem = TREE_VEC_ELT (types, i);
pp_character (buffer, '_');
pp_underscore (buffer);
if (!dump_generic_ada_node (buffer, elem, 0, cpp_check, spc, false, true))
{
pp_string (buffer, "unknown");
......@@ -2215,7 +2215,7 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type,
if (tree_int_cst_sgn (val) < 0)
{
pp_character (buffer, '-');
pp_minus (buffer);
high = ~high + !low;
low = -low;
}
......@@ -2986,7 +2986,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type,
dump_generic_ada_node
(buffer, TYPE_NAME (TREE_TYPE (t)), type, cpp_check,
spc, false, true);
pp_character (buffer, ')');
pp_right_paren (buffer);
print_ada_methods (buffer, TREE_TYPE (t), cpp_check, spc);
}
......@@ -3226,7 +3226,7 @@ print_ada_struct_decl (pretty_printer *buffer, tree node, tree type,
dump_generic_ada_node
(buffer, TREE_TYPE (type), type, cpp_check, spc, false, true);
package_prefix = true;
pp_character (buffer, ')');
pp_right_paren (buffer);
if (is_union)
{
......@@ -3236,7 +3236,7 @@ print_ada_struct_decl (pretty_printer *buffer, tree node, tree type,
dump_generic_ada_node
(buffer, TREE_TYPE (type), type, cpp_check, spc, false, true);
pp_character (buffer, ')');
pp_right_paren (buffer);
}
if (bitfield_used)
......@@ -3246,7 +3246,7 @@ print_ada_struct_decl (pretty_printer *buffer, tree node, tree type,
pp_string (buffer, "pragma Pack (");
dump_generic_ada_node
(buffer, TREE_TYPE (type), type, cpp_check, spc, false, true);
pp_character (buffer, ')');
pp_right_paren (buffer);
bitfield_used = false;
}
......
......@@ -920,7 +920,7 @@ pp_c_integer_constant (c_pretty_printer *pp, tree i)
HOST_WIDE_INT high = TREE_INT_CST_HIGH (i);
if (tree_int_cst_sgn (i) < 0)
{
pp_character (pp, '-');
pp_minus (pp);
high = ~high + !low;
low = -low;
}
......
2013-08-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (dump_aggr_type): Use specialized pretty printer
functions instead of pp_character.
(dump_type_prefix): Likewise.
(dump_simple_decl): Likewise.
(type_to_string): Likewise.
2013-08-02 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (finish_stmt): Do not declare.
......
......@@ -663,7 +663,7 @@ dump_aggr_type (tree t, int flags)
if (lambda_function (t))
dump_parameters (FUNCTION_FIRST_USER_PARMTYPE (lambda_function (t)),
flags);
pp_character(cxx_pp, '>');
pp_greater (cxx_pp);
}
else
pp_cxx_tree_identifier (cxx_pp, name);
......@@ -710,13 +710,13 @@ dump_type_prefix (tree t, int flags)
TYPE_ATTRIBUTES (sub));
}
if (TYPE_PTR_P (t))
pp_character(cxx_pp, '*');
pp_star (cxx_pp);
else if (TREE_CODE (t) == REFERENCE_TYPE)
{
if (TYPE_REF_IS_RVALUE (t))
pp_string (cxx_pp, "&&");
else
pp_character (cxx_pp, '&');
pp_ampersand (cxx_pp);
}
pp_base (cxx_pp)->padding = pp_before;
pp_cxx_cv_qualifier_seq (cxx_pp, t);
......@@ -946,7 +946,7 @@ dump_simple_decl (tree t, tree type, int flags)
{
if (TREE_CODE (t) == FIELD_DECL && DECL_NORMAL_CAPTURE_P (t))
{
pp_character (cxx_pp, '<');
pp_less (cxx_pp);
pp_string (cxx_pp, IDENTIFIER_POINTER (DECL_NAME (t)) + 2);
pp_string (cxx_pp, " capture>");
}
......@@ -2870,7 +2870,7 @@ type_to_string (tree typ, int verbose)
/* And remember the start of the aka dump. */
aka_start = obstack_object_size (ob);
dump_type (aka, flags);
pp_character (cxx_pp, '}');
pp_right_brace (cxx_pp);
p = (char*)obstack_base (ob);
/* If they are identical, cut off the aka with a NUL. */
if (memcmp (p, p+aka_start, len) == 0)
......
......@@ -306,7 +306,7 @@ diagnostic_show_locus (diagnostic_context * context,
pp_newline (context->printer);
saved_prefix = pp_get_prefix (context->printer);
pp_set_prefix (context->printer, NULL);
pp_character (context->printer, ' ');
pp_space (context->printer);
while (max_width > 0 && *line != '\0')
{
char c = *line == '\t' ? ' ' : *line;
......
......@@ -109,10 +109,10 @@ draw_cfg_node (pretty_printer *pp, int funcdef_no, basic_block bb)
pp_string (pp, "EXIT");
else
{
pp_character (pp, '{');
pp_left_brace (pp);
pp_write_text_to_stream (pp);
dump_bb_for_graph (pp, bb);
pp_character (pp, '}');
pp_right_brace (pp);
}
pp_string (pp, "\"];\n\n");
......
......@@ -446,7 +446,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
if (fndecl)
{
expanded_location s = expand_location (*locus);
pp_character (context->printer, ',');
pp_comma (context->printer);
pp_newline (context->printer);
if (s.file != NULL)
{
......@@ -467,7 +467,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
}
}
pp_character (context->printer, ':');
pp_colon (context->printer);
}
diagnostic_set_last_function (context, diagnostic);
......
......@@ -238,7 +238,7 @@ pp_base_get_prefix (const pretty_printer *pp) { return pp->prefix; }
#define pp_left_brace(PP) pp_character (PP, '{')
#define pp_right_brace(PP) pp_character (PP, '}')
#define pp_semicolon(PP) pp_character (PP, ';')
#define pp_comma(PP) pp_string (PP, ", ")
#define pp_comma(PP) pp_character (PP, ',')
#define pp_dot(PP) pp_character (PP, '.')
#define pp_colon(PP) pp_character (PP, ':')
#define pp_colon_colon(PP) pp_string (PP, "::")
......@@ -260,6 +260,7 @@ 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_underscore(PP) pp_character (PP, '_')
#define pp_newline_and_flush(PP) \
do { \
pp_newline (PP); \
......
......@@ -347,11 +347,11 @@ print_exp (pretty_printer *pp, const_rtx x, int verbose)
pp_string (pp, "unspec");
if (GET_CODE (x) == UNSPEC_VOLATILE)
pp_string (pp, "/v");
pp_character (pp, '[');
pp_left_bracket (pp);
for (i = 0; i < XVECLEN (x, 0); i++)
{
if (i != 0)
pp_character (pp, ',');
pp_comma (pp);
print_pattern (pp, XVECEXP (x, 0, i), verbose);
}
pp_string (pp, "] ");
......@@ -393,7 +393,7 @@ print_exp (pretty_printer *pp, const_rtx x, int verbose)
if (fun)
{
pp_string (pp, fun);
pp_character (pp, '(');
pp_left_paren (pp);
}
for (i = 0; i < 4; i++)
......@@ -404,13 +404,13 @@ print_exp (pretty_printer *pp, const_rtx x, int verbose)
if (op[i])
{
if (fun && i != 0)
pp_character (pp, ',');
pp_comma (pp);
print_value (pp, op[i], verbose);
}
}
if (fun)
pp_character (pp, ')');
pp_right_paren (pp);
} /* print_exp */
/* Prints rtxes, I customarily classified as values. They're constants,
......@@ -462,13 +462,13 @@ print_value (pretty_printer *pp, const_rtx x, int verbose)
case STRICT_LOW_PART:
pp_printf (pp, "%s(", GET_RTX_NAME (GET_CODE (x)));
print_value (pp, XEXP (x, 0), verbose);
pp_character (pp, ')');
pp_right_paren (pp);
break;
case REG:
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
{
if (ISDIGIT (reg_names[REGNO (x)][0]))
pp_character (pp, '%');
pp_modulo (pp);
pp_string (pp, reg_names[REGNO (x)]);
}
else
......@@ -486,9 +486,9 @@ print_value (pretty_printer *pp, const_rtx x, int verbose)
pp_string (pp, GET_RTX_NAME (GET_CODE (x)));
break;
case MEM:
pp_character (pp, '[');
pp_left_bracket (pp);
print_value (pp, XEXP (x, 0), verbose);
pp_character (pp, ']');
pp_right_bracket (pp);
break;
case DEBUG_EXPR:
pp_printf (pp, "D#%i", DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x)));
......@@ -514,7 +514,7 @@ print_pattern (pretty_printer *pp, const_rtx x, int verbose)
{
case SET:
print_value (pp, SET_DEST (x), verbose);
pp_character (pp, '=');
pp_equal (pp);
print_value (pp, SET_SRC (x), verbose);
break;
case RETURN:
......@@ -535,14 +535,14 @@ print_pattern (pretty_printer *pp, const_rtx x, int verbose)
print_value (pp, PAT_VAR_LOCATION_LOC (x), verbose);
break;
case COND_EXEC:
pp_character (pp, '(');
pp_left_paren (pp);
if (GET_CODE (COND_EXEC_TEST (x)) == NE
&& XEXP (COND_EXEC_TEST (x), 1) == const0_rtx)
print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose);
else if (GET_CODE (COND_EXEC_TEST (x)) == EQ
&& XEXP (COND_EXEC_TEST (x), 1) == const0_rtx)
{
pp_character (pp, '!');
pp_exclamation (pp);
print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose);
}
else
......@@ -554,13 +554,13 @@ print_pattern (pretty_printer *pp, const_rtx x, int verbose)
{
int i;
pp_character (pp, '{');
pp_left_brace (pp);
for (i = 0; i < XVECLEN (x, 0); i++)
{
print_pattern (pp, XVECEXP (x, 0, i), verbose);
pp_character (pp, ';');
pp_semicolon (pp);
}
pp_character (pp, '}');
pp_right_brace (pp);
}
break;
case SEQUENCE:
......@@ -588,10 +588,10 @@ print_pattern (pretty_printer *pp, const_rtx x, int verbose)
for (int i = 0; i < XVECLEN (x, 0); i++)
{
print_pattern (pp, XVECEXP (x, 0, i), verbose);
pp_character (pp, ';');
pp_semicolon (pp);
}
}
pp_character (pp, '}');
pp_right_brace (pp);
}
break;
case ASM_INPUT:
......@@ -726,9 +726,9 @@ print_insn (pretty_printer *pp, const_rtx x, int verbose)
case NOTE_INSN_VAR_LOCATION:
case NOTE_INSN_CALL_ARG_LOCATION:
pp_character (pp, '{');
pp_left_brace (pp);
print_pattern (pp, NOTE_VAR_LOCATION (x), verbose);
pp_character (pp, '}');
pp_right_brace (pp);
break;
default:
......@@ -839,7 +839,7 @@ rtl_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
{
if (! first)
{
pp_character (pp, '|');
pp_bar (pp);
pp_write_text_to_stream (pp);
}
first = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment