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

-- Gaby

2013-09-04  Gabriel Dos Reis  <g...@integrable-solutions.net>
c-family/
        * c-pretty-print.h (c_pretty_printer::simple_type_specifier): Now
        a virtual member function.
        (pp_simple_type_specifier): Remove.
        (pp_c_type_specifier): Likewise.
        * c-pretty-print.c (c_pretty_printer::simple_type_specifier):
        Rename from pp_c_type_specifier.  Adjust.
        (c_pretty_printer::c_pretty_printer): Do not assign to
        simple_type_specifier.
cp/
        * cxx-pretty-print.h (cxx_pretty_printer::simple_type_specifier):
        Declare as overrider.
        * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier):
        Rename from pp_cxx_simple_type_specifier.
        (cxx_pretty_printer::cxx_pretty_printer): Do not assign to
        simple_type_specifier.

Index: c-family/c-pretty-print.c
===================================================================
--- c-family/c-pretty-print.c   (revision 202240)
+++ c-family/c-pretty-print.c   (working copy)
@@ -305,7 +305,10 @@
     }
 }
 
-/* type-specifier:
+/* simple-type-specifier:
+     type-specifier
+
+   type-specifier:
       void
       char
       short
@@ -328,17 +331,17 @@
       __vector__   */
 
 void
-pp_c_type_specifier (c_pretty_printer *pp, tree t)
+c_pretty_printer::simple_type_specifier (tree t)
 {
   const enum tree_code code = TREE_CODE (t);
   switch (code)
     {
     case ERROR_MARK:
-      pp->translate_string ("<type-error>");
+      translate_string ("<type-error>");
       break;
 
     case IDENTIFIER_NODE:
-      pp_c_identifier (pp, IDENTIFIER_POINTER (t));
+      pp_c_identifier (this, IDENTIFIER_POINTER (t));
       break;
 
     case VOID_TYPE:
@@ -349,7 +352,7 @@
       if (TYPE_NAME (t))
        {
          t = TYPE_NAME (t);
-         pp_c_type_specifier (pp, t);
+         simple_type_specifier (t);
        }
       else
        {
@@ -360,11 +363,11 @@
            t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t));
          if (TYPE_NAME (t))
            {
-             pp_c_type_specifier (pp, t);
+             simple_type_specifier (t);
              if (TYPE_PRECISION (t) != prec)
                {
-                 pp_colon (pp);
-                 pp_decimal_int (pp, prec);
+                 pp_colon (this);
+                 pp_decimal_int (this, prec);
                }
            }
          else
@@ -372,52 +375,52 @@
              switch (code)
                {
                case INTEGER_TYPE:
-                 pp->translate_string (TYPE_UNSIGNED (t)
-                                        ? "<unnamed-unsigned:"
-                                        : "<unnamed-signed:");
+                 translate_string (TYPE_UNSIGNED (t)
+                                    ? "<unnamed-unsigned:"
+                                    : "<unnamed-signed:");
                  break;
                case REAL_TYPE:
-                 pp->translate_string ("<unnamed-float:");
+                 translate_string ("<unnamed-float:");
                  break;
                case FIXED_POINT_TYPE:
-                 pp->translate_string ("<unnamed-fixed:");
+                 translate_string ("<unnamed-fixed:");
                  break;
                default:
                  gcc_unreachable ();
                }
-             pp_decimal_int (pp, prec);
-             pp_greater (pp);
+             pp_decimal_int (this, prec);
+             pp_greater (this);
            }
        }
       break;
 
     case TYPE_DECL:
       if (DECL_NAME (t))
-       pp->id_expression (t);
+       id_expression (t);
       else
-       pp->translate_string ("<typedef-error>");
+       translate_string ("<typedef-error>");
       break;
 
     case UNION_TYPE:
     case RECORD_TYPE:
     case ENUMERAL_TYPE:
       if (code == UNION_TYPE)
-       pp_c_ws_string (pp, "union");
+       pp_c_ws_string (this, "union");
       else if (code == RECORD_TYPE)
-       pp_c_ws_string (pp, "struct");
+       pp_c_ws_string (this, "struct");
       else if (code == ENUMERAL_TYPE)
-       pp_c_ws_string (pp, "enum");
+       pp_c_ws_string (this, "enum");
       else
-       pp->translate_string ("<tag-error>");
+       translate_string ("<tag-error>");
 
       if (TYPE_NAME (t))
-       pp->id_expression (TYPE_NAME (t));
+       id_expression (TYPE_NAME (t));
       else
-       pp->translate_string ("<anonymous>");
+       translate_string ("<anonymous>");
       break;
 
     default:
-      pp_unsupported_tree (pp, t);
+      pp_unsupported_tree (this, t);
       break;
     }
 }
@@ -483,7 +486,7 @@
       break;
 
     default:
-      pp_simple_type_specifier (pp, t);
+      pp->simple_type_specifier (t);
       break;
     }
   if ((pp->flags & pp_c_flag_gnu_v3) && code != POINTER_TYPE)
@@ -2328,7 +2331,6 @@
   type_specifier_seq        = pp_c_specifier_qualifier_list;
   ptr_operator              = pp_c_pointer;
   parameter_list            = pp_c_parameter_type_list;
-  simple_type_specifier     = pp_c_type_specifier;
 }
 
 
Index: c-family/c-pretty-print.h
===================================================================
--- c-family/c-pretty-print.h   (revision 202240)
+++ c-family/c-pretty-print.h   (working copy)
@@ -69,6 +69,7 @@
 
   virtual void declaration (tree);
   virtual void declaration_specifiers (tree);
+  virtual void simple_type_specifier (tree);
   virtual void function_specifier (tree);
   virtual void storage_class_specifier (tree);
   virtual void declarator (tree);
@@ -88,7 +89,6 @@
   c_pretty_print_fn type_specifier_seq;
   c_pretty_print_fn ptr_operator;
   c_pretty_print_fn parameter_list;
-  c_pretty_print_fn simple_type_specifier;
 };
 
 #define pp_c_tree_identifier(PPI, ID)              \
@@ -97,7 +97,6 @@
 #define pp_type_specifier_seq(PP, D)    (PP)->type_specifier_seq (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_simple_type_specifier(PP, T) (PP)->simple_type_specifier (PP, T)
 
 void pp_c_whitespace (c_pretty_printer *);
 void pp_c_left_paren (c_pretty_printer *);
@@ -124,7 +123,6 @@
 void pp_c_type_qualifier_list (c_pretty_printer *, tree);
 void pp_c_parameter_type_list (c_pretty_printer *, tree);
 void pp_c_specifier_qualifier_list (c_pretty_printer *, tree);
-void pp_c_type_specifier (c_pretty_printer *, tree);
 /* Expressions.  */
 void pp_c_logical_or_expression (c_pretty_printer *, tree);
 void pp_c_expression_list (c_pretty_printer *, tree);
Index: cp/cxx-pretty-print.c
===================================================================
--- cp/cxx-pretty-print.c       (revision 202240)
+++ cp/cxx-pretty-print.c       (working copy)
@@ -1249,32 +1249,32 @@
       double
       void  */
 
-static void
-pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
+void
+cxx_pretty_printer::simple_type_specifier (tree t)
 {
   switch (TREE_CODE (t))
     {
     case RECORD_TYPE:
     case UNION_TYPE:
     case ENUMERAL_TYPE:
-      pp_cxx_qualified_id (pp, t);
+      pp_cxx_qualified_id (this, t);
       break;
 
     case TEMPLATE_TYPE_PARM:
     case TEMPLATE_TEMPLATE_PARM:
     case TEMPLATE_PARM_INDEX:
     case BOUND_TEMPLATE_TEMPLATE_PARM:
-      pp_cxx_unqualified_id (pp, t);
+      pp_cxx_unqualified_id (this, t);
       break;
 
     case TYPENAME_TYPE:
-      pp_cxx_ws_string (pp, "typename");
-      pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
-      pp_cxx_unqualified_id (pp, TYPE_NAME (t));
+      pp_cxx_ws_string (this, "typename");
+      pp_cxx_nested_name_specifier (this, TYPE_CONTEXT (t));
+      pp_cxx_unqualified_id (this, TYPE_NAME (t));
       break;
 
     default:
-      pp_c_type_specifier (pp, t);
+      c_pretty_printer::simple_type_specifier (t);
       break;
     }
 }
@@ -1300,7 +1300,7 @@
     case TYPE_DECL:
     case BOUND_TEMPLATE_TEMPLATE_PARM:
       pp_cxx_cv_qualifier_seq (pp, t);
-      pp_cxx_simple_type_specifier (pp, t);
+      pp->simple_type_specifier (t);
       break;
 
     case METHOD_TYPE:
@@ -2427,5 +2427,4 @@
 
   type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
   parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
-  simple_type_specifier = (pp_fun) pp_cxx_simple_type_specifier;
 }
Index: cp/cxx-pretty-print.h
===================================================================
--- cp/cxx-pretty-print.h       (revision 202240)
+++ cp/cxx-pretty-print.h       (working copy)
@@ -46,6 +46,7 @@
   void statement (tree);
   void declaration (tree);
   void declaration_specifiers (tree);
+  void simple_type_specifier (tree);
   void function_specifier (tree);
   void declarator (tree);
   void direct_declarator (tree);

Reply via email to