21#ifndef GCC_DIAGNOSTIC_H
22#define GCC_DIAGNOSTIC_H
24#include "rich-location.h"
32#define diagnostic_context_auxiliary_data(DC) (DC)->m_client_aux_data
33#define diagnostic_info_auxiliary_data(DI) (DI)->m_x_data
42#define errorcount global_dc->diagnostic_count (diagnostics::kind::error)
44#define warningcount global_dc->diagnostic_count (diagnostics::kind::warning)
46#define werrorcount global_dc->diagnostic_count (diagnostics::kind::werror)
48#define sorrycount global_dc->diagnostic_count (diagnostics::kind::sorry)
51#define diagnostic_report_warnings_p(DC, LOC) \
52 (!(DC)->m_inhibit_warnings \
53 && !(in_system_header_at (LOC) && !(DC)->m_warn_system_headers))
94 rich_location *richloc,
102 context->
maybe_show_locus (*richloc, opts, diagnostic_kind, *pp, effect_info);
108 rich_location *richloc,
117 effect_info, label_writer);
138 bool should_skip_bom)
183#ifdef ATTRIBUTE_GCC_DIAG
185 const char *, va_list *,
190 const char *, va_list *,
200template <
typename TextOrHtml>
202 TextOrHtml &text_or_html,
218 return diagnostic->m_message.get_location (which);
226 return diagnostic->m_message.m_richloc->get_num_locations ();
233inline expanded_location
237 return diagnostic->m_richloc->get_expanded_location (which);
251 expanded_location s1, expanded_location s2)
253 return (s2.column && s1.line == s2.line
256 > abs (s1.column - s2.column)));
266 return global_dc->warning_enabled_at (loc, opt_id);
272 return global_dc->option_unspecified_p (opt_id);
Definition diagnostics/context.h:254
void maybe_show_locus(const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, pretty_printer &pp, source_effect_info *effect_info)
Definition source-printing.cc:3859
void finish()
Definition diagnostics/context.cc:353
void push_diagnostics(location_t where)
Definition diagnostics/context.h:355
void initialize_input_context(diagnostic_input_charset_callback ccb, bool should_skip_bom)
Definition diagnostics/context.cc:344
void end_group()
Definition diagnostics/context.cc:1817
void color_init(int value)
Definition diagnostics/context.cc:255
source_printing_options & get_source_printing_options()
Definition diagnostics/context.h:608
bool bool bool report_diagnostic(diagnostic_info *)
Definition diagnostics/context.cc:1347
void initialize(int n_opts)
Definition diagnostics/context.cc:138
enum kind classify_diagnostic(option_id opt_id, enum kind new_kind, location_t where)
Definition diagnostics/context.h:338
void pop_diagnostics(location_t where)
Definition diagnostics/context.h:364
void begin_group()
Definition diagnostics/context.cc:1811
void maybe_show_locus_as_html(const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, xml::printer &xp, source_effect_info *effect_info, html_label_writer *label_writer)
Definition source-printing.cc:3892
void urls_init(int value)
Definition diagnostics/context.cc:286
Definition diagnostics/context.h:146
Definition diagnostics/context.h:117
Definition source-printing-effects.h:43
Definition text-sink.h:35
Definition pretty-print.h:241
Definition xml-printer.h:33
const char *(* diagnostic_input_charset_callback)(const char *)
Definition coretypes.h:173
#define ATTRIBUTE_GCC_DIAG(m, n)
Definition diagnostic-core.h:71
diagnostics::context * global_dc
Definition diagnostic-global-context.cc:35
void void diagnostic_set_info_translated(diagnostics::diagnostic_info *, const char *, va_list *, rich_location *, enum diagnostics::kind) ATTRIBUTE_GCC_DIAG(2
const int CARET_LINE_MARGIN
Definition diagnostic.h:243
bool diagnostic_report_diagnostic(diagnostics::context *context, diagnostics::diagnostic_info *diagnostic)
Definition diagnostic.h:174
void diagnostic_urls_init(diagnostics::context *context, int value=-1)
Definition diagnostic.h:80
void diagnostic_initialize_input_context(diagnostics::context *context, diagnostic_input_charset_callback ccb, bool should_skip_bom)
Definition diagnostic.h:136
location_t diagnostic_location(const diagnostics::diagnostic_info *diagnostic, int which=0)
Definition diagnostic.h:215
int get_terminal_width(void)
Definition diagnostics/context.cc:98
diagnostics::kind diagnostic_classify_diagnostic(diagnostics::context *context, diagnostics::option_id opt_id, enum diagnostics::kind kind, location_t where)
Definition diagnostic.h:145
void diagnostic_push_diagnostics(diagnostics::context *context, location_t where)
Definition diagnostic.h:154
void diagnostic_initialize(diagnostics::context *context, int n_opts)
Definition diagnostic.h:68
unsigned int diagnostic_num_locations(const diagnostics::diagnostic_info *diagnostic)
Definition diagnostic.h:224
bool diagnostic_same_line(const diagnostics::context *context, expanded_location s1, expanded_location s2)
Definition diagnostic.h:250
void diagnostic_show_locus(diagnostics::context *context, const diagnostics::source_printing_options &opts, rich_location *richloc, enum diagnostics::kind diagnostic_kind, pretty_printer *pp, diagnostics::source_effect_info *effect_info=nullptr)
Definition diagnostic.h:92
void diagnostic_color_init(diagnostics::context *context, int value=-1)
Definition diagnostic.h:74
void diagnostic_finish(diagnostics::context *context)
Definition diagnostic.h:86
char * build_message_string(const char *,...) ATTRIBUTE_PRINTF_1
Definition diagnostics/context.cc:81
void diagnostic_set_option_id(diagnostics::diagnostic_info *info, diagnostics::option_id opt_id)
Definition diagnostic.h:59
bool option_unspecified_p(diagnostics::option_id opt_id)
Definition diagnostic.h:270
bool warning_enabled_at(location_t loc, diagnostics::option_id opt_id)
Definition diagnostic.h:264
void diagnostic_show_locus_as_html(diagnostics::context *context, const diagnostics::source_printing_options &opts, rich_location *richloc, enum diagnostics::kind diagnostic_kind, xml::printer &xp, diagnostics::source_effect_info *effect_info=nullptr, diagnostics::html_label_writer *label_writer=nullptr)
Definition diagnostic.h:106
expanded_location diagnostic_expand_location(const diagnostics::diagnostic_info *diagnostic, int which=0)
Definition diagnostic.h:234
void diagnostic_pop_diagnostics(diagnostics::context *context, location_t where)
Definition diagnostic.h:160
void diagnostic_set_info(diagnostics::diagnostic_info *, const char *, va_list *, rich_location *, enum diagnostics::kind) ATTRIBUTE_GCC_DIAG(2
Definition coretypes.h:167
void default_start_span_fn(const diagnostics::location_print_policy &, TextOrHtml &text_or_html, expanded_location)
void default_text_finalizer(diagnostics::text_sink &, const diagnostics::diagnostic_info *, enum diagnostics::kind)
void default_text_starter(diagnostics::text_sink &, const diagnostics::diagnostic_info *)
Definition text-sink.cc:707
kind
Definition kinds.h:27
int num_digits(int)
Definition diagnostics/context.cc:1592
Definition libgdiagnostics.cc:1256
Definition diagnostic-info.h:32
option_id m_option_id
Definition diagnostic-info.h:58
Definition option-id.h:32
Definition source-printing-options.h:31
int max_width
Definition source-printing-options.h:38
#define gcc_assert(EXPR)
Definition system.h:814