This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Clean up pretty printers [2/n]


This patch has c_pretty_printer formally derive from pretty_printer, and
cxx_pretty_printer derive from c_pretty_printer.  I was surprised to
see we didn't have more pretty printer classes -- we should.  Hopefully,
that will be easier now that we have builtin language support.

It also removes the macros pp_base and pp_c_base -- they implemented the
usual derive class -> base class conversion, which we not get for free.
Consequently, lot of places needed to be touched.  Which explains the
boring nature of the ChangeLogs -- probably of the same size as the
patch proper.


Tested on an x86_64-suse-linux.  Applied to trunk.

-- Gaby

2013-08-04  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* pretty-print.h (pp_base): Remove.  Adjust dependent macros.
	* diagnostic.h (diagnostic_flush_buffer): Adjust.
	* pretty-print.c (pp_formatted_text_data): Likewise.
	(pp_indent): Rename from pp_base_indent.
	(pp_format): Rename from pp_base_format.
	(pp_output_formatted_text): Rename from pp_base_output_formatted_text.
	(pp_format_verbatim): Rename from pp_base_format_verbatim.
	(pp_flush): Rename from pp_base_flush.
	(pp_set_line_maximum_length): Rename from
	pp_base_set_line_maximum_length.
	(pp_clear_output_area): Rename from pp_base_clear_output_area.
	(pp_set_prefix): Rename from pp_base_set_prefix.
	(pp_destroy_prefix): Rename from pp_base_destroy_prefix.
	(pp_emit_prefix): Rename from pp_base_emit_prefix.
	(pp_append_text): Rename from pp_base_append_text.
	(pp_formatted_text): Rename from pp_base_formatted_text.
	(pp_last_position_in_text): Rename from pp_base_last_position_in_text.
	(pp_remaining_character_count_for_line): Rename from
	pp_base_remaining_character_count_for_line.
	(pp_newline): Rename from pp_base_newline.
	(pp_character): Rename from pp_base_character.
	(pp_string): Rename from pp_base_string.
	(pp_maybe_space): Rename from pp_base_maybe_space.
	* asan.c (asan_pp_string): Adjust.
	(asan_emit_stack_protection): Likewise.
	(asan_add_global): Likewise.
	* sched-vis.c (str_pattern_slim): Adjust pretty printer function call.
	* tree-mudflap.c (mf_varname_tree): Likewise.
	* tree-pretty-print.c (pp_tree_identifier): Rename from
	pp_base_tree_identifier.
	* tree-pretty-print.h (pp_tree_identifier): Remove macro definition.
	Declare as function.

c/
	* c-objc-common.c (c_initialize_diagnostics): Don't call pp_base.

c-family/
	* c-pretty-print.h (c_pretty_printer): Derive from pretty_printer.
	(pp_base): Remove.
	(pp_c_base): Likewise.  Adjust users.
	* c-pretty-print.c (pp_c_maybe_whitespace): Adjust.
	(pp_c_whitespace): Do not call pp_base.
	(pp_c_left_paren): Likewise.
	(pp_c_right_paren): Likewise.
	(pp_c_left_brace): Likewise.
	(pp_c_right_brace): Likewise.
	(pp_c_left_bracket): Likewise.
	(pp_c_right_bracket): Likewise.
	(pp_c_dot): Likewise.
	(pp_c_ampersand): Likewise.
	(pp_c_star): Likewise.
	(pp_c_arrow): Likewise.
	(pp_c_semicolon): Likewise.
	(pp_c_complement): Likewise.
	(pp_c_exclamation): Likewise.
	(pp_c_direct_declarator): Likewise.
	(pp_c_ws_string): Likewise.
	(pp_c_identifier): Likewise.
	(pp_c_statement): Likewise.
	(print_c_tree): Likewise.

cp/
	* cxx-pretty-print.h (pp_c_base): Remove.
	(cxx_pretty_printer): Derive from c_pretty_printer.
	Adjust macros using pp_c_base.
	* cp-objcp-common.c (cxx_initialize_diagnostics): Do not call pp_base.
	* cxx-pretty-print.c (pp_cxx_nonconsecutive_character): Likewise.
	(pp_cxx_colon_colon): Likewise.
	(pp_cxx_separate_with): Likewise.
	(pp_cxx_storage_class_specifier): Do not call pp_c_base.
	(pp_cxx_expression_list): Likewise.
	(pp_cxx_space_for_pointer_operator): Likewise.
	(pp_cxx_init_declarator): Likewise.
	(pp_cxx_call_argument_list): Likewise.
	(pp_cxx_constant): Likewise.
	(pp_cxx_postfix_expression): Likewise.
	(pp_cxx_new_expression): Likewise.
	(pp_cxx_unary_expression): Likewise.
	(pp_cxx_cast_expression): Likewise.
	(pp_cxx_conditional_expression): Likewise.
	(pp_cxx_assignment_expression): Likewise.
	(pp_cxx_expression): Likewise.
	(pp_cxx_function_specifier): Likewise.
	(pp_cxx_decl_specifier_seq): Likewise.
	(pp_cxx_simple_type_specifier): Likewise.
	(pp_cxx_type_specifier_seq): Likewise.
	(pp_cxx_ptr_operator): Likewise.
	(pp_cxx_parameter_declaration_clause): Likewise.
	(pp_cxx_direct_declarator): Likewise.
	(pp_cxx_direct_abstract_declarator): Likewise.
	(pp_cxx_type_id): Likewise.
	(pp_cxx_statement): Likewise.
	(pp_cxx_pretty_printer_init): Tidy.
	* error.c (init_error): Do not use pp_base.
	(dump_aggr_type): Likewise.
	(dump_type_prefix): Likewise.
	(dump_type_suffix): Likewise.
	(dump_global_iord): Likewise.
	(dump_decl): Likewise.
	(dump_function_decl): Likewise.
	(dump_ref_qualifier): Likewise.
	(reinit_cxx_pp): Likewise.
	(decl_as_dwarf_string): Likewise.
	(lang_decl_dwarf_name): Likewise.
	(type_to_string): Likewise.
	(cv_to_string): Likewise.
	(cxx_print_error_function): Likewise.
	(cp_diagnostic_starter): Likewise.
	(cp_diagnostic_finalizer): Likewise.
	(cp_print_error_function): Likewise.
	(print_instantiation_context): Likewise.
	(cp_printer): Likewise.


Index: asan.c
===================================================================
--- asan.c	(revision 201478)
+++ asan.c	(working copy)
@@ -860,7 +860,7 @@
 static tree
 asan_pp_string (void)
 {
-  const char *buf = pp_base_formatted_text (&asan_pp);
+  const char *buf = pp_formatted_text (&asan_pp);
   size_t len = strlen (buf);
   tree ret = build_string (len + 1, buf);
   TREE_TYPE (ret)
@@ -955,7 +955,7 @@
 
   pp_clear_output_area (&asan_pp);
   if (DECL_NAME (current_function_decl))
-    pp_base_tree_identifier (&asan_pp, DECL_NAME (current_function_decl));
+    pp_tree_identifier (&asan_pp, DECL_NAME (current_function_decl));
   else
     pp_string (&asan_pp, "<unknown>");
   pp_space (&asan_pp);
@@ -972,7 +972,7 @@
 	{
 	  pp_decimal_int (&asan_pp, IDENTIFIER_LENGTH (DECL_NAME (decl)));
 	  pp_space (&asan_pp);
-	  pp_base_tree_identifier (&asan_pp, DECL_NAME (decl));
+	  pp_tree_identifier (&asan_pp, DECL_NAME (decl));
 	}
       else
 	pp_string (&asan_pp, "9 <unknown>");
@@ -1981,7 +1981,7 @@
 
   pp_clear_output_area (&asan_pp);
   if (DECL_NAME (decl))
-    pp_base_tree_identifier (&asan_pp, DECL_NAME (decl));
+    pp_tree_identifier (&asan_pp, DECL_NAME (decl));
   else
     pp_string (&asan_pp, "<unknown>");
   pp_space (&asan_pp);
Index: c/c-objc-common.c
===================================================================
--- c/c-objc-common.c	(revision 201478)
+++ c/c-objc-common.c	(working copy)
@@ -190,7 +190,7 @@
 
   base = context->printer;
   pp = XNEW (c_pretty_printer);
-  memcpy (pp_base (pp), base, sizeof (pretty_printer));
+  memcpy (pp, base, sizeof (pretty_printer));
   pp_c_pretty_printer_init (pp);
   context->printer = (pretty_printer *) pp;
 
Index: c-family/c-pretty-print.c
===================================================================
--- c-family/c-pretty-print.c	(revision 201478)
+++ c-family/c-pretty-print.c	(working copy)
@@ -43,7 +43,7 @@
 
 #define pp_c_maybe_whitespace(PP)            \
    do {                                      \
-     if (pp_base (PP)->padding == pp_before) \
+     if ((PP)->padding == pp_before) \
        pp_c_whitespace (PP);                 \
    } while (0)
 
@@ -75,98 +75,98 @@
 pp_c_whitespace (c_pretty_printer *pp)
 {
   pp_space (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_left_paren (c_pretty_printer *pp)
 {
   pp_left_paren (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_right_paren (c_pretty_printer *pp)
 {
   pp_right_paren (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_left_brace (c_pretty_printer *pp)
 {
   pp_left_brace (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_right_brace (c_pretty_printer *pp)
 {
   pp_right_brace (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_left_bracket (c_pretty_printer *pp)
 {
   pp_left_bracket (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_right_bracket (c_pretty_printer *pp)
 {
   pp_right_bracket (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_dot (c_pretty_printer *pp)
 {
   pp_dot (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_ampersand (c_pretty_printer *pp)
 {
   pp_ampersand (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_star (c_pretty_printer *pp)
 {
   pp_star (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_arrow (c_pretty_printer *pp)
 {
   pp_arrow (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_semicolon (c_pretty_printer *pp)
 {
   pp_semicolon (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_complement (c_pretty_printer *pp)
 {
   pp_complement (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
 pp_c_exclamation (c_pretty_printer *pp)
 {
   pp_exclamation (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 /* Print out the external representation of QUALIFIERS.  */
@@ -703,7 +703,7 @@
     case FUNCTION_DECL:
       pp_c_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
       pp_c_tree_decl_identifier (pp, t);
-      if (pp_c_base (pp)->flags & pp_c_flag_abstract)
+      if (pp->flags & pp_c_flag_abstract)
 	pp_abstract_declarator (pp, TREE_TYPE (t));
       else
 	{
@@ -1184,7 +1184,7 @@
 {
   pp_c_maybe_whitespace (pp);
   pp_string (pp, str);
-  pp_base (pp)->padding = pp_before;
+  pp->padding = pp_before;
 }
 
 /* Pretty-print an IDENTIFIER_NODE, which may contain UTF-8 sequences
@@ -1196,7 +1196,7 @@
 {
   pp_c_maybe_whitespace (pp);
   pp_identifier (pp, id);
-  pp_base (pp)->padding = pp_before;
+  pp->padding = pp_before;
 }
 
 /* Pretty-print a C primary-expression.
@@ -2312,7 +2312,7 @@
   if (pp_needs_newline (pp))
     pp_newline_and_indent (pp, 0);
 
-  dump_generic_node (pp_base (pp), stmt, pp_indentation (pp), 0, true);
+  dump_generic_node (pp, stmt, pp_indentation (pp), 0, true);
 }
 
 
@@ -2366,11 +2366,11 @@
   if (!initialized)
     {
       initialized = 1;
-      pp_construct (pp_base (pp), NULL, 0);
+      pp_construct (pp, NULL, 0);
       pp_c_pretty_printer_init (pp);
       pp_needs_newline (pp) = true;
     }
-  pp_base (pp)->buffer->stream = file;
+  pp->buffer->stream = file;
 
   pp_statement (pp, t);
 
Index: c-family/c-pretty-print.h
===================================================================
--- c-family/c-pretty-print.h	(revision 201478)
+++ c-family/c-pretty-print.h	(working copy)
@@ -26,35 +26,29 @@
 #include "pretty-print.h"
 
 
-typedef enum
+enum pp_c_pretty_print_flags
   {
      pp_c_flag_abstract = 1 << 1,
      pp_c_flag_gnu_v3 = 1 << 2,
      pp_c_flag_last_bit = 3
-  } pp_c_pretty_print_flags;
+  };
 
 
 /* The data type used to bundle information necessary for pretty-printing
    a C or C++ entity.  */
-typedef struct c_pretty_print_info c_pretty_printer;
+struct c_pretty_printer;
 
 /* The type of a C pretty-printer 'member' function.  */
 typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree);
 
 /* The datatype that contains information necessary for pretty-printing
    a tree that represents a C construct.  Any pretty-printer for a
-   language using C/c++ syntax can derive from this datatype and reuse
-   facilities provided here.  It can do so by having a subobject of type
-   c_pretty_printer and override the macro pp_c_base to return a pointer
-   to that subobject.  Such a pretty-printer has the responsibility to
-   initialize the pp_base() part, then call pp_c_pretty_printer_init
-   to set up the components that are specific to the C pretty-printer.
-   A derived pretty-printer can override any function listed in the
-   vtable below.  See cp/cxx-pretty-print.h and cp/cxx-pretty-print.c
-   for an example of derivation.  */
-struct c_pretty_print_info
+   language using C syntax can derive from this datatype and reuse
+   facilities provided here.  A derived pretty-printer can override
+   any function listed in the vtable below.  See cp/cxx-pretty-print.h
+   and cp/cxx-pretty-print.c for an example of derivation.  */
+struct c_pretty_printer : pretty_printer
 {
-  pretty_printer base;
   /* Points to the first element of an array of offset-list.
      Not used yet.  */
   int *offset_list;
@@ -91,71 +85,41 @@
   c_pretty_print_fn expression;
 };
 
-/* Override the pp_base macro.  Derived pretty-printers should not
-   touch this macro.  Instead they should override pp_c_base instead.  */
-#undef pp_base
-#define pp_base(PP)  (&pp_c_base (PP)->base)
-
-
 #define pp_c_tree_identifier(PPI, ID)              \
    pp_c_identifier (PPI, IDENTIFIER_POINTER (ID))
 
-#define pp_declaration(PPI, T)                    \
-   pp_c_base (PPI)->declaration (pp_c_base (PPI), T)
-#define pp_declaration_specifiers(PPI, D)         \
-   pp_c_base (PPI)->declaration_specifiers (pp_c_base (PPI), D)
-#define pp_abstract_declarator(PP, D)             \
-   pp_c_base (PP)->abstract_declarator (pp_c_base (PP), D)
-#define pp_type_specifier_seq(PPI, D)             \
-   pp_c_base (PPI)->type_specifier_seq (pp_c_base (PPI), D)
-#define pp_declarator(PPI, D)                     \
-   pp_c_base (PPI)->declarator (pp_c_base (PPI), D)
-#define pp_direct_declarator(PPI, D)              \
-   pp_c_base (PPI)->direct_declarator (pp_c_base (PPI), D)
+#define pp_declaration(PP, T)           (PP)->declaration (PP, T)
+#define pp_declaration_specifiers(PP, D)         \
+   (PP)->declaration_specifiers (PP, D)
+#define pp_abstract_declarator(PP, D)   (PP)->abstract_declarator (PP, D)
+#define pp_type_specifier_seq(PP, D)    (PP)->type_specifier_seq (PP, D)
+#define pp_declarator(PP, D)            (PP)->declarator (PP, D)
+#define pp_direct_declarator(PP, D)     (PP)->direct_declarator (PP, D)
 #define pp_direct_abstract_declarator(PP, D)      \
-   pp_c_base (PP)->direct_abstract_declarator (pp_c_base (PP), D)
-#define pp_ptr_operator(PP, D)                    \
-   pp_c_base (PP)->ptr_operator (pp_c_base (PP), D)
-#define pp_parameter_list(PPI, T)                 \
-  pp_c_base (PPI)->parameter_list (pp_c_base (PPI), T)
-#define pp_type_id(PPI, D)                        \
-  pp_c_base (PPI)->type_id (pp_c_base (PPI), D)
-#define pp_simple_type_specifier(PP, T)           \
-  pp_c_base (PP)->simple_type_specifier (pp_c_base (PP), T)
-#define pp_function_specifier(PP, D)              \
-  pp_c_base (PP)->function_specifier (pp_c_base (PP), D)
+   (PP)->direct_abstract_declarator (PP, D)
+#define pp_ptr_operator(PP, D)          (PP)->ptr_operator (PP, D)
+#define pp_parameter_list(PP, T)        (PP)->parameter_list (PP, T)
+#define pp_type_id(PP, D)               (PP)->type_id (PP, D)
+#define pp_simple_type_specifier(PP, T) (PP)->simple_type_specifier (PP, T)
+#define pp_function_specifier(PP, D)    (PP)->function_specifier (PP, D)
 #define pp_storage_class_specifier(PP, D)         \
-  pp_c_base (PP)->storage_class_specifier (pp_c_base (PP), D);
+  (PP)->storage_class_specifier (PP, D);
 
-#define pp_statement(PPI, S)                      \
-  pp_c_base (PPI)->statement (pp_c_base (PPI), S)
+#define pp_statement(PP, S)             (PP)->statement (PP, S)
 
-#define pp_constant(PP, E) \
-  pp_c_base (PP)->constant (pp_c_base (PP), E)
-#define pp_id_expression(PP, E)  \
-  pp_c_base (PP)->id_expression (pp_c_base (PP), E)
-#define pp_primary_expression(PPI, E)             \
-  pp_c_base (PPI)->primary_expression (pp_c_base (PPI), E)
-#define pp_postfix_expression(PPI, E)             \
-  pp_c_base (PPI)->postfix_expression (pp_c_base (PPI), E)
-#define pp_unary_expression(PPI, E)               \
-  pp_c_base (PPI)->unary_expression (pp_c_base (PPI), E)
-#define pp_initializer(PPI, E)                    \
-  pp_c_base (PPI)->initializer (pp_c_base (PPI), E)
-#define pp_multiplicative_expression(PPI, E)      \
-  pp_c_base (PPI)->multiplicative_expression (pp_c_base (PPI), E)
-#define pp_conditional_expression(PPI, E)         \
-  pp_c_base (PPI)->conditional_expression (pp_c_base (PPI), E)
-#define pp_assignment_expression(PPI, E)          \
-   pp_c_base (PPI)->assignment_expression (pp_c_base (PPI), E)
-#define pp_expression(PP, E)                      \
-   pp_c_base (PP)->expression (pp_c_base (PP), E)
+#define pp_constant(PP, E)              (PP)->constant (PP, E)
+#define pp_id_expression(PP, E)         (PP)->id_expression (PP, E)
+#define pp_primary_expression(PP, E)    (PP)->primary_expression (PP, E)
+#define pp_postfix_expression(PP, E)    (PP)->postfix_expression (PP, E)
+#define pp_unary_expression(PP, E)      (PP)->unary_expression (PP, E)
+#define pp_initializer(PP, E)           (PP)->initializer (PP, E)
+#define pp_multiplicative_expression(PP, E)      \
+  (PP)->multiplicative_expression (PP, E)
+#define pp_conditional_expression(PP, E) (PP)->conditional_expression (PP, E)
+#define pp_assignment_expression(PP, E) (PP)->assignment_expression (PP, E)
+#define pp_expression(PP, E)            (PP)->expression (PP, E)
 
 
-/* Returns the c_pretty_printer base object of PRETTY-PRINTER.  This
-   macro must be overridden by any subclass of c_pretty_print_info.  */
-#define pp_c_base(PP)  (PP)
-
 extern void pp_c_pretty_printer_init (c_pretty_printer *);
 void pp_c_whitespace (c_pretty_printer *);
 void pp_c_left_paren (c_pretty_printer *);
Index: cp/cp-objcp-common.c
===================================================================
--- cp/cp-objcp-common.c	(revision 201478)
+++ cp/cp-objcp-common.c	(working copy)
@@ -138,7 +138,7 @@
 
   base = context->printer;
   pp = XNEW (cxx_pretty_printer);
-  memcpy (pp_base (pp), base, sizeof (pretty_printer));
+  memcpy (pp, base, sizeof (pretty_printer));
   pp_cxx_pretty_printer_init (pp);
   context->printer = (pretty_printer *) pp;
 
Index: cp/cxx-pretty-print.c
===================================================================
--- cp/cxx-pretty-print.c	(revision 201478)
+++ cp/cxx-pretty-print.c	(working copy)
@@ -58,25 +58,25 @@
   if (p != NULL && *p == c)
     pp_cxx_whitespace (pp);
   pp_character (pp, c);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 #define pp_cxx_storage_class_specifier(PP, T) \
-   pp_c_storage_class_specifier (pp_c_base (PP), T)
+   pp_c_storage_class_specifier (PP, T)
 #define pp_cxx_expression_list(PP, T)    \
-   pp_c_expression_list (pp_c_base (PP), T)
+   pp_c_expression_list (PP, T)
 #define pp_cxx_space_for_pointer_operator(PP, T)  \
-   pp_c_space_for_pointer_operator (pp_c_base (PP), T)
+   pp_c_space_for_pointer_operator (PP, T)
 #define pp_cxx_init_declarator(PP, T)    \
-   pp_c_init_declarator (pp_c_base (PP), T)
+   pp_c_init_declarator (PP, T)
 #define pp_cxx_call_argument_list(PP, T) \
-   pp_c_call_argument_list (pp_c_base (PP), T)
+   pp_c_call_argument_list (PP, T)
 
 void
 pp_cxx_colon_colon (cxx_pretty_printer *pp)
 {
   pp_colon_colon (pp);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 void
@@ -95,7 +95,7 @@
 pp_cxx_separate_with (cxx_pretty_printer *pp, int c)
 {
   pp_separate_with (pp, c);
-  pp_base (pp)->padding = pp_none;
+  pp->padding = pp_none;
 }
 
 /* Expressions.  */
@@ -331,7 +331,7 @@
 	const bool in_parens = PAREN_STRING_LITERAL_P (t);
 	if (in_parens)
 	  pp_cxx_left_paren (pp);
-	pp_c_constant (pp_c_base (pp), t);
+	pp_c_constant (pp, t);
 	if (in_parens)
 	  pp_cxx_right_paren (pp);
       }
@@ -346,7 +346,7 @@
       /* else fall through.  */
 
     default:
-      pp_c_constant (pp_c_base (pp), t);
+      pp_c_constant (pp, t);
       break;
     }
 }
@@ -465,7 +465,7 @@
       break;
 
     default:
-      pp_c_primary_expression (pp_c_base (pp), t);
+      pp_c_primary_expression (pp, t);
       break;
     }
 }
@@ -643,7 +643,7 @@
       break;
 
     default:
-      pp_c_postfix_expression (pp_c_base (pp), t);
+      pp_c_postfix_expression (pp, t);
       break;
     }
 }
@@ -699,7 +699,7 @@
 	{
 	  pp_left_paren (pp);
 	  if (TREE_CODE (init) == TREE_LIST)
-	    pp_c_expression_list (pp_c_base (pp), init);
+	    pp_c_expression_list (pp, init);
 	  else if (init == void_zero_node)
 	    ;			/* OK, empty initializer list.  */
 	  else
@@ -736,7 +736,7 @@
 	  pp_right_bracket (pp);
 	  pp_space (pp);
 	}
-      pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
+      pp_c_cast_expression (pp, TREE_OPERAND (t, 0));
       break;
 
     default:
@@ -835,7 +835,7 @@
       break;
 
     default:
-      pp_c_unary_expression (pp_c_base (pp), t);
+      pp_c_unary_expression (pp, t);
       break;
     }
 }
@@ -856,7 +856,7 @@
       break;
 
     default:
-      pp_c_cast_expression (pp_c_base (pp), t);
+      pp_c_cast_expression (pp, t);
       break;
     }
 }
@@ -939,7 +939,7 @@
 {
   if (TREE_CODE (e) == COND_EXPR)
     {
-      pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+      pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
       pp_space (pp);
       pp_question (pp);
       pp_space (pp);
@@ -948,7 +948,7 @@
       pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
     }
   else
-    pp_c_logical_or_expression (pp_c_base (pp), e);
+    pp_c_logical_or_expression (pp, e);
 }
 
 /* Pretty-print a compound assignment operator token as indicated by T.  */
@@ -1007,7 +1007,7 @@
     {
     case MODIFY_EXPR:
     case INIT_EXPR:
-      pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+      pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
       pp_space (pp);
       pp_equal (pp);
       pp_space (pp);
@@ -1021,7 +1021,7 @@
       break;
 
     case MODOP_EXPR:
-      pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+      pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
       pp_cxx_assignment_operator (pp, TREE_OPERAND (e, 1));
       pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
       break;
@@ -1174,7 +1174,7 @@
       break;
 
     default:
-      pp_c_expression (pp_c_base (pp), t);
+      pp_c_expression (pp, t);
       break;
     }
 }
@@ -1198,7 +1198,7 @@
       else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
 	pp_cxx_ws_string (pp, "explicit");
       else
-	pp_c_function_specifier (pp_c_base (pp), t);
+	pp_c_function_specifier (pp, t);
 
     default:
       break;
@@ -1242,7 +1242,7 @@
 	pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
       else
 	default:
-      pp_c_declaration_specifiers (pp_c_base (pp), t);
+      pp_c_declaration_specifiers (pp, t);
       break;
     }
 }
@@ -1287,7 +1287,7 @@
       break;
 
     default:
-      pp_c_type_specifier (pp_c_base (pp), t);
+      pp_c_type_specifier (pp, t);
       break;
     }
 }
@@ -1342,7 +1342,7 @@
 
     default:
       if (!(TREE_CODE (t) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (t)))
-	pp_c_specifier_qualifier_list (pp_c_base (pp), t);
+	pp_c_specifier_qualifier_list (pp, t);
     }
 }
 
@@ -1362,8 +1362,7 @@
     case POINTER_TYPE:
       if (TYPE_PTR_OR_PTRMEM_P (TREE_TYPE (t)))
 	pp_cxx_ptr_operator (pp, TREE_TYPE (t));
-      pp_c_attributes_display (pp_c_base (pp),
-			       TYPE_ATTRIBUTES (TREE_TYPE (t)));
+      pp_c_attributes_display (pp, TYPE_ATTRIBUTES (TREE_TYPE (t)));
       if (TYPE_PTR_P (t))
 	{
 	  pp_star (pp);
@@ -1436,8 +1435,7 @@
   tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t);
   tree types =
     TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
-  const bool abstract = args == NULL
-    || pp_c_base (pp)->flags & pp_c_flag_abstract;
+  const bool abstract = args == NULL || pp->flags & pp_c_flag_abstract;
   bool first = true;
 
   /* Skip artificial parameter for nonstatic member functions.  */
@@ -1451,7 +1449,7 @@
 	pp_cxx_separate_with (pp, ',');
       first = false;
       pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args);
-      if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument)
+      if (!abstract && pp->flags & pp_cxx_flag_default_argument)
 	{
 	  pp_cxx_whitespace (pp);
 	  pp_equal (pp);
@@ -1557,7 +1555,7 @@
 
       if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
 	{
-	  pp_base (pp)->padding = pp_before;
+	  pp->padding = pp_before;
 	  pp_cxx_cv_qualifier_seq (pp, pp_cxx_implicit_parameter_type (t));
 	}
 
@@ -1572,7 +1570,7 @@
       break;
 
     default:
-      pp_c_direct_declarator (pp_c_base (pp), t);
+      pp_c_direct_declarator (pp, t);
       break;
     }
 }
@@ -1690,7 +1688,7 @@
       pp_cxx_direct_abstract_declarator (pp, TREE_TYPE (t));
       if (TREE_CODE (t) == METHOD_TYPE)
 	{
-	  pp_base (pp)->padding = pp_before;
+	  pp->padding = pp_before;
 	  pp_cxx_cv_qualifier_seq (pp, class_of_this_parm (t));
 	}
       pp_cxx_exception_specification (pp, t);
@@ -1704,7 +1702,7 @@
       break;
 
     default:
-      pp_c_direct_abstract_declarator (pp_c_base (pp), t);
+      pp_c_direct_abstract_declarator (pp, t);
       break;
     }
 }
@@ -1715,8 +1713,8 @@
 static void
 pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
 {
-  pp_flags saved_flags = pp_c_base (pp)->flags;
-  pp_c_base (pp)->flags |= pp_c_flag_abstract;
+  pp_flags saved_flags = pp->flags;
+  pp->flags |= pp_c_flag_abstract;
 
   switch (TREE_CODE (t))
     {
@@ -1744,11 +1742,11 @@
       break;
 
     default:
-      pp_c_type_id (pp_c_base (pp), t);
+      pp_c_type_id (pp, t);
       break;
     }
 
-  pp_c_base (pp)->flags = saved_flags;
+  pp->flags = saved_flags;
 }
 
 /* template-argument-list:
@@ -2021,7 +2019,7 @@
       break;
 
     default:
-      pp_c_statement (pp_c_base (pp), t);
+      pp_c_statement (pp, t);
       break;
     }
 }
@@ -2437,32 +2435,31 @@
 void
 pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
 {
-  pp_c_pretty_printer_init (pp_c_base (pp));
+  pp_c_pretty_printer_init (pp);
   pp_set_line_maximum_length (pp, 0);
 
-  pp->c_base.declaration = (pp_fun) pp_cxx_declaration;
-  pp->c_base.declaration_specifiers = (pp_fun) pp_cxx_decl_specifier_seq;
-  pp->c_base.function_specifier = (pp_fun) pp_cxx_function_specifier;
-  pp->c_base.type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
-  pp->c_base.declarator = (pp_fun) pp_cxx_declarator;
-  pp->c_base.direct_declarator = (pp_fun) pp_cxx_direct_declarator;
-  pp->c_base.parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
-  pp->c_base.type_id = (pp_fun) pp_cxx_type_id;
-  pp->c_base.abstract_declarator = (pp_fun) pp_cxx_abstract_declarator;
-  pp->c_base.direct_abstract_declarator =
-    (pp_fun) pp_cxx_direct_abstract_declarator;
-  pp->c_base.simple_type_specifier = (pp_fun)pp_cxx_simple_type_specifier;
+  pp->declaration = (pp_fun) pp_cxx_declaration;
+  pp->declaration_specifiers = (pp_fun) pp_cxx_decl_specifier_seq;
+  pp->function_specifier = (pp_fun) pp_cxx_function_specifier;
+  pp->type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
+  pp->declarator = (pp_fun) pp_cxx_declarator;
+  pp->direct_declarator = (pp_fun) pp_cxx_direct_declarator;
+  pp->parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
+  pp->type_id = (pp_fun) pp_cxx_type_id;
+  pp->abstract_declarator = (pp_fun) pp_cxx_abstract_declarator;
+  pp->direct_abstract_declarator = (pp_fun) pp_cxx_direct_abstract_declarator;
+  pp->simple_type_specifier = (pp_fun) pp_cxx_simple_type_specifier;
 
-  /* pp->c_base.statement = (pp_fun) pp_cxx_statement;  */
+  /* pp->statement = (pp_fun) pp_cxx_statement;  */
 
-  pp->c_base.constant = (pp_fun) pp_cxx_constant;
-  pp->c_base.id_expression = (pp_fun) pp_cxx_id_expression;
-  pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
-  pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
-  pp->c_base.unary_expression = (pp_fun) pp_cxx_unary_expression;
-  pp->c_base.multiplicative_expression = (pp_fun) pp_cxx_multiplicative_expression;
-  pp->c_base.conditional_expression = (pp_fun) pp_cxx_conditional_expression;
-  pp->c_base.assignment_expression = (pp_fun) pp_cxx_assignment_expression;
-  pp->c_base.expression = (pp_fun) pp_cxx_expression;
+  pp->constant = (pp_fun) pp_cxx_constant;
+  pp->id_expression = (pp_fun) pp_cxx_id_expression;
+  pp->primary_expression = (pp_fun) pp_cxx_primary_expression;
+  pp->postfix_expression = (pp_fun) pp_cxx_postfix_expression;
+  pp->unary_expression = (pp_fun) pp_cxx_unary_expression;
+  pp->multiplicative_expression = (pp_fun) pp_cxx_multiplicative_expression;
+  pp->conditional_expression = (pp_fun) pp_cxx_conditional_expression;
+  pp->assignment_expression = (pp_fun) pp_cxx_assignment_expression;
+  pp->expression = (pp_fun) pp_cxx_expression;
   pp->enclosing_scope = global_namespace;
 }
Index: cp/cxx-pretty-print.h
===================================================================
--- cp/cxx-pretty-print.h	(revision 201478)
+++ cp/cxx-pretty-print.h	(working copy)
@@ -23,46 +23,41 @@
 
 #include "c-family/c-pretty-print.h"
 
-#undef pp_c_base
-#define pp_c_base(PP) (&(PP)->c_base)
-
-typedef enum
+enum cxx_pretty_printer_flags
 {
   /* Ask for a qualified-id.  */
   pp_cxx_flag_default_argument = 1 << pp_c_flag_last_bit
+};
 
-} cxx_pretty_printer_flags;
-
-typedef struct
+struct cxx_pretty_printer : c_pretty_printer
 {
-  c_pretty_printer c_base;
   /* This is the enclosing scope of the entity being pretty-printed.  */
   tree enclosing_scope;
-} cxx_pretty_printer;
+};
 
 #define pp_cxx_cv_qualifier_seq(PP, T)   \
-   pp_c_type_qualifier_list (pp_c_base (PP), T)
+   pp_c_type_qualifier_list (PP, T)
 #define pp_cxx_cv_qualifiers(PP, CV)   \
-   pp_c_cv_qualifiers (pp_c_base (PP), CV, false)
+   pp_c_cv_qualifiers (PP, CV, false)
 
-#define pp_cxx_whitespace(PP)		pp_c_whitespace (pp_c_base (PP))
-#define pp_cxx_left_paren(PP)		pp_c_left_paren (pp_c_base (PP))
-#define pp_cxx_right_paren(PP)		pp_c_right_paren (pp_c_base (PP))
-#define pp_cxx_left_brace(PP)		pp_c_left_brace (pp_c_base (PP))
-#define pp_cxx_right_brace(PP)		pp_c_right_brace (pp_c_base (PP))
-#define pp_cxx_left_bracket(PP)		pp_c_left_bracket (pp_c_base (PP))
-#define pp_cxx_right_bracket(PP)	pp_c_right_bracket (pp_c_base (PP))
-#define pp_cxx_dot(PP)			pp_c_dot (pp_c_base (PP))
-#define pp_cxx_ampersand(PP)		pp_c_ampersand (pp_c_base (PP))
-#define pp_cxx_star(PP)			pp_c_star (pp_c_base (PP))
-#define pp_cxx_arrow(PP)		pp_c_arrow (pp_c_base (PP))
-#define pp_cxx_semicolon(PP)		pp_c_semicolon (pp_c_base (PP))
-#define pp_cxx_complement(PP)		pp_c_complement (pp_c_base (PP))
+#define pp_cxx_whitespace(PP)		pp_c_whitespace (PP)
+#define pp_cxx_left_paren(PP)		pp_c_left_paren (PP)
+#define pp_cxx_right_paren(PP)		pp_c_right_paren (PP)
+#define pp_cxx_left_brace(PP)		pp_c_left_brace (PP)
+#define pp_cxx_right_brace(PP)		pp_c_right_brace (PP)
+#define pp_cxx_left_bracket(PP)		pp_c_left_bracket (PP)
+#define pp_cxx_right_bracket(PP)	pp_c_right_bracket (PP)
+#define pp_cxx_dot(PP)			pp_c_dot (PP)
+#define pp_cxx_ampersand(PP)		pp_c_ampersand (PP)
+#define pp_cxx_star(PP)			pp_c_star (PP)
+#define pp_cxx_arrow(PP)		pp_c_arrow (PP)
+#define pp_cxx_semicolon(PP)		pp_c_semicolon (PP)
+#define pp_cxx_complement(PP)		pp_c_complement (PP)
 
-#define pp_cxx_ws_string(PP, I)		pp_c_ws_string (pp_c_base (PP), I)
-#define pp_cxx_identifier(PP, I)	pp_c_identifier (pp_c_base (PP), I)
+#define pp_cxx_ws_string(PP, I)		pp_c_ws_string (PP, I)
+#define pp_cxx_identifier(PP, I)	pp_c_identifier (PP, I)
 #define pp_cxx_tree_identifier(PP, T) \
-  pp_c_tree_identifier (pp_c_base (PP), T)
+  pp_c_tree_identifier (PP, T)
 
 void pp_cxx_pretty_printer_init (cxx_pretty_printer *);
 void pp_cxx_begin_template_argument_list (cxx_pretty_printer *);
Index: cp/error.c
===================================================================
--- cp/error.c	(revision 201478)
+++ cp/error.c	(working copy)
@@ -108,7 +108,7 @@
   diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
   diagnostic_format_decoder (global_dc) = cp_printer;
 
-  pp_construct (pp_base (cxx_pp), NULL, 0);
+  pp_construct (cxx_pp, NULL, 0);
   pp_cxx_pretty_printer_init (cxx_pp);
 }
 
@@ -654,7 +654,7 @@
       if (flags & TFF_CLASS_KEY_OR_ENUM)
 	pp_string (cxx_pp, M_("<anonymous>"));
       else
-	pp_printf (pp_base (cxx_pp), M_("<anonymous %s>"), variety);
+	pp_printf (cxx_pp, M_("<anonymous %s>"), variety);
     }
   else if (LAMBDA_TYPE_P (t))
     {
@@ -706,8 +706,7 @@
 	  {
 	    pp_cxx_whitespace (cxx_pp);
 	    pp_cxx_left_paren (cxx_pp);
-	    pp_c_attributes_display (pp_c_base (cxx_pp),
-				     TYPE_ATTRIBUTES (sub));
+	    pp_c_attributes_display (cxx_pp, TYPE_ATTRIBUTES (sub));
 	  }
 	if (TYPE_PTR_P (t))
 	  pp_star (cxx_pp);
@@ -718,7 +717,7 @@
 	  else
 	    pp_ampersand (cxx_pp);
 	}
-	pp_base (cxx_pp)->padding = pp_before;
+	cxx_pp->padding = pp_before;
 	pp_cxx_cv_qualifier_seq (cxx_pp, t);
       }
       break;
@@ -736,7 +735,7 @@
 	}
       pp_cxx_star (cxx_pp);
       pp_cxx_cv_qualifier_seq (cxx_pp, t);
-      pp_base (cxx_pp)->padding = pp_before;
+      cxx_pp->padding = pp_before;
       break;
 
       /* This can be reached without a pointer when dealing with
@@ -782,7 +781,7 @@
     case FIXED_POINT_TYPE:
     case NULLPTR_TYPE:
       dump_type (t, flags);
-      pp_base (cxx_pp)->padding = pp_before;
+      cxx_pp->padding = pp_before;
       break;
 
     default:
@@ -829,7 +828,7 @@
 	   anyway; they may in g++, but we'll just pretend otherwise.  */
 	dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
 
-	pp_base (cxx_pp)->padding = pp_before;
+	cxx_pp->padding = pp_before;
 	pp_cxx_cv_qualifiers (cxx_pp, type_memfn_quals (t));
 	dump_ref_qualifier (t, flags);
 	dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
@@ -918,7 +917,7 @@
   else
     gcc_unreachable ();
 
-  pp_printf (pp_base (cxx_pp), p, input_filename);
+  pp_printf (cxx_pp, p, input_filename);
 }
 
 static void
@@ -1048,7 +1047,7 @@
 	  flags &= ~TFF_UNQUALIFIED_NAME;
 	  if (DECL_NAME (t) == NULL_TREE)
             {
-              if (!(pp_c_base (cxx_pp)->flags & pp_c_flag_gnu_v3))
+              if (!(cxx_pp->flags & pp_c_flag_gnu_v3))
                 pp_cxx_ws_string (cxx_pp, M_("{anonymous}"));
               else
                 pp_cxx_ws_string (cxx_pp, M_("(anonymous namespace)"));
@@ -1457,14 +1456,14 @@
 
       if (TREE_CODE (fntype) == METHOD_TYPE)
 	{
-	  pp_base (cxx_pp)->padding = pp_before;
+	  cxx_pp->padding = pp_before;
 	  pp_cxx_cv_qualifier_seq (cxx_pp, class_of_this_parm (fntype));
 	  dump_ref_qualifier (fntype, flags);
 	}
 
       if (flags & TFF_EXCEPTION_SPECIFICATION)
 	{
-	  pp_base (cxx_pp)->padding = pp_before;
+	  cxx_pp->padding = pp_before;
 	  dump_exception_spec (exceptions, flags);
 	}
 
@@ -1549,7 +1548,7 @@
 {
   if (FUNCTION_REF_QUALIFIED (t))
     {
-      pp_base (cxx_pp)->padding = pp_before;
+      cxx_pp->padding = pp_before;
       if (FUNCTION_RVALUE_QUALIFIED (t))
         pp_cxx_ws_string (cxx_pp, "&&");
       else
@@ -2615,7 +2614,7 @@
 reinit_cxx_pp (void)
 {
   pp_clear_output_area (cxx_pp);
-  pp_base (cxx_pp)->padding = pp_none;
+  cxx_pp->padding = pp_none;
   pp_indentation (cxx_pp) = 0;
   pp_needs_newline (cxx_pp) = false;
   cxx_pp->enclosing_scope = current_function_decl;
@@ -2659,10 +2658,10 @@
   const char *name;
   /* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
      here will be adequate to get the desired behaviour.  */
-  pp_c_base (cxx_pp)->flags |= pp_c_flag_gnu_v3;
+  cxx_pp->flags |= pp_c_flag_gnu_v3;
   name = decl_as_string (decl, flags);
   /* Subsequent calls to the pretty printer shouldn't use this style.  */
-  pp_c_base (cxx_pp)->flags &= ~pp_c_flag_gnu_v3;
+  cxx_pp->flags &= ~pp_c_flag_gnu_v3;
   return name;
 }
 
@@ -2691,10 +2690,10 @@
   const char *name;
   /* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
      here will be adequate to get the desired behaviour.  */
-  pp_c_base (cxx_pp)->flags |= pp_c_flag_gnu_v3;
+  cxx_pp->flags |= pp_c_flag_gnu_v3;
   name = lang_decl_name (decl, v, translate);
   /* Subsequent calls to the pretty printer shouldn't use this style.  */
-  pp_c_base (cxx_pp)->flags &= ~pp_c_flag_gnu_v3;
+  cxx_pp->flags &= ~pp_c_flag_gnu_v3;
   return name;
 }
 
@@ -2861,7 +2860,7 @@
       && !uses_template_parms (typ))
     {
       int aka_start; char *p;
-      struct obstack *ob = pp_base (cxx_pp)->buffer->obstack;
+      struct obstack *ob = cxx_pp->buffer->obstack;
       /* Remember the end of the initial dump.  */
       int len = obstack_object_size (ob);
       tree aka = strip_typedefs (typ);
@@ -2943,7 +2942,7 @@
 cv_to_string (tree p, int v)
 {
   reinit_cxx_pp ();
-  pp_base (cxx_pp)->padding = v ? pp_before : pp_none;
+  cxx_pp->padding = v ? pp_before : pp_none;
   pp_cxx_cv_qualifier_seq (cxx_pp, p);
   return pp_formatted_text (cxx_pp);
 }
@@ -2954,7 +2953,7 @@
 			  diagnostic_info *diagnostic)
 {
   lhd_print_error_function (context, file, diagnostic);
-  pp_base_set_prefix (context->printer, file);
+  pp_set_prefix (context->printer, file);
   maybe_print_instantiation_context (context);
 }
 
@@ -2966,7 +2965,7 @@
   cp_print_error_function (context, diagnostic);
   maybe_print_instantiation_context (context);
   maybe_print_constexpr_context (context);
-  pp_base_set_prefix (context->printer, diagnostic_build_prefix (context,
+  pp_set_prefix (context->printer, diagnostic_build_prefix (context,
 								 diagnostic));
 }
 
@@ -2975,7 +2974,7 @@
 			 diagnostic_info *diagnostic)
 {
   virt_loc_aware_diagnostic_finalizer (context, diagnostic);
-  pp_base_destroy_prefix (context->printer);
+  pp_destroy_prefix (context->printer);
 }
 
 /* Print current function onto BUFFER, in the process of reporting
@@ -2996,10 +2995,10 @@
       char *new_prefix = (file && abstract_origin == NULL)
 			 ? file_name_as_prefix (context, file) : NULL;
 
-      pp_base_set_prefix (context->printer, new_prefix);
+      pp_set_prefix (context->printer, new_prefix);
 
       if (current_function_decl == NULL)
-	pp_base_string (context->printer, _("At global scope:"));
+	pp_string (context->printer, _("At global scope:"));
       else
 	{
 	  tree fndecl, ao;
@@ -3062,8 +3061,8 @@
 	      if (fndecl)
 		{
 		  expanded_location s = expand_location (*locus);
-		  pp_base_character (context->printer, ',');
-		  pp_base_newline (context->printer);
+		  pp_character (context->printer, ',');
+		  pp_newline (context->printer);
 		  if (s.file != NULL)
 		    {
 		      if (context->show_column && s.column != 0)
@@ -3083,12 +3082,12 @@
 			       cxx_printable_name_translate (fndecl, 2));
 		}
 	    }
-	  pp_base_character (context->printer, ':');
+	  pp_character (context->printer, ':');
 	}
-      pp_base_newline (context->printer);
+      pp_newline (context->printer);
 
       diagnostic_set_last_function (context, diagnostic);
-      pp_base_destroy_prefix (context->printer);
+      pp_destroy_prefix (context->printer);
       context->printer->prefix = old_prefix;
     }
 }
@@ -3267,7 +3266,7 @@
     }
   print_instantiation_partial_context_line (context, NULL, loc,
 					    /*recursive_p=*/false);
-  pp_base_newline (context->printer);
+  pp_newline (context->printer);
 }
 
 /* Called from cp_thing to print the template context for an error.  */
@@ -3287,7 +3286,7 @@
 {
   print_instantiation_partial_context
     (global_dc, current_instantiation (), input_location);
-  pp_base_newline (global_dc->printer);
+  pp_newline (global_dc->printer);
   diagnostic_flush_buffer (global_dc);
 }
 
@@ -3312,7 +3311,7 @@
 	pp_verbatim (context->printer,
 		     _("%r%s:%d:%R   in constexpr expansion of %qs"),
 		     "locus", xloc.file, xloc.line, s);
-      pp_base_newline (context->printer);
+      pp_newline (context->printer);
     }
 }
 
@@ -3384,7 +3383,7 @@
       return false;
     }
 
-  pp_base_string (pp, result);
+  pp_string (pp, result);
   if (set_locus && t != NULL)
     *text->locus = location_of (t);
   return true;
Index: diagnostic.h
===================================================================
--- diagnostic.h	(revision 201478)
+++ diagnostic.h	(working copy)
@@ -211,7 +211,7 @@
    Zero means don't wrap lines.  */
 #define diagnostic_line_cutoff(DC) ((DC)->printer->wrapping.line_cutoff)
 
-#define diagnostic_flush_buffer(DC) pp_base_flush ((DC)->printer)
+#define diagnostic_flush_buffer(DC) pp_flush ((DC)->printer)
 
 /* True if the last module or file in which a diagnostic was reported is
    different from the current one.  */
Index: pretty-print.c
===================================================================
--- pretty-print.c	(revision 201478)
+++ pretty-print.c	(working copy)
@@ -31,7 +31,7 @@
 
 /* A pointer to the formatted diagnostic message.  */
 #define pp_formatted_text_data(PP) \
-   ((const char *) obstack_base (pp_base (PP)->buffer->obstack))
+   ((const char *) obstack_base ((PP)->buffer->obstack))
 
 /* Format an integer given by va_arg (ARG, type-specifier T) where
    type-specifier is a precision modifier as indicated by PREC.  F is
@@ -207,7 +207,7 @@
    the column position to the current indentation level, assuming that a
    newline has just been written to the buffer.  */
 void
-pp_base_indent (pretty_printer *pp)
+pp_indent (pretty_printer *pp)
 {
   int n = pp_indentation (pp);
   int i;
@@ -252,10 +252,10 @@
 
 /* Formatting phases 1 and 2: render TEXT->format_spec plus
    TEXT->args_ptr into a series of chunks in PP->buffer->args[].
-   Phase 3 is in pp_base_format_text.  */
+   Phase 3 is in pp_format_text.  */
 
 void
-pp_base_format (pretty_printer *pp, text_info *text)
+pp_format (pretty_printer *pp, text_info *text)
 {
   output_buffer *buffer = pp->buffer;
   const char *p;
@@ -617,7 +617,7 @@
 
 /* Format of a message pointed to by TEXT.  */
 void
-pp_base_output_formatted_text (pretty_printer *pp)
+pp_output_formatted_text (pretty_printer *pp)
 {
   unsigned int chunk;
   output_buffer *buffer = pp_buffer (pp);
@@ -627,7 +627,7 @@
   gcc_assert (buffer->obstack == &buffer->formatted_obstack);
   gcc_assert (buffer->line_length == 0);
 
-  /* This is a third phase, first 2 phases done in pp_base_format_args.
+  /* This is a third phase, first 2 phases done in pp_format_args.
      Now we actually print it.  */
   for (chunk = 0; args[chunk]; chunk++)
     pp_string (pp, args[chunk]);
@@ -641,7 +641,7 @@
 /* Helper subroutine of output_verbatim and verbatim. Do the appropriate
    settings needed by BUFFER for a verbatim formatting.  */
 void
-pp_base_format_verbatim (pretty_printer *pp, text_info *text)
+pp_format_verbatim (pretty_printer *pp, text_info *text)
 {
   /* Set verbatim mode.  */
   pp_wrapping_mode_t oldmode = pp_set_verbatim_wrapping (pp);
@@ -656,7 +656,7 @@
 
 /* Flush the content of BUFFER onto the attached stream.  */
 void
-pp_base_flush (pretty_printer *pp)
+pp_flush (pretty_printer *pp)
 {
   pp_write_text_to_stream (pp);
   pp_clear_state (pp);
@@ -667,7 +667,7 @@
    output in line-wrapping mode.  A LENGTH value 0 suppresses
    line-wrapping.  */
 void
-pp_base_set_line_maximum_length (pretty_printer *pp, int length)
+pp_set_line_maximum_length (pretty_printer *pp, int length)
 {
   pp_line_cutoff (pp) = length;
   pp_set_real_maximum_length (pp);
@@ -675,7 +675,7 @@
 
 /* Clear PRETTY-PRINTER output area text info.  */
 void
-pp_base_clear_output_area (pretty_printer *pp)
+pp_clear_output_area (pretty_printer *pp)
 {
   obstack_free (pp->buffer->obstack, obstack_base (pp->buffer->obstack));
   pp->buffer->line_length = 0;
@@ -683,7 +683,7 @@
 
 /* Set PREFIX for PRETTY-PRINTER.  */
 void
-pp_base_set_prefix (pretty_printer *pp, const char *prefix)
+pp_set_prefix (pretty_printer *pp, const char *prefix)
 {
   pp->prefix = prefix;
   pp_set_real_maximum_length (pp);
@@ -693,7 +693,7 @@
 
 /* Free PRETTY-PRINTER's prefix, a previously malloc()'d string.  */
 void
-pp_base_destroy_prefix (pretty_printer *pp)
+pp_destroy_prefix (pretty_printer *pp)
 {
   if (pp->prefix != NULL)
     {
@@ -704,7 +704,7 @@
 
 /* Write out PRETTY-PRINTER's prefix.  */
 void
-pp_base_emit_prefix (pretty_printer *pp)
+pp_emit_prefix (pretty_printer *pp)
 {
   if (pp->prefix != NULL)
     {
@@ -717,7 +717,7 @@
 	case DIAGNOSTICS_SHOW_PREFIX_ONCE:
 	  if (pp->emitted_prefix)
 	    {
-	      pp_base_indent (pp);
+	      pp_indent (pp);
 	      break;
 	    }
 	  pp_indentation (pp) += 3;
@@ -757,7 +757,7 @@
    whitespace if appropriate.  The caller must ensure that it is
    safe to do so.  */
 void
-pp_base_append_text (pretty_printer *pp, const char *start, const char *end)
+pp_append_text (pretty_printer *pp, const char *start, const char *end)
 {
   /* Emit prefix and skip whitespace if we're starting a new line.  */
   if (pp->buffer->line_length == 0)
@@ -773,7 +773,7 @@
 /* Finishes constructing a NULL-terminated character string representing
    the PRETTY-PRINTED text.  */
 const char *
-pp_base_formatted_text (pretty_printer *pp)
+pp_formatted_text (pretty_printer *pp)
 {
   obstack_1grow (pp->buffer->obstack, '\0');
   return pp_formatted_text_data (pp);
@@ -782,7 +782,7 @@
 /*  Return a pointer to the last character emitted in PRETTY-PRINTER's
     output area.  A NULL pointer means no character available.  */
 const char *
-pp_base_last_position_in_text (const pretty_printer *pp)
+pp_last_position_in_text (const pretty_printer *pp)
 {
   const char *p = NULL;
   struct obstack *text = pp->buffer->obstack;
@@ -795,7 +795,7 @@
 /* Return the amount of characters PRETTY-PRINTER can accept to
    make a full line.  Meaningful only in line-wrapping mode.  */
 int
-pp_base_remaining_character_count_for_line (pretty_printer *pp)
+pp_remaining_character_count_for_line (pretty_printer *pp)
 {
   return pp->maximum_length - pp->buffer->line_length;
 }
@@ -839,7 +839,7 @@
 
 /* Have PRETTY-PRINTER start a new line.  */
 void
-pp_base_newline (pretty_printer *pp)
+pp_newline (pretty_printer *pp)
 {
   obstack_1grow (pp->buffer->obstack, '\n');
   pp_needs_newline (pp) = false;
@@ -848,7 +848,7 @@
 
 /* Have PRETTY-PRINTER add a CHARACTER.  */
 void
-pp_base_character (pretty_printer *pp, int c)
+pp_character (pretty_printer *pp, int c)
 {
   if (pp_is_wrapping_line (pp)
       && pp_remaining_character_count_for_line (pp) <= 0)
@@ -864,7 +864,7 @@
 /* Append a STRING to the output area of PRETTY-PRINTER; the STRING may
    be line-wrapped if in appropriate mode.  */
 void
-pp_base_string (pretty_printer *pp, const char *str)
+pp_string (pretty_printer *pp, const char *str)
 {
   pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0));
 }
@@ -872,12 +872,12 @@
 /* Maybe print out a whitespace if needed.  */
 
 void
-pp_base_maybe_space (pretty_printer *pp)
+pp_maybe_space (pretty_printer *pp)
 {
-  if (pp_base (pp)->padding != pp_none)
+  if (pp->padding != pp_none)
     {
       pp_space (pp);
-      pp_base (pp)->padding = pp_none;
+      pp->padding = pp_none;
     }
 }
 
Index: pretty-print.h
===================================================================
--- pretty-print.h	(revision 201478)
+++ pretty-print.h	(working copy)
@@ -29,30 +29,30 @@
 
 /* The type of a text to be formatted according a format specification
    along with a list of things.  */
-typedef struct
+struct text_info
 {
   const char *format_spec;
   va_list *args_ptr;
   int err_no;  /* for %m */
   location_t *locus;
   void **x_data;
-} text_info;
+};
 
 /* How often diagnostics are prefixed by their locations:
    o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported;
    o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once;
    o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical
    line is started.  */
-typedef enum
+enum diagnostic_prefixing_rule_t
 {
   DIAGNOSTICS_SHOW_PREFIX_ONCE       = 0x0,
   DIAGNOSTICS_SHOW_PREFIX_NEVER      = 0x1,
   DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2
-} diagnostic_prefixing_rule_t;
+};
 
 /* The chunk_info data structure forms a stack of the results from the
-   first phase of formatting (pp_base_format) which have not yet been
-   output (pp_base_output_formatted_text).  A stack is necessary because
+   first phase of formatting (pp_format) which have not yet been
+   output (pp_output_formatted_text).  A stack is necessary because
    the diagnostic starter may decide to generate its own output by way
    of the formatter.  */
 struct chunk_info
@@ -71,7 +71,7 @@
 
 /* The output buffer datatype.  This is best seen as an abstract datatype
    whose fields should not be accessed directly by clients.  */
-typedef struct
+struct output_buffer
 {
   /* Obstack where the text is built up.  */
   struct obstack formatted_obstack;
@@ -96,19 +96,19 @@
   /* This must be large enough to hold any printed integer or
      floating-point value.  */
   char digit_buffer[128];
-} output_buffer;
+};
 
 /* The type of pretty-printer flags passed to clients.  */
 typedef unsigned int pp_flags;
 
-typedef enum
+enum pp_padding
 {
   pp_none, pp_before, pp_after
-} pp_padding;
+};
 
 /* Structure for switching in and out of verbatim mode in a convenient
    manner.  */
-typedef struct
+struct pp_wrapping_mode_t
 {
   /* Current prefixing rule.  */
   diagnostic_prefixing_rule_t rule;
@@ -116,17 +116,17 @@
   /* The ideal upper bound of number of characters per line, as suggested
      by front-end.  */
   int line_cutoff;
-} pp_wrapping_mode_t;
+};
 
 /* Maximum characters per line in automatic line wrapping mode.
    Zero means don't wrap lines.  */
-#define pp_line_cutoff(PP)  pp_base (PP)->wrapping.line_cutoff
+#define pp_line_cutoff(PP)  (PP)->wrapping.line_cutoff
 
 /* Prefixing rule used in formatting a diagnostic message.  */
-#define pp_prefixing_rule(PP)  pp_base (PP)->wrapping.rule
+#define pp_prefixing_rule(PP)  (PP)->wrapping.rule
 
 /* Get or set the wrapping mode as a single entity.  */
-#define pp_wrapping_mode(PP) pp_base (PP)->wrapping
+#define pp_wrapping_mode(PP) (PP)->wrapping
 
 /* The type of a hook that formats client-specific data onto a pretty_pinter.
    A client-supplied formatter returns true if everything goes well,
@@ -135,24 +135,24 @@
 			    int, bool, bool, bool);
 
 /* Client supplied function used to decode formats.  */
-#define pp_format_decoder(PP) pp_base (PP)->format_decoder
+#define pp_format_decoder(PP) (PP)->format_decoder
 
 /* TRUE if a newline character needs to be added before further
    formatting.  */
-#define pp_needs_newline(PP)  pp_base (PP)->need_newline
+#define pp_needs_newline(PP)  (PP)->need_newline
 
 /* True if PRETTY-PRINTER is in line-wrapping mode.  */
 #define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
 
 /* The amount of whitespace to be emitted when starting a new line.  */
-#define pp_indentation(PP) pp_base (PP)->indent_skip
+#define pp_indentation(PP) (PP)->indent_skip
 
 /* True if identifiers are translated to the locale character set on
    output.  */
-#define pp_translate_identifiers(PP) pp_base (PP)->translate_identifiers
+#define pp_translate_identifiers(PP) (PP)->translate_identifiers
 
 /* True if colors should be shown.  */
-#define pp_show_color(PP) pp_base (PP)->show_color
+#define pp_show_color(PP) (PP)->show_color
 
 /* The data structure that contains the bare minimum required to do
    proper pretty-printing.  Clients may derived from this structure
@@ -202,34 +202,9 @@
   bool show_color;
 };
 
-#define pp_set_line_maximum_length(PP, L) \
-   pp_base_set_line_maximum_length (pp_base (PP), L)
-#define pp_set_prefix(PP, P)    pp_base_set_prefix (pp_base (PP), P)
-#define pp_get_prefix(PP)       pp_base_get_prefix (pp_base (PP))
 static inline const char *
-pp_base_get_prefix (const pretty_printer *pp) { return pp->prefix; }
-#define pp_destroy_prefix(PP)   pp_base_destroy_prefix (pp_base (PP))
-#define pp_remaining_character_count_for_line(PP) \
-  pp_base_remaining_character_count_for_line (pp_base (PP))
-#define pp_clear_output_area(PP) \
-  pp_base_clear_output_area (pp_base (PP))
-#define pp_formatted_text(PP)   pp_base_formatted_text (pp_base (PP))
-#define pp_last_position_in_text(PP) \
-  pp_base_last_position_in_text (pp_base (PP))
-#define pp_emit_prefix(PP)      pp_base_emit_prefix (pp_base (PP))
-#define pp_append_text(PP, B, E) \
-  pp_base_append_text (pp_base (PP), B, E)
-#define pp_flush(PP)            pp_base_flush (pp_base (PP))
-#define pp_format(PP, TI)       pp_base_format (pp_base (PP), TI)
-#define pp_output_formatted_text(PP) \
-  pp_base_output_formatted_text (pp_base (PP))
-#define pp_format_verbatim(PP, TI) \
-  pp_base_format_verbatim (pp_base (PP), TI)
+pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
 
-#define pp_character(PP, C)     pp_base_character (pp_base (PP), C)
-#define pp_string(PP, S)        pp_base_string (pp_base (PP), S)
-#define pp_newline(PP)          pp_base_newline (pp_base (PP))
-
 #define pp_space(PP)            pp_character (PP, ' ')
 #define pp_left_paren(PP)       pp_character (PP, '(')
 #define pp_right_paren(PP)      pp_character (PP, ')')
@@ -275,12 +250,11 @@
   do {                               \
     pp_indentation (PP) += N;        \
     pp_newline (PP);                 \
-    pp_base_indent (pp_base (PP));   \
+    pp_indent (PP);                  \
     pp_needs_newline (PP) = false;   \
   } while (0)
 #define pp_maybe_newline_and_indent(PP, N) \
   if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
-#define pp_maybe_space(PP)   pp_base_maybe_space (pp_base (PP))
 #define pp_separate_with(PP, C)     \
    do {                             \
      pp_character (PP, C);          \
@@ -307,21 +281,18 @@
 					  : (ID)))
 
 
-#define pp_buffer(PP) pp_base (PP)->buffer
-/* Clients that directly derive from pretty_printer need to override
-   this macro to return a pointer to the base pretty_printer structure.  */
-#define pp_base(PP) (PP)
+#define pp_buffer(PP) (PP)->buffer
 
 extern void pp_construct (pretty_printer *, const char *, int);
-extern void pp_base_set_line_maximum_length (pretty_printer *, int);
-extern void pp_base_set_prefix (pretty_printer *, const char *);
-extern void pp_base_destroy_prefix (pretty_printer *);
-extern int pp_base_remaining_character_count_for_line (pretty_printer *);
-extern void pp_base_clear_output_area (pretty_printer *);
-extern const char *pp_base_formatted_text (pretty_printer *);
-extern const char *pp_base_last_position_in_text (const pretty_printer *);
-extern void pp_base_emit_prefix (pretty_printer *);
-extern void pp_base_append_text (pretty_printer *, const char *, const char *);
+extern void pp_set_line_maximum_length (pretty_printer *, int);
+extern void pp_set_prefix (pretty_printer *, const char *);
+extern void pp_destroy_prefix (pretty_printer *);
+extern int pp_remaining_character_count_for_line (pretty_printer *);
+extern void pp_clear_output_area (pretty_printer *);
+extern const char *pp_formatted_text (pretty_printer *);
+extern const char *pp_last_position_in_text (const pretty_printer *);
+extern void pp_emit_prefix (pretty_printer *);
+extern void pp_append_text (pretty_printer *, const char *, const char *);
 
 /* If we haven't already defined a front-end-specific diagnostics
    style, use the generic one.  */
@@ -343,18 +314,18 @@
 
 extern void pp_verbatim (pretty_printer *, const char *, ...)
      ATTRIBUTE_GCC_PPDIAG(2,3);
-extern void pp_base_flush (pretty_printer *);
-extern void pp_base_format (pretty_printer *, text_info *);
-extern void pp_base_output_formatted_text (pretty_printer *);
-extern void pp_base_format_verbatim (pretty_printer *, text_info *);
+extern void pp_flush (pretty_printer *);
+extern void pp_format (pretty_printer *, text_info *);
+extern void pp_output_formatted_text (pretty_printer *);
+extern void pp_format_verbatim (pretty_printer *, text_info *);
 
-extern void pp_base_indent (pretty_printer *);
-extern void pp_base_newline (pretty_printer *);
-extern void pp_base_character (pretty_printer *, int);
-extern void pp_base_string (pretty_printer *, const char *);
+extern void pp_indent (pretty_printer *);
+extern void pp_newline (pretty_printer *);
+extern void pp_character (pretty_printer *, int);
+extern void pp_string (pretty_printer *, const char *);
 extern void pp_write_text_to_stream (pretty_printer *);
 extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool);
-extern void pp_base_maybe_space (pretty_printer *);
+extern void pp_maybe_space (pretty_printer *);
 
 /* Switch into verbatim mode and return the old mode.  */
 static inline pp_wrapping_mode_t
@@ -365,7 +336,7 @@
   pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
   return oldmode;
 }
-#define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP))
+#define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (PP)
 
 extern const char *identifier_to_locale (const char *);
 extern void *(*identifier_to_locale_alloc) (size_t);
Index: sched-vis.c
===================================================================
--- sched-vis.c	(revision 201478)
+++ sched-vis.c	(working copy)
@@ -859,7 +859,7 @@
 {
   pretty_printer *pp = init_rtl_slim_pretty_print (NULL);
   print_pattern (pp, x, 0);
-  return pp_base_formatted_text (pp);
+  return pp_formatted_text (pp);
 }
 
 /* Emit a slim dump of X (an insn) to stderr.  */
Index: tree-mudflap.c
===================================================================
--- tree-mudflap.c	(revision 201478)
+++ tree-mudflap.c	(working copy)
@@ -190,7 +190,7 @@
   }
 
   /* Return the lot as a new STRING_CST.  */
-  buf_contents = pp_base_formatted_text (buf);
+  buf_contents = pp_formatted_text (buf);
   result = mf_build_string (buf_contents);
   pp_clear_output_area (buf);
 
Index: tree-pretty-print.c
===================================================================
--- tree-pretty-print.c	(revision 201478)
+++ tree-pretty-print.c	(working copy)
@@ -3112,7 +3112,7 @@
 /* Print the identifier ID to PRETTY-PRINTER.  */
 
 void
-pp_base_tree_identifier (pretty_printer *pp, tree id)
+pp_tree_identifier (pretty_printer *pp, tree id)
 {
   if (pp_translate_identifiers (pp))
     {
Index: tree-pretty-print.h
===================================================================
--- tree-pretty-print.h	(revision 201478)
+++ tree-pretty-print.h	(working copy)
@@ -24,16 +24,13 @@
 
 #include "pretty-print.h"
 
-#define pp_tree_identifier(PP, T)                      \
-  pp_base_tree_identifier (pp_base (PP), T)
-
 #define pp_unsupported_tree(PP, T)                         \
-  pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \
+  pp_verbatim (PP, "#%qs not supported by %s#", \
                tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
 
 #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data)
 
-extern void pp_base_tree_identifier (pretty_printer *, tree);
+extern void pp_tree_identifier (pretty_printer *, tree);
 
 /* In tree-pretty-print.c  */
 extern void print_declaration (pretty_printer *, tree, int, int);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]