GCC Middle and Back End API Reference
diagnostic_context Struct Reference

#include <diagnostic.h>

Collaboration diagram for diagnostic_context:

Data Fields

pretty_printerprinter
int diagnostic_count [DK_LAST_DIAGNOSTIC_KIND]
bool some_warnings_are_errors
bool warning_as_error_requested
int n_opts
diagnostic_tclassify_diagnostic
diagnostic_classification_change_tclassification_history
int n_classification_history
int * push_list
int n_push
bool show_caret
int caret_max_width
bool show_option_requested
bool abort_on_error
bool show_column
bool pedantic_errors
bool permissive
int opt_permissive
bool fatal_errors
bool dc_inhibit_warnings
bool dc_warn_system_headers
unsigned int max_errors
diagnostic_starter_fn begin_diagnostic
diagnostic_finalizer_fn end_diagnostic
void(* internal_error )(diagnostic_context *, const char *, va_list *)
int(* option_enabled )(int, void *)
void * option_state
char *(* option_name )(diagnostic_context *, int, diagnostic_t, diagnostic_t)
void * x_data
location_t last_location
struct line_map * last_module
int lock
bool inhibit_notes_p

Detailed Description

This data structure bundles altogether any information relevant to the context of a diagnostic message.


Field Documentation

bool diagnostic_context::abort_on_error

True if we should raise a SIGABRT on errors.

Referenced by diagnostic_action_after_output().

diagnostic_starter_fn diagnostic_context::begin_diagnostic

This function is called before any message is printed out. It is responsible for preparing message prefix and such. For example, it might say: In file included from "/usr/local/include/curses.h:5: from "/home/gdr/src/nifty_printer.h:56: ...

int diagnostic_context::caret_max_width

Maximum width of the source line printed.

diagnostic_classification_change_t* diagnostic_context::classification_history

History of all changes to the classifications above. This list is stored in location-order, so we can search it, either binary-wise or end-to-front, to find the most recent classification for a given diagnostic, given the location of the diagnostic.

Referenced by default_diagnostic_finalizer(), and default_diagnostic_starter().

diagnostic_t* diagnostic_context::classify_diagnostic

For each option index that can be passed to warning() et al (OPT_* from options.h when using this code with the core GCC options), this array may contain a new kind that the diagnostic should be changed to before reporting, or DK_UNSPECIFIED to leave it as the reported kind, or DK_IGNORED to not report it at all.

bool diagnostic_context::dc_inhibit_warnings

True if all warnings should be disabled.

bool diagnostic_context::dc_warn_system_headers

True if warnings should be given in system headers.

int diagnostic_context::diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]

The number of times we have issued diagnostics.

diagnostic_finalizer_fn diagnostic_context::end_diagnostic

This function is called after the diagnostic message is printed.

bool diagnostic_context::fatal_errors

True if errors are fatal.

bool diagnostic_context::inhibit_notes_p

Referenced by trim_filename().

void(* diagnostic_context::internal_error)(diagnostic_context *, const char *, va_list *)

Client hook to report an internal error.

location_t diagnostic_context::last_location

Used to detect that the last caret was printed at the same location.

Referenced by adjust_line().

struct line_map* diagnostic_context::last_module

Used to detect when the input file stack has changed since last described.

int diagnostic_context::lock
unsigned int diagnostic_context::max_errors

Maximum number of errors to report.

int diagnostic_context::n_classification_history

The size of the above array.

Referenced by default_diagnostic_starter().

int diagnostic_context::n_opts

The number of option indexes that can be passed to warning() et al.

int diagnostic_context::n_push
int diagnostic_context::opt_permissive

The index of the option to associate with turning permerrors into warnings.

int(* diagnostic_context::option_enabled)(int, void *)

Client hook to say whether the option controlling a diagnostic is enabled. Returns nonzero if enabled, zero if disabled.

char*(* diagnostic_context::option_name)(diagnostic_context *, int, diagnostic_t, diagnostic_t)

Client hook to return the name of an option that controls a diagnostic. Returns malloced memory. The first diagnostic_t argument is the kind of diagnostic before any reclassification (of warnings as errors, etc.); the second is the kind after any reclassification. May return NULL if no name is to be printed. May be passed 0 as well as the index of a particular option.

void* diagnostic_context::option_state

Client information to pass as second argument to option_enabled.

bool diagnostic_context::pedantic_errors

True if pedwarns are errors.

bool diagnostic_context::permissive

True if permerrors are warnings.

pretty_printer* diagnostic_context::printer
int* diagnostic_context::push_list

For pragma push/pop.

bool diagnostic_context::show_caret

True if we should print the source line with a caret indicating the location.

Referenced by adjust_line().

bool diagnostic_context::show_column

True if we should show the column number on diagnostics.

Referenced by lhd_print_error_function().

bool diagnostic_context::show_option_requested

True if we should print the command line option which controls each diagnostic, if known.

bool diagnostic_context::some_warnings_are_errors

True if we should display the "warnings are being tread as error" message, usually displayed once per compiler run.

bool diagnostic_context::warning_as_error_requested

True if it has been requested that warnings be treated as errors.

Referenced by setup_core_dumping().

void* diagnostic_context::x_data

Auxiliary data for client.


The documentation for this struct was generated from the following file: