diff options
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r-- | gcc/diagnostic.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index a670e0ca743..307dbcfb34a 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -35,6 +35,23 @@ enum diagnostics_output_format DIAGNOSTICS_OUTPUT_FORMAT_JSON }; +/* An enum for controlling how diagnostic_paths should be printed. */ +enum diagnostic_path_format +{ + /* Don't print diagnostic_paths. */ + DPF_NONE, + + /* Print diagnostic_paths by emitting a separate "note" for every event + in the path. */ + DPF_SEPARATE_EVENTS, + + /* Print diagnostic_paths by consolidating events together where they + are close enough, and printing such runs of events with multiple + calls to diagnostic_show_locus, showing the individual events in + each run via labels in the source. */ + DPF_INLINE_EVENTS +}; + /* A diagnostic is described by the MESSAGE to send, the FILE and LINE of its context and its KIND (ice, error, warning, note, ...) See complete list in diagnostic.def. */ @@ -80,6 +97,7 @@ typedef void (*diagnostic_finalizer_fn) (diagnostic_context *, diagnostic_t); class edit_context; +namespace json { class value; } /* This data structure bundles altogether any information relevant to the context of a diagnostic message. */ @@ -134,6 +152,12 @@ struct diagnostic_context diagnostics. */ bool show_cwe; + /* How should diagnostic_path objects be printed. */ + enum diagnostic_path_format path_format; + + /* True if we should print stack depths when printing diagnostic paths. */ + bool show_path_depths; + /* True if we should print the command line option which controls each diagnostic, if known. */ bool show_option_requested; @@ -208,6 +232,9 @@ struct diagnostic_context particular option. */ char *(*get_option_url) (diagnostic_context *, int); + void (*print_path) (diagnostic_context *, const diagnostic_path *); + json::value *(*make_json_for_path) (diagnostic_context *, const diagnostic_path *); + /* Auxiliary data for client. */ void *x_data; @@ -351,6 +378,7 @@ extern void diagnostic_report_current_module (diagnostic_context *, location_t); extern void diagnostic_show_locus (diagnostic_context *, rich_location *richloc, diagnostic_t diagnostic_kind); +extern void diagnostic_show_any_path (diagnostic_context *, diagnostic_info *); /* Force diagnostics controlled by OPTIDX to be kind KIND. */ extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *, @@ -442,4 +470,6 @@ extern void diagnostic_output_format_init (diagnostic_context *, /* Compute the number of digits in the decimal representation of an integer. */ extern int num_digits (int); +extern json::value *json_from_expanded_location (location_t loc); + #endif /* ! GCC_DIAGNOSTIC_H */ |