aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@integrable-solutions.net>2013-08-30 15:28:51 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2013-08-30 15:28:51 +0000
commit8f0e4d72f2905596ecb212e8824a0a0e1489bab8 (patch)
tree40b3409f70bac07a020c641005859d39639f0f47 /gcc/c-family
parentdc8d7a0f7bbd5d24ba74066ea7d0262f7f732774 (diff)
downloadgcc-8f0e4d72f2905596ecb212e8824a0a0e1489bab8.zip
gcc-8f0e4d72f2905596ecb212e8824a0a0e1489bab8.tar.gz
gcc-8f0e4d72f2905596ecb212e8824a0a0e1489bab8.tar.bz2
c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function.
c-family/ * c-pretty-print.h (c_pretty_printer::declaration): Now a virtual member function. (c_pretty_printer::declaration_specifiers): Likewise. (c_pretty_printer::declarator): Likewise. (c_pretty_printer::abstract_declarator): Likewise. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::direct_declarator): Likewise. (c_pretty_printer::function_specifier): Likewise. (pp_declaration): Adjust. (pp_declaration_specifiers): Likewise. (pp_abstract_declarator): Likewise. (pp_direct_declarator): Likewise. (pp_function_specifier): Likewise. (pp_direct_abstract_declarator): Remove as unused. (pp_c_declaration): Remove. (pp_c_declaration_specifiers): Likewise. (pp_c_declarator): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_function_specifier): Likewise. (pp_c_direct_abstract_declarator): Likewise. * c-pretty-print.c (c_pretty_printer::abstract_declarator): Rename from pp_c_abstract_declarator. Adjust. (c_pretty_printer::direct_abstract_declarator): Rename from pp_c_direct_abstract_declarator. Adjust. (c_pretty_printer::function_specifier): Rename from pp_c_function_specifier. Adjust. (c_pretty_printer::declaration_specifiers): Rename from pp_c_declaration_specifiers. Adjust. (c_pretty_printer::direct_declarator): Rename from pp_c_direct_declarator. Adjust. (c_pretty_printer::declarator): Rename from pp_c_declarator. Adjust. (c_pretty_printer::declaration): Rename from pp_c_declaration. Adjust. (c_pretty_printer::c_pretty_printer): Do not assign to declaration, declaration_specifiers, declarator, direct_declarator, direct_abstract_declarator, function_specifier. cp/ * cxx-pretty-print.h (cxx_pretty_printer::declaration): Declare as overrider. (cxx_pretty_printer::declaration_specifiers): Likewise. (cxx_pretty_printer::function_specifier): Likewise. (cxx_pretty_printer::declarator): Likewise. (cxx_pretty_printer::direct_declarator): Likewise. (cxx_pretty_printer::abstract_declarator): Likewise. (cxx_pretty_printer::direct_abstract_declarator): Likewise. (pp_cxx_declaration): Remove. * cxx-pretty-print.c (cxx_pretty_printer::function_specifier): Rename from pp_cxx_function_specifier. Adjust. (cxx_pretty_printer::declaration_specifiers): Rename from pp_cxx_decl_specifier_seq. Adjust. (cxx_pretty_printer::direct_declarator): Rename from pp_cxx_direct_declarator. Adjust. (cxx_pretty_printer::declarator): Rename from pp_cxx_declarator. Adjust. (cxx_pretty_printer::abstract_declarator): Rename from pp_cxx_abstract_declarator. Adjust. (cxx_pretty_printer::direct_abstract_declarator): Rename from pp_cxx_direct_abstract_declarator. Adjust. (cxx_pretty_printer::declaration): Rename from pp_cxx_declaration. Adjust. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to declaration, declaration_specifiers, function_specifier, declarator, direct_declarator, abstract_declarator, direct_abstract_declarator. * error.c (dump_decl): Adjust. From-SVN: r202109
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog38
-rw-r--r--gcc/c-family/c-pretty-print.c87
-rw-r--r--gcc/c-family/c-pretty-print.h34
3 files changed, 91 insertions, 68 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index c656276..c8bf2df 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,41 @@
+2013-08-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * c-pretty-print.h (c_pretty_printer::declaration): Now a virtual
+ member function.
+ (c_pretty_printer::declaration_specifiers): Likewise.
+ (c_pretty_printer::declarator): Likewise.
+ (c_pretty_printer::abstract_declarator): Likewise.
+ (c_pretty_printer::direct_abstract_declarator): Likewise.
+ (c_pretty_printer::direct_declarator): Likewise.
+ (c_pretty_printer::function_specifier): Likewise.
+ (pp_declaration): Adjust.
+ (pp_declaration_specifiers): Likewise.
+ (pp_abstract_declarator): Likewise.
+ (pp_direct_declarator): Likewise.
+ (pp_function_specifier): Likewise.
+ (pp_direct_abstract_declarator): Remove as unused.
+ (pp_c_declaration): Remove.
+ (pp_c_declaration_specifiers): Likewise.
+ (pp_c_declarator): Likewise.
+ (pp_c_direct_declarator): Likewise.
+ (pp_c_function_specifier): Likewise.
+ (pp_c_direct_abstract_declarator): Likewise.
+ * c-pretty-print.c (c_pretty_printer::abstract_declarator): Rename
+ from pp_c_abstract_declarator. Adjust.
+ (c_pretty_printer::direct_abstract_declarator): Rename from
+ pp_c_direct_abstract_declarator. Adjust.
+ (c_pretty_printer::function_specifier): Rename from
+ pp_c_function_specifier. Adjust.
+ (c_pretty_printer::declaration_specifiers): Rename from
+ pp_c_declaration_specifiers. Adjust.
+ (c_pretty_printer::direct_declarator): Rename from
+ pp_c_direct_declarator. Adjust.
+ (c_pretty_printer::declarator): Rename from pp_c_declarator. Adjust.
+ (c_pretty_printer::declaration): Rename from pp_c_declaration. Adjust.
+ (c_pretty_printer::c_pretty_printer): Do not assign to
+ declaration, declaration_specifiers, declarator,
+ direct_declarator, direct_abstract_declarator, function_specifier.
+
2013-08-26 Gabriel Dos Reis <gdre@integrable-solutions.net>
* c-pretty-print.h (c_pretty_printer::unary_expression): Now a
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 6d0c406..c50b068 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -431,7 +431,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
function declarations, this routine prints not just the
specifier-qualifier-list of such entities or types of such entities,
but also the 'pointer' production part of their declarators. The
- remaining part is done by pp_declarator or pp_c_abstract_declarator. */
+ remaining part is done by pp_declarator or pp_abstract_declarator. */
void
pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
@@ -533,18 +533,18 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
pointer
pointer(opt) direct-abstract-declarator */
-static void
-pp_c_abstract_declarator (c_pretty_printer *pp, tree t)
+void
+c_pretty_printer::abstract_declarator (tree t)
{
if (TREE_CODE (t) == POINTER_TYPE)
{
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- pp_c_right_paren (pp);
+ pp_c_right_paren (this);
t = TREE_TYPE (t);
}
- pp_direct_abstract_declarator (pp, t);
+ direct_abstract_declarator (t);
}
/* direct-abstract-declarator:
@@ -554,34 +554,34 @@ pp_c_abstract_declarator (c_pretty_printer *pp, tree t)
direct-abstract-declarator(opt) ( parameter-type-list(opt) ) */
void
-pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t)
+c_pretty_printer::direct_abstract_declarator (tree t)
{
switch (TREE_CODE (t))
{
case POINTER_TYPE:
- pp_abstract_declarator (pp, t);
+ abstract_declarator (t);
break;
case FUNCTION_TYPE:
- pp_c_parameter_type_list (pp, t);
- pp_direct_abstract_declarator (pp, TREE_TYPE (t));
+ pp_c_parameter_type_list (this, t);
+ direct_abstract_declarator (TREE_TYPE (t));
break;
case ARRAY_TYPE:
- pp_c_left_bracket (pp);
+ pp_c_left_bracket (this);
if (TYPE_DOMAIN (t) && TYPE_MAX_VALUE (TYPE_DOMAIN (t)))
{
tree maxval = TYPE_MAX_VALUE (TYPE_DOMAIN (t));
tree type = TREE_TYPE (maxval);
if (host_integerp (maxval, 0))
- pp_wide_integer (pp, tree_low_cst (maxval, 0) + 1);
+ pp_wide_integer (this, tree_low_cst (maxval, 0) + 1);
else
- pp_expression (pp, fold_build2 (PLUS_EXPR, type, maxval,
+ pp_expression (this, fold_build2 (PLUS_EXPR, type, maxval,
build_int_cst (type, 1)));
}
- pp_c_right_bracket (pp);
- pp_direct_abstract_declarator (pp, TREE_TYPE (t));
+ pp_c_right_bracket (this);
+ direct_abstract_declarator (TREE_TYPE (t));
break;
case IDENTIFIER_NODE:
@@ -599,7 +599,7 @@ pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t)
break;
default:
- pp_unsupported_tree (pp, t);
+ pp_unsupported_tree (this, t);
break;
}
}
@@ -639,10 +639,10 @@ pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
inline */
void
-pp_c_function_specifier (c_pretty_printer *pp, tree t)
+c_pretty_printer::function_specifier (tree t)
{
if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t))
- pp_c_ws_string (pp, "inline");
+ pp_c_ws_string (this, "inline");
}
/* declaration-specifiers:
@@ -652,11 +652,11 @@ pp_c_function_specifier (c_pretty_printer *pp, tree t)
function-specifier declaration-specifiers(opt) */
void
-pp_c_declaration_specifiers (c_pretty_printer *pp, tree t)
+c_pretty_printer::declaration_specifiers (tree t)
{
- pp_storage_class_specifier (pp, t);
- pp_function_specifier (pp, t);
- pp_c_specifier_qualifier_list (pp, DECL_P (t) ? TREE_TYPE (t) : t);
+ pp_storage_class_specifier (this, t);
+ pp_function_specifier (this, t);
+ pp_c_specifier_qualifier_list (this, DECL_P (t) ? TREE_TYPE (t) : t);
}
/* direct-declarator
@@ -670,7 +670,7 @@ pp_c_declaration_specifiers (c_pretty_printer *pp, tree t)
direct-declarator ( identifier-list(opt) ) */
void
-pp_c_direct_declarator (c_pretty_printer *pp, tree t)
+c_pretty_printer::direct_declarator (tree t)
{
switch (TREE_CODE (t))
{
@@ -679,29 +679,29 @@ pp_c_direct_declarator (c_pretty_printer *pp, tree t)
case TYPE_DECL:
case FIELD_DECL:
case LABEL_DECL:
- pp_c_space_for_pointer_operator (pp, TREE_TYPE (t));
- pp_c_tree_decl_identifier (pp, t);
+ pp_c_space_for_pointer_operator (this, TREE_TYPE (t));
+ pp_c_tree_decl_identifier (this, t);
break;
case ARRAY_TYPE:
case POINTER_TYPE:
- pp_abstract_declarator (pp, TREE_TYPE (t));
+ abstract_declarator (TREE_TYPE (t));
break;
case FUNCTION_TYPE:
- pp_parameter_list (pp, t);
- pp_abstract_declarator (pp, TREE_TYPE (t));
+ pp_parameter_list (this, t);
+ abstract_declarator (TREE_TYPE (t));
break;
case FUNCTION_DECL:
- pp_c_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
- pp_c_tree_decl_identifier (pp, t);
- if (pp->flags & pp_c_flag_abstract)
- pp_abstract_declarator (pp, TREE_TYPE (t));
+ pp_c_space_for_pointer_operator (this, TREE_TYPE (TREE_TYPE (t)));
+ pp_c_tree_decl_identifier (this, t);
+ if (flags & pp_c_flag_abstract)
+ abstract_declarator (TREE_TYPE (t));
else
{
- pp_parameter_list (pp, t);
- pp_abstract_declarator (pp, TREE_TYPE (TREE_TYPE (t)));
+ pp_parameter_list (this, t);
+ abstract_declarator (TREE_TYPE (TREE_TYPE (t)));
}
break;
@@ -714,7 +714,7 @@ pp_c_direct_declarator (c_pretty_printer *pp, tree t)
break;
default:
- pp_unsupported_tree (pp, t);
+ pp_unsupported_tree (this, t);
break;
}
}
@@ -724,7 +724,7 @@ pp_c_direct_declarator (c_pretty_printer *pp, tree t)
pointer(opt) direct-declarator */
void
-pp_c_declarator (c_pretty_printer *pp, tree t)
+c_pretty_printer::declarator (tree t)
{
switch (TREE_CODE (t))
{
@@ -743,12 +743,12 @@ pp_c_declarator (c_pretty_printer *pp, tree t)
case FUNCTION_TYPE:
case FUNCTION_DECL:
case TYPE_DECL:
- pp_direct_declarator (pp, t);
+ pp_direct_declarator (this, t);
break;
default:
- pp_unsupported_tree (pp, t);
+ pp_unsupported_tree (this, t);
break;
}
}
@@ -757,10 +757,10 @@ pp_c_declarator (c_pretty_printer *pp, tree t)
declaration-specifiers init-declarator-list(opt) ; */
void
-pp_c_declaration (c_pretty_printer *pp, tree t)
+c_pretty_printer::declaration (tree t)
{
- pp_declaration_specifiers (pp, t);
- pp_c_init_declarator (pp, t);
+ declaration_specifiers (t);
+ pp_c_init_declarator (this, t);
}
/* Pretty-print ATTRIBUTES using GNU C extension syntax. */
@@ -2325,18 +2325,11 @@ c_pretty_printer::c_pretty_printer ()
{
offset_list = 0;
flags = 0;
- declaration = pp_c_declaration;
- declaration_specifiers = pp_c_declaration_specifiers;
- declarator = pp_c_declarator;
- direct_declarator = pp_c_direct_declarator;
type_specifier_seq = pp_c_specifier_qualifier_list;
- abstract_declarator = pp_c_abstract_declarator;
- direct_abstract_declarator = pp_c_direct_abstract_declarator;
ptr_operator = pp_c_pointer;
parameter_list = pp_c_parameter_type_list;
type_id = pp_c_type_id;
simple_type_specifier = pp_c_type_specifier;
- function_specifier = pp_c_function_specifier;
storage_class_specifier = pp_c_storage_class_specifier;
initializer = pp_c_initializer;
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index 62492c3..4ab420d 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -66,6 +66,13 @@ struct c_pretty_printer : pretty_printer
virtual void statement (tree);
+ virtual void declaration (tree);
+ virtual void declaration_specifiers (tree);
+ virtual void function_specifier (tree);
+ virtual void declarator (tree);
+ virtual void direct_declarator (tree);
+ virtual void abstract_declarator (tree);
+ virtual void direct_abstract_declarator (tree);
/* Points to the first element of an array of offset-list.
Not used yet. */
int *offset_list;
@@ -74,18 +81,11 @@ struct c_pretty_printer : pretty_printer
/* These must be overridden by each of the C and C++ front-end to
reflect their understanding of syntactic productions when they differ. */
- c_pretty_print_fn declaration;
- c_pretty_print_fn declaration_specifiers;
- c_pretty_print_fn declarator;
- c_pretty_print_fn abstract_declarator;
- c_pretty_print_fn direct_abstract_declarator;
c_pretty_print_fn type_specifier_seq;
- c_pretty_print_fn direct_declarator;
c_pretty_print_fn ptr_operator;
c_pretty_print_fn parameter_list;
c_pretty_print_fn type_id;
c_pretty_print_fn simple_type_specifier;
- c_pretty_print_fn function_specifier;
c_pretty_print_fn storage_class_specifier;
c_pretty_print_fn initializer;
@@ -94,20 +94,18 @@ struct c_pretty_printer : pretty_printer
#define pp_c_tree_identifier(PPI, ID) \
pp_c_identifier (PPI, IDENTIFIER_POINTER (ID))
-#define pp_declaration(PP, T) (PP)->declaration (PP, T)
+#define pp_declaration(PP, T) (PP)->declaration (T)
#define pp_declaration_specifiers(PP, D) \
- (PP)->declaration_specifiers (PP, D)
-#define pp_abstract_declarator(PP, D) (PP)->abstract_declarator (PP, D)
+ (PP)->declaration_specifiers (D)
+#define pp_abstract_declarator(PP, D) (PP)->abstract_declarator (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)->direct_abstract_declarator (PP, D)
+#define pp_declarator(PP, D) (PP)->declarator (D)
+#define pp_direct_declarator(PP, D) (PP)->direct_declarator (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_function_specifier(PP, D) (PP)->function_specifier (D)
#define pp_storage_class_specifier(PP, D) \
(PP)->storage_class_specifier (PP, D);
@@ -150,14 +148,8 @@ void pp_c_attributes_display (c_pretty_printer *, tree);
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_declaration (c_pretty_printer *, tree);
-void pp_c_declaration_specifiers (c_pretty_printer *, tree);
-void pp_c_declarator (c_pretty_printer *, tree);
-void pp_c_direct_declarator (c_pretty_printer *, tree);
void pp_c_specifier_qualifier_list (c_pretty_printer *, tree);
-void pp_c_function_specifier (c_pretty_printer *, tree);
void pp_c_type_id (c_pretty_printer *, tree);
-void pp_c_direct_abstract_declarator (c_pretty_printer *, tree);
void pp_c_type_specifier (c_pretty_printer *, tree);
void pp_c_storage_class_specifier (c_pretty_printer *, tree);
/* Expressions. */