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/pretty-print.h | |
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/pretty-print.h')
-rw-r--r-- | gcc/pretty-print.h | 115 |
1 files changed, 43 insertions, 72 deletions
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 71489e6ad70..95577063da5 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -29,30 +29,30 @@ along with GCC; see the file COPYING3. If not see /* 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 @@ struct chunk_info /* 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 @@ typedef struct /* 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 @@ typedef struct /* 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 @@ typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *, 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,33 +202,8 @@ struct pretty_print_info 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) - -#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)) +pp_get_prefix (const pretty_printer *pp) { return pp->prefix; } #define pp_space(PP) pp_character (PP, ' ') #define pp_left_paren(PP) pp_character (PP, '(') @@ -275,12 +250,11 @@ pp_base_get_prefix (const pretty_printer *pp) { return pp->prefix; } 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 @@ pp_base_get_prefix (const pretty_printer *pp) { return pp->prefix; } : (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_printf (pretty_printer *, const char *, ...) 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_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_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_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_set_verbatim_wrapping_ (pretty_printer *pp) 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); |