diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2013-09-04 10:52:35 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2013-09-04 10:52:35 +0000 |
commit | 7c26172cf755ee765e45e8c0b3a8313a86995fe8 (patch) | |
tree | 0fe4c66827ae72052a1e69520bb44f84627eeace | |
parent | 5f3783a66971f26fd9b6e6e1fbfc6b9c030a7c6f (diff) | |
download | gcc-7c26172cf755ee765e45e8c0b3a8313a86995fe8.zip gcc-7c26172cf755ee765e45e8c0b3a8313a86995fe8.tar.gz gcc-7c26172cf755ee765e45e8c0b3a8313a86995fe8.tar.bz2 |
c-pretty-print.h (c_pretty_printer::simple_type_specifier): Now a virtual member function.
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.
From-SVN: r202247
-rw-r--r-- | gcc/c-family/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/c-family/c-pretty-print.c | 54 | ||||
-rw-r--r-- | gcc/c-family/c-pretty-print.h | 4 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 19 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.h | 1 |
6 files changed, 59 insertions, 39 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4917acf..2a0c406 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2013-09-04 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * 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. + 2013-09-03 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-pretty-print.h (c_pretty_printer::type_id): Now a virtual diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 9d115a4..d0283e8 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -305,7 +305,10 @@ pp_c_pointer (c_pretty_printer *pp, tree t) } } -/* type-specifier: +/* simple-type-specifier: + type-specifier + + type-specifier: void char short @@ -328,17 +331,17 @@ pp_c_pointer (c_pretty_printer *pp, tree t) __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 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) if (TYPE_NAME (t)) { t = TYPE_NAME (t); - pp_c_type_specifier (pp, t); + simple_type_specifier (t); } else { @@ -360,11 +363,11 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) 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 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) 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 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t) 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 @@ c_pretty_printer::c_pretty_printer () 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; } diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index 21aeda6..aa046e5 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -69,6 +69,7 @@ struct c_pretty_printer : pretty_printer 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 @@ struct c_pretty_printer : pretty_printer 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 @@ struct c_pretty_printer : pretty_printer #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_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type); 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); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c28f114..db4cd66 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2013-09-04 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * 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. + 2013-09-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58305 diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index c769feb..4578a5b 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1249,32 +1249,32 @@ cxx_pretty_printer::declaration_specifiers (tree t) 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 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t) 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 @@ cxx_pretty_printer::cxx_pretty_printer () 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; } diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 2b48dd5..819bbac 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -46,6 +46,7 @@ struct cxx_pretty_printer : c_pretty_printer 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); |