diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-05 04:00:57 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-05 04:00:57 +0000 |
commit | a94db6b0a116d260b158bae8122eb4d7815f3451 (patch) | |
tree | 2a3052c426aacb44697e1d70381e8bd33a240377 /gcc/c-family | |
parent | a1622d9af9b63eb9a6fb061fc3e35b3480060007 (diff) | |
download | gcc-a94db6b0a116d260b158bae8122eb4d7815f3451.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201479 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/c-family/c-pretty-print.c | 42 | ||||
-rw-r--r-- | gcc/c-family/c-pretty-print.h | 110 |
3 files changed, 84 insertions, 94 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index d8ca539b3fc..d985360365e 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,29 @@ +2013-08-04 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * 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. + 2013-08-04 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/58072 diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 0a71ecee6e1..a453117ea34 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see #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 @@ void 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 @@ pp_c_direct_declarator (c_pretty_printer *pp, tree t) 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_ws_string (c_pretty_printer *pp, const char *str) { 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_identifier (c_pretty_printer *pp, const char *id) { 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 @@ pp_c_statement (c_pretty_printer *pp, tree stmt) 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 @@ print_c_tree (FILE *file, tree t) 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); diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index 04b72c49d1a..390477d289e 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -26,35 +26,29 @@ along with GCC; see the file COPYING3. If not see #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,70 +85,40 @@ struct c_pretty_print_info 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); - -#define pp_statement(PPI, S) \ - pp_c_base (PPI)->statement (pp_c_base (PPI), 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) - - -/* 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) + (PP)->storage_class_specifier (PP, D); + +#define pp_statement(PP, S) (PP)->statement (PP, S) + +#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) + extern void pp_c_pretty_printer_init (c_pretty_printer *); void pp_c_whitespace (c_pretty_printer *); |