GCC Middle and Back End API Reference
pretty-print.h File Reference
#include "obstack.h"
#include "rich-location.h"
#include "diagnostic-url.h"
Include dependency graph for pretty-print.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  text_info
 
struct  chunk_info
 
class  output_buffer
 
struct  pp_wrapping_mode_t
 
class  format_postprocessor
 
class  pretty_printer
 

Macros

#define PP_NL_ARGMAX   30
 
#define pp_line_cutoff(PP)   (PP)->wrapping.line_cutoff
 
#define pp_prefixing_rule(PP)   (PP)->wrapping.rule
 
#define pp_wrapping_mode(PP)   (PP)->wrapping
 
#define pp_format_decoder(PP)   (PP)->format_decoder
 
#define pp_needs_newline(PP)   (PP)->need_newline
 
#define pp_is_wrapping_line(PP)   (pp_line_cutoff (PP) > 0)
 
#define pp_indentation(PP)   (PP)->indent_skip
 
#define pp_translate_identifiers(PP)   (PP)->translate_identifiers
 
#define pp_show_color(PP)   (PP)->show_color
 
#define pp_space(PP)   pp_character (PP, ' ')
 
#define pp_left_paren(PP)   pp_character (PP, '(')
 
#define pp_right_paren(PP)   pp_character (PP, ')')
 
#define pp_left_bracket(PP)   pp_character (PP, '[')
 
#define pp_right_bracket(PP)   pp_character (PP, ']')
 
#define pp_left_brace(PP)   pp_character (PP, '{')
 
#define pp_right_brace(PP)   pp_character (PP, '}')
 
#define pp_semicolon(PP)   pp_character (PP, ';')
 
#define pp_comma(PP)   pp_character (PP, ',')
 
#define pp_dot(PP)   pp_character (PP, '.')
 
#define pp_colon(PP)   pp_character (PP, ':')
 
#define pp_colon_colon(PP)   pp_string (PP, "::")
 
#define pp_arrow(PP)   pp_string (PP, "->")
 
#define pp_equal(PP)   pp_character (PP, '=')
 
#define pp_question(PP)   pp_character (PP, '?')
 
#define pp_bar(PP)   pp_character (PP, '|')
 
#define pp_bar_bar(PP)   pp_string (PP, "||")
 
#define pp_carret(PP)   pp_character (PP, '^')
 
#define pp_ampersand(PP)   pp_character (PP, '&')
 
#define pp_ampersand_ampersand(PP)   pp_string (PP, "&&")
 
#define pp_less(PP)   pp_character (PP, '<')
 
#define pp_less_equal(PP)   pp_string (PP, "<=")
 
#define pp_greater(PP)   pp_character (PP, '>')
 
#define pp_greater_equal(PP)   pp_string (PP, ">=")
 
#define pp_plus(PP)   pp_character (PP, '+')
 
#define pp_minus(PP)   pp_character (PP, '-')
 
#define pp_star(PP)   pp_character (PP, '*')
 
#define pp_slash(PP)   pp_character (PP, '/')
 
#define pp_modulo(PP)   pp_character (PP, '%')
 
#define pp_exclamation(PP)   pp_character (PP, '!')
 
#define pp_complement(PP)   pp_character (PP, '~')
 
#define pp_quote(PP)   pp_character (PP, '\'')
 
#define pp_backquote(PP)   pp_character (PP, '`')
 
#define pp_doublequote(PP)   pp_character (PP, '"')
 
#define pp_underscore(PP)   pp_character (PP, '_')
 
#define pp_maybe_newline_and_indent(PP, N)    if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
 
#define pp_scalar(PP, FORMAT, SCALAR)
 
#define pp_decimal_int(PP, I)   pp_scalar (PP, "%d", I)
 
#define pp_unsigned_wide_integer(PP, I)    pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
 
#define pp_vrange(PP, R)
 
#define pp_double(PP, F)   pp_scalar (PP, "%f", F)
 
#define pp_pointer(PP, P)   pp_scalar (PP, "%p", P)
 
#define pp_identifier(PP, ID)
 
#define pp_buffer(PP)   (PP)->buffer
 
#define GCC_PPDIAG_STYLE   __gcc_diag__
 
#define ATTRIBUTE_GCC_PPDIAG(m, n)   ATTRIBUTE_NONNULL(m)
 
#define pp_set_verbatim_wrapping(PP)   pp_set_verbatim_wrapping_ (PP)
 

Typedefs

typedef unsigned int pp_flags
 
typedef bool(* printer_fn) (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, const char **)
 

Enumerations

enum  diagnostic_prefixing_rule_t { DIAGNOSTICS_SHOW_PREFIX_ONCE = 0x0 , DIAGNOSTICS_SHOW_PREFIX_NEVER = 0x1 , DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2 }
 
enum  pp_padding { pp_none , pp_before , pp_after }
 

Functions

const charoutput_buffer_formatted_text (output_buffer *buff)
 
void output_buffer_append_r (output_buffer *buff, const char *start, int length)
 
const charoutput_buffer_last_position_in_text (const output_buffer *buff)
 
const charpp_get_prefix (const pretty_printer *pp)
 
void pp_set_line_maximum_length (pretty_printer *, int)
 
void pp_set_prefix (pretty_printer *, char *)
 
charpp_take_prefix (pretty_printer *)
 
void pp_destroy_prefix (pretty_printer *)
 
int pp_remaining_character_count_for_line (pretty_printer *)
 
void pp_clear_output_area (pretty_printer *)
 
const charpp_formatted_text (pretty_printer *)
 
const charpp_last_position_in_text (const pretty_printer *)
 
void pp_emit_prefix (pretty_printer *)
 
void pp_append_text (pretty_printer *, const char *, const char *)
 
void pp_newline_and_flush (pretty_printer *)
 
void pp_newline_and_indent (pretty_printer *, int)
 
void pp_separate_with (pretty_printer *, char)
 
void pp_printf (pretty_printer *, const char *,...) ATTRIBUTE_GCC_PPDIAG(2
 
void void pp_verbatim (pretty_printer *, const char *,...) ATTRIBUTE_GCC_PPDIAG(2
 
void void void pp_flush (pretty_printer *)
 
void pp_really_flush (pretty_printer *)
 
void pp_format (pretty_printer *, text_info *, const urlifier *=nullptr)
 
void pp_output_formatted_text (pretty_printer *, const urlifier *=nullptr)
 
void pp_format_verbatim (pretty_printer *, text_info *)
 
void pp_indent (pretty_printer *)
 
void pp_newline (pretty_printer *)
 
void pp_character (pretty_printer *, int)
 
void pp_string (pretty_printer *, const char *)
 
void pp_unicode_character (pretty_printer *, unsigned)
 
void pp_write_text_to_stream (pretty_printer *)
 
void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool)
 
void pp_write_text_as_html_like_dot_to_stream (pretty_printer *pp)
 
void pp_maybe_space (pretty_printer *)
 
void pp_begin_quote (pretty_printer *, bool)
 
void pp_end_quote (pretty_printer *, bool)
 
void pp_begin_url (pretty_printer *pp, const char *url)
 
void pp_end_url (pretty_printer *pp)
 
pp_wrapping_mode_t pp_set_verbatim_wrapping_ (pretty_printer *pp)
 
const charidentifier_to_locale (const char *)
 
void pp_wide_integer (pretty_printer *pp, HOST_WIDE_INT i)
 
void pp_wide_int (pretty_printer *pp, const wide_int_ref &w, signop sgn)
 
template<unsigned int N, typename T >
void pp_wide_integer (pretty_printer *pp, const poly_int< N, T > &)
 

Variables

void *(* identifier_to_locale_alloc )(size_t)
 
void(* identifier_to_locale_free )(void *)
 

Macro Definition Documentation

◆ ATTRIBUTE_GCC_PPDIAG

#define ATTRIBUTE_GCC_PPDIAG ( m,
n )   ATTRIBUTE_NONNULL(m)
This header may be included before diagnostics-core.h, hence the duplicate
definitions to allow for GCC-specific formats.   

◆ GCC_PPDIAG_STYLE

#define GCC_PPDIAG_STYLE   __gcc_diag__
If we haven't already defined a front-end-specific diagnostics
style, use the generic one.   

◆ pp_ampersand

#define pp_ampersand ( PP)    pp_character (PP, '&')

◆ pp_ampersand_ampersand

#define pp_ampersand_ampersand ( PP)    pp_string (PP, "&&")

◆ pp_arrow

#define pp_arrow ( PP)    pp_string (PP, "->")

Referenced by dump_generic_node().

◆ pp_backquote

#define pp_backquote ( PP)    pp_character (PP, '`')

◆ pp_bar

#define pp_bar ( PP)    pp_character (PP, '|')

◆ pp_bar_bar

#define pp_bar_bar ( PP)    pp_string (PP, "||")

◆ pp_buffer

◆ pp_carret

#define pp_carret ( PP)    pp_character (PP, '^')

◆ pp_colon

◆ pp_colon_colon

#define pp_colon_colon ( PP)    pp_string (PP, "::")

Referenced by dump_generic_node().

◆ pp_comma

◆ pp_complement

#define pp_complement ( PP)    pp_character (PP, '~')

Referenced by dump_unary_rhs().

◆ pp_decimal_int

◆ pp_dot

#define pp_dot ( PP)    pp_character (PP, '.')

◆ pp_double

#define pp_double ( PP,
F )   pp_scalar (PP, "%f", F)

Referenced by pp_format().

◆ pp_doublequote

#define pp_doublequote ( PP)    pp_character (PP, '"')

◆ pp_equal

◆ pp_exclamation

#define pp_exclamation ( PP)    pp_character (PP, '!')

Referenced by dump_unary_rhs(), and print_pattern().

◆ pp_format_decoder

#define pp_format_decoder ( PP)    (PP)->format_decoder
Client supplied function used to decode formats.   

Referenced by digraph< GraphTraits >::dump_dot_to_file(), dump_pretty_printer::dump_pretty_printer(), and pp_format().

◆ pp_greater

◆ pp_greater_equal

#define pp_greater_equal ( PP)    pp_string (PP, ">=")

Referenced by dump_gimple_omp_for().

◆ pp_identifier

#define pp_identifier ( PP,
ID )
Value:
: (ID)))
@ ID
Definition gengtype.h:483
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
void pp_string(pretty_printer *, const char *)
Definition pretty-print.cc:2235
#define pp_translate_identifiers(PP)
Definition pretty-print.h:233
const char * identifier_to_locale(const char *)
Definition pretty-print.cc:2455

Referenced by default_tree_printer().

◆ pp_indentation

#define pp_indentation ( PP)    (PP)->indent_skip
The amount of whitespace to be emitted when starting a new line.   

Referenced by pp_clear_state(), pp_emit_prefix(), pp_indent(), pp_newline_and_indent(), pp_set_prefix(), json::object::print(), and json::array::print().

◆ pp_is_wrapping_line

#define pp_is_wrapping_line ( PP)    (pp_line_cutoff (PP) > 0)
True if PRETTY-PRINTER is in line-wrapping mode.   

Referenced by escaped_string::escape(), pp_append_text(), pp_character(), pp_maybe_wrap_text(), pp_set_real_maximum_length(), and pp_wrap_text().

◆ pp_left_brace

◆ pp_left_bracket

◆ pp_left_paren

◆ pp_less

#define pp_less ( PP)    pp_character (PP, '<')

Referenced by dump_gimple_omp_for().

◆ pp_less_equal

#define pp_less_equal ( PP)    pp_string (PP, "<=")

Referenced by dump_gimple_omp_for().

◆ pp_line_cutoff

#define pp_line_cutoff ( PP)    (PP)->wrapping.line_cutoff
Maximum characters per line in automatic line wrapping mode.
Zero means don't wrap lines.   

Referenced by diagnostic_context::initialize(), pp_set_line_maximum_length(), pp_set_real_maximum_length(), pretty_printer::pretty_printer(), and pretty_printer::pretty_printer().

◆ pp_maybe_newline_and_indent

#define pp_maybe_newline_and_indent ( PP,
N )    if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)

◆ pp_minus

#define pp_minus ( PP)    pp_character (PP, '-')

◆ pp_modulo

#define pp_modulo ( PP)    pp_character (PP, '%')

Referenced by print_value().

◆ pp_needs_newline

◆ PP_NL_ARGMAX

#define PP_NL_ARGMAX   30
Various declarations for language-independent pretty-print subroutines.
   Copyright (C) 2002-2024 Free Software Foundation, Inc.
   Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Maximum number of format string arguments.   

Referenced by pp_format().

◆ pp_plus

#define pp_plus ( PP)    pp_character (PP, '+')

Referenced by dump_omp_clause().

◆ pp_pointer

#define pp_pointer ( PP,
P )   pp_scalar (PP, "%p", P)

◆ pp_prefixing_rule

#define pp_prefixing_rule ( PP)    (PP)->wrapping.rule
Prefixing rule used in formatting a diagnostic message.   

Referenced by pp_emit_prefix(), pp_set_real_maximum_length(), pretty_printer::pretty_printer(), and pretty_printer::pretty_printer().

◆ pp_question

#define pp_question ( PP)    pp_character (PP, '?')

Referenced by dump_generic_node().

◆ pp_quote

#define pp_quote ( PP)    pp_character (PP, '\'')

Referenced by ubsan_type_descriptor().

◆ pp_right_brace

◆ pp_right_bracket

◆ pp_right_paren

◆ pp_scalar

#define pp_scalar ( PP,
FORMAT,
SCALAR )
Value:
do \
{ \
sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
pp_string (PP, pp_buffer (PP)->digit_buffer); \
} \
while (0)
@ SCALAR
Definition gengtype.h:482
#define pp_buffer(PP)
Definition pretty-print.h:378

Referenced by dump_block_node(), dump_decl_name(), dump_edge_probability(), dump_function_name(), dump_generic_node(), dump_gimple_fmt(), pp_format(), and print_value().

◆ pp_semicolon

◆ pp_set_verbatim_wrapping

#define pp_set_verbatim_wrapping ( PP)    pp_set_verbatim_wrapping_ (PP)

Referenced by pp_format(), and pp_format_verbatim().

◆ pp_show_color

◆ pp_slash

#define pp_slash ( PP)    pp_character (PP, '/')

◆ pp_space

◆ pp_star

#define pp_star ( PP)    pp_character (PP, '*')

◆ pp_translate_identifiers

#define pp_translate_identifiers ( PP)    (PP)->translate_identifiers
True if identifiers are translated to the locale character set on
output.   

Referenced by dump_fancy_name(), make_item_for_dump_generic_expr(), maybe_init_pretty_print(), and pp_tree_identifier().

◆ pp_underscore

#define pp_underscore ( PP)    pp_character (PP, '_')

◆ pp_unsigned_wide_integer

◆ pp_vrange

#define pp_vrange ( PP,
R )
Value:
do \
{ \
(R)->accept (vrange_pp); \
} \
while (0)
Definition value-range-pretty-print.h:25

Referenced by dump_ssaname_info().

◆ pp_wrapping_mode

#define pp_wrapping_mode ( PP)    (PP)->wrapping
Get or set the wrapping mode as a single entity.   

Referenced by pp_format(), and pp_format_verbatim().

Typedef Documentation

◆ pp_flags

The type of pretty-printer flags passed to clients.   

◆ printer_fn

typedef bool(* printer_fn) (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, const char **)
The type of a hook that formats client-specific data onto a pretty_printer.
A client-supplied formatter returns true if everything goes well,
otherwise it returns false.   

Enumeration Type Documentation

◆ diagnostic_prefixing_rule_t

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.   
Enumerator
DIAGNOSTICS_SHOW_PREFIX_ONCE 
DIAGNOSTICS_SHOW_PREFIX_NEVER 
DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE 

◆ pp_padding

Enumerator
pp_none 
pp_before 
pp_after 

Function Documentation

◆ identifier_to_locale()

const char * identifier_to_locale ( const char * ident)
extern
Given IDENT, an identifier in the internal encoding, return a
version of IDENT suitable for diagnostics in the locale character
set: either IDENT itself, or a string, allocated using
identifier_to_locale_alloc, converted to the locale character set
and using escape sequences if not representable in the locale
character set or containing control characters or invalid byte
sequences.  Existing backslashes in IDENT are not doubled, so the
result may not uniquely specify the contents of an arbitrary byte
sequence identifier.   

References cd, CONST_CAST, decode_utf8_char(), errno, ggc_alloc(), i, identifier_to_locale_alloc, identifier_to_locale_free, locale_encoding, locale_utf8, and NULL.

Referenced by announce_function(), default_tree_make_json_for_path(), default_tree_printer(), dump_fancy_name(), expand_expr_real_1(), compiler_logical_location::get_name_with_scope_for_tree(), compiler_logical_location::get_short_name_for_tree(), lhd_print_error_function(), pp_tree_identifier(), resolve_operand_name_1(), symtab_node::verify_base(), and cgraph_node::verify_node().

◆ output_buffer_append_r()

void output_buffer_append_r ( output_buffer * buff,
const char * start,
int length )
inline
Append to the output buffer a string specified by its
STARTing character and LENGTH.   

References gcc_checking_assert, ggc_alloc(), and i.

Referenced by pp_append_r().

◆ output_buffer_formatted_text()

const char * output_buffer_formatted_text ( output_buffer * buff)
inline
Finishes constructing a NULL-terminated character string representing
the buffered text.   

References ggc_alloc().

Referenced by pp_formatted_text().

◆ output_buffer_last_position_in_text()

const char * output_buffer_last_position_in_text ( const output_buffer * buff)
inline
Return a pointer to the last character emitted in the
output_buffer.  A NULL pointer means no character available.   

References ggc_alloc(), NULL, and obstack.

Referenced by dump_pretty_printer::emit_any_pending_textual_chunks(), and pp_last_position_in_text().

◆ pp_append_text()

void pp_append_text ( pretty_printer * pp,
const char * start,
const char * end )
extern
Append a string delimited by START and END to the output area of
PRETTY-PRINTER.  No line wrapping is done.  However, if beginning a
new line then emit PRETTY-PRINTER's prefix and skip any leading
whitespace if appropriate.  The caller must ensure that it is
safe to do so.   

References end(), pp_append_r(), pp_buffer, pp_emit_prefix(), and pp_is_wrapping_line.

Referenced by dump_fancy_name(), pp_format(), pp_maybe_wrap_text(), pp_tree_identifier(), and pp_wrap_text().

◆ pp_begin_quote()

void pp_begin_quote ( pretty_printer * pp,
bool show_color )
extern
Add a localized open quote, and if SHOW_COLOR is true, begin colorizing
using the "quote" color.   

References colorize_start(), open_quote, and pp_string().

Referenced by decls_mismatched_attributes(), and pp_format().

◆ pp_begin_url()

void pp_begin_url ( pretty_printer * pp,
const char * url )
extern
Support for encoding URLs.
See egmontkob/Hyperlinks_in_Terminal_Emulators.md
( https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda ).

> A hyperlink is opened upon encountering an OSC 8 escape sequence with
> the target URI. The syntax is
>
>  OSC 8 ; params ; URI ST
>
> A hyperlink is closed with the same escape sequence, omitting the
> parameters and the URI but keeping the separators:
>
> OSC 8 ; ; ST
>
> OSC (operating system command) is typically ESC ].

Use BEL instead of ST, as that is currently rendered better in some
terminal emulators that don't support OSC 8, like konsole.   
If URL-printing is enabled, write an "open URL" escape sequence to PP
for the given URL.   

References gcc_unreachable, ggc_alloc(), pretty_printer::m_skipping_null_url, pp_string(), pretty_printer::url_format, URL_FORMAT_BEL, URL_FORMAT_NONE, and URL_FORMAT_ST.

Referenced by pp_format(), diagnostic_context::print_any_cwe(), diagnostic_context::print_any_rules(), print_lto_docs_link(), and diagnostic_context::print_option_information().

◆ pp_character()

◆ pp_clear_output_area()

◆ pp_destroy_prefix()

void pp_destroy_prefix ( pretty_printer * pp)
extern
Free PRETTY-PRINTER's prefix, a previously malloc()'d string.   

References free(), NULL, and pretty_printer::prefix.

Referenced by diagnostic_append_note().

◆ pp_emit_prefix()

◆ pp_end_quote()

void pp_end_quote ( pretty_printer * pp,
bool show_color )
extern
If SHOW_COLOR is true, stop colorizing.
Add a localized close quote.   

References close_quote, colorize_stop(), and pp_string().

Referenced by decls_mismatched_attributes(), and pp_format().

◆ pp_end_url()

◆ pp_flush()

◆ pp_format()

void pp_format ( pretty_printer * pp,
text_info * text,
const urlifier * urlifier )
extern
The following format specifiers are recognized as being client independent:
%d, %i: (signed) integer in base ten.
%u: unsigned integer in base ten.
%o: unsigned integer in base eight.
%x: unsigned integer in base sixteen.
%ld, %li, %lo, %lu, %lx: long versions of the above.
%lld, %lli, %llo, %llu, %llx: long long versions.
%wd, %wi, %wo, %wu, %wx: HOST_WIDE_INT versions.
%zd, %zi, %zo, %zu, %zx: size_t versions.
%td, %ti, %to, %tu, %tx: ptrdiff_t versions.
%f: double
%c: character.
%s: string.
%p: pointer (printed in a host-dependent manner).
%r: if pp_show_color(pp), switch to color identified by const char *.
%R: if pp_show_color(pp), reset color.
%m: strerror(text->err_no) - does not consume a value from args_ptr.
%%: '%'.
%<: opening quote.
%>: closing quote.
%{: URL start.  Consumes a const char * argument for the URL.
%}: URL end.    Does not consume any arguments.
%': apostrophe (should only be used in untranslated messages;
    translations should use appropriate punctuation directly).
%@: diagnostic_event_id_ptr, for which event_id->known_p () must be true.
%.*s: a substring the length of which is specified by an argument
      integer.
%Ns: likewise, but length specified as constant in the format string.
Flag 'q': quote formatted text (must come immediately after '%').
%Z: Requires two arguments - array of int, and len. Prints elements
of the array.

Arguments can be used sequentially, or through %N$ resp. *N$
notation Nth argument after the format string.  If %N$ / *N$
notation is used, it must be used for all arguments, except %m, %%,
%<, %>, %} and %', which may not have a number, as they do not consume
an argument.  When %M$.*N$s is used, M must be N + 1.  (This may
also be written %M$.*s, provided N is not otherwise used.)  The
format string must have conversion specifiers with argument numbers
1 up to highest argument; each argument may only be used once.
A format string can have at most 30 arguments.   
Formatting phases 1 and 2: render TEXT->format_spec plus
text->m_args_ptr into a series of chunks in pp_buffer (PP)->args[].
Phase 3 is in pp_output_formatted_text.

If URLIFIER is non-NULL, then use it to add URLs for quoted
strings, so that e.g.
  "before %<quoted%> after"
with a URLIFIER that has a URL for "quoted" might be emitted as:
  "before `BEGIN_URL(http://example.com)quotedEND_URL' after"
This is handled here for message fragments that are:
- quoted entirely in phase 1 (e.g. "%<this is quoted%>"), or
- quoted entirely in phase 2 (e.g. "%qs"),
Quoted fragments that use a mixture of both phases
(e.g. "%<this is a mixture: %s %>")
are stashed into the output_buffer's m_quotes for use in phase 3.   

References chunk_info::args, output_buffer::chunk_obstack, close_quote, colorize_start(), colorize_stop(), output_buffer::cur_chunk_array, end(), output_buffer::formatted_obstack, gcc_assert, gcc_unreachable, get_end_url_string(), ggc_alloc(), format_postprocessor::handle(), HOST_WIDE_INT_PRINT, HOST_WIDE_INT_PRINT_HEX, HOST_WIDE_INT_PRINT_UNSIGNED, i, output_buffer::line_length, pretty_printer::m_format_postprocessor, output_buffer::obstack, on_begin_quote(), on_end_quote(), open_quote, pp_append_text(), pp_begin_quote(), pp_begin_url(), pp_buffer, pp_character(), pp_clear_state(), pp_comma, pp_decimal_int, pp_double, pp_end_quote(), pp_format_decoder, pp_integer_with_precision, PP_NL_ARGMAX, pp_pointer, pp_quoted_string(), pp_scalar, pp_set_verbatim_wrapping, pp_show_color, pp_space, pp_string(), pp_wide_integer(), and pp_wrapping_mode.

Referenced by simple_diagnostic_path::add_event(), simple_diagnostic_path::add_thread_event(), diagnostic_append_note(), dump_context::dump_printf_va(), opt_problem::opt_problem(), pp_format_verbatim(), pp_printf(), graphviz_out::print(), graphviz_out::println(), and diagnostic_context::report_diagnostic().

◆ pp_format_verbatim()

void pp_format_verbatim ( pretty_printer * pp,
text_info * text )
extern
Helper subroutine of output_verbatim and verbatim. Do the appropriate
settings needed by BUFFER for a verbatim formatting.   

References ggc_alloc(), pp_format(), pp_output_formatted_text(), pp_set_verbatim_wrapping, and pp_wrapping_mode.

Referenced by pp_verbatim(), and verbatim().

◆ pp_formatted_text()

◆ pp_get_prefix()

const char * pp_get_prefix ( const pretty_printer * pp)
inline

◆ pp_indent()

void pp_indent ( pretty_printer * pp)
extern
Insert enough spaces into the output area of PRETTY-PRINTER to bring
the column position to the current indentation level, assuming that a
newline has just been written to the buffer.   

References i, pp_indentation, and pp_space.

Referenced by pp_emit_prefix(), pp_newline_and_indent(), json::object::print(), and json::array::print().

◆ pp_last_position_in_text()

const char * pp_last_position_in_text ( const pretty_printer * pp)
extern
Return a pointer to the last character emitted in PRETTY-PRINTER's
output area.  A NULL pointer means no character available.   

References output_buffer_last_position_in_text(), and pp_buffer.

◆ pp_maybe_space()

void pp_maybe_space ( pretty_printer * pp)
extern
Maybe print out a whitespace if needed.   

References pretty_printer::padding, pp_none, and pp_space.

◆ pp_newline()

void pp_newline ( pretty_printer * pp)
extern

◆ pp_newline_and_flush()

◆ pp_newline_and_indent()

void pp_newline_and_indent ( pretty_printer * pp,
int n )
extern

◆ pp_output_formatted_text()

◆ pp_printf()

void pp_printf ( pretty_printer * ,
const char * ,
... )
extern

◆ pp_really_flush()

void pp_really_flush ( pretty_printer * pp)
extern
Flush the content of BUFFER onto the attached stream independently
of the value of pp->output_buffer->flush_p.   

References ggc_alloc(), pp_buffer, pp_clear_state(), and pp_write_text_to_stream().

◆ pp_remaining_character_count_for_line()

int pp_remaining_character_count_for_line ( pretty_printer * pp)
extern
Return the amount of characters PRETTY-PRINTER can accept to
make a full line.  Meaningful only in line-wrapping mode.   

References pretty_printer::maximum_length, and pp_buffer.

Referenced by pp_character(), and pp_wrap_text().

◆ pp_separate_with()

void pp_separate_with ( pretty_printer * pp,
char c )
extern

References pp_character(), and pp_space.

◆ pp_set_line_maximum_length()

void pp_set_line_maximum_length ( pretty_printer * pp,
int length )
extern
Sets the number of maximum characters per line PRETTY-PRINTER can
output in line-wrapping mode.  A LENGTH value 0 suppresses
line-wrapping.   

References pp_line_cutoff, and pp_set_real_maximum_length().

Referenced by common_handle_option().

◆ pp_set_prefix()

◆ pp_set_verbatim_wrapping_()

pp_wrapping_mode_t pp_set_verbatim_wrapping_ ( pretty_printer * pp)
inline
Switch into verbatim mode and return the old mode.   

◆ pp_string()

void pp_string ( pretty_printer * pp,
const char * str )
extern
Append a STRING to the output area of PRETTY-PRINTER; the STRING may
be line-wrapped if in appropriate mode.   

References gcc_checking_assert, ggc_alloc(), and pp_maybe_wrap_text().

Referenced by gcc_rich_location::add_fixit_insert_formatted(), asan_add_global(), asan_dynamic_init_call(), asan_emit_stack_protection(), graphviz_out::begin_td(), graphviz_out::begin_tr(), graphviz_out::begin_trtd(), decls_mismatched_attributes(), default_diagnostic_start_span_fn(), default_tree_printer(), do_niy(), draw_cfg_node(), irange_bitmask::dump(), dump_array_domain(), dump_binary_rhs(), dump_block_node(), dump_decl_name(), digraph< GraphTraits >::dump_dot_to_pp(), dump_function_declaration(), dump_function_name(), dump_generic_node(), dump_gimple_asm(), dump_gimple_assign(), dump_gimple_assume(), dump_gimple_call(), dump_gimple_call_args(), dump_gimple_cond(), dump_gimple_fmt(), dump_gimple_label(), dump_gimple_mem_ops(), dump_gimple_omp_atomic_load(), dump_gimple_omp_atomic_store(), dump_gimple_omp_block(), dump_gimple_omp_continue(), dump_gimple_omp_critical(), dump_gimple_omp_for(), dump_gimple_omp_masked(), dump_gimple_omp_ordered(), dump_gimple_omp_parallel(), dump_gimple_omp_return(), dump_gimple_omp_scan(), dump_gimple_omp_scope(), dump_gimple_omp_sections(), dump_gimple_omp_single(), dump_gimple_omp_target(), dump_gimple_omp_task(), dump_gimple_omp_taskgroup(), dump_gimple_omp_teams(), dump_gimple_phi(), dump_gimple_return(), dump_gimple_switch(), dump_gimple_transaction(), dump_gimple_try(), dump_implicit_edges(), dump_location(), dump_mem_ref(), dump_omp_atomic_memory_order(), dump_omp_clause(), dump_omp_context_selector(), dump_omp_iterators(), dump_omp_loop_non_rect_expr(), dump_ssaname_info(), dump_ternary_rhs(), ana::record_layout::item::dump_to_pp(), ana::one_way_id_map< T >::dump_to_pp(), diagnostic_event::meaning::dump_to_pp(), dump_unary_rhs(), dump_context::emit_item(), dump_pretty_printer::emit_items(), graphviz_out::end_td(), graphviz_out::end_tdtr(), graphviz_out::end_tr(), gimple_dump_bb_for_graph(), pp_begin_quote(), pp_begin_url(), pp_cfg_jump(), pp_double_int(), pp_end_quote(), pp_end_url(), pp_format(), pp_gimple_stmt_1(), pp_output_formatted_text(), pp_points_to_solution(), pp_wide_int_large(), pretty_print_string(), ana::dynamic_call_info_t::print(), ana::rewind_info_t::print(), json::object::print(), json::array::print(), json::float_number::print(), json::integer_number::print(), json::literal::print(), diagnostic_context::print_any_cwe(), diagnostic_context::print_any_rules(), print_call_name(), edited_line::print_content(), print_declaration(), edited_file::print_diff(), edited_file::print_diff_hunk(), print_escaped_json_string(), print_escaped_string(), print_exp(), vrange_printer::print_frange_nan(), print_insn(), print_insn_with_notes(), print_int_bound(), print_irange_bitmasks(), print_lto_docs_link(), diagnostic_context::print_option_information(), print_parseable_fixits(), print_pattern(), vrange_printer::print_real_value(), edited_file::print_run_of_changed_lines(), print_struct_decl(), print_value(), simd_clone_mangle(), start_graph_dump(), ubsan_type_descriptor(), vrange_printer::visit(), vrange_printer::visit(), vrange_printer::visit(), and vrange_printer::visit().

◆ pp_take_prefix()

char * pp_take_prefix ( pretty_printer * pp)
extern

◆ pp_unicode_character()

void pp_unicode_character ( pretty_printer * pp,
unsigned c )
extern
Append code point C to the output area of PRETTY-PRINTER, encoding it
as UTF-8.   

References ggc_alloc(), limits, and pp_append_r().

◆ pp_verbatim()

void void pp_verbatim ( pretty_printer * ,
const char * ,
... )
extern

◆ pp_wide_int()

◆ pp_wide_integer() [1/2]

◆ pp_wide_integer() [2/2]

void pp_wide_integer ( pretty_printer * pp,
HOST_WIDE_INT i )
inline
Print I to PP in decimal.   

◆ pp_write_text_as_dot_label_to_stream()

void pp_write_text_as_dot_label_to_stream ( pretty_printer * pp,
bool for_record )
extern
As pp_write_text_to_stream, but for GraphViz label output.

Flush the formatted text of pretty-printer PP onto the attached stream.
Replace characters in PPF that have special meaning in a GraphViz .dot
file.

This routine is not very fast, but it doesn't have to be as this is only
be used by routines dumping intermediate representations in graph form.   

References fputc(), gcc_assert, ggc_alloc(), pp_buffer, pp_clear_output_area(), and pp_formatted_text().

Referenced by gimple_dump_bb_for_graph(), rtl_dump_bb_for_graph(), and start_graph_dump().

◆ pp_write_text_as_html_like_dot_to_stream()

void pp_write_text_as_html_like_dot_to_stream ( pretty_printer * pp)
extern
As pp_write_text_to_stream, but for GraphViz HTML-like strings.

Flush the formatted text of pretty-printer PP onto the attached stream,
escaping these characters
  " & < >
using XML escape sequences.

http://www.graphviz.org/doc/info/lang.html#html states:
   special XML escape sequences for ", &, <, and > may be necessary in
   order to embed these characters in attribute values or raw text
This doesn't list "'" (which would normally be escaped in XML
as "&apos;" or in HTML as "&#39;");.

Experiments show that escaping "'" doesn't seem to be necessary.   

References fputc(), ggc_alloc(), pp_buffer, pp_clear_output_area(), and pp_formatted_text().

◆ pp_write_text_to_stream()

Variable Documentation

◆ identifier_to_locale_alloc

void *(* identifier_to_locale_alloc) (size_t) ( size_t )
extern
Allocator for identifier_to_locale and corresponding function to
free memory.   

Referenced by general_init(), and identifier_to_locale().

◆ identifier_to_locale_free

void(* identifier_to_locale_free) (void *) ( void * )
extern