diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-20 09:50:12 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-20 09:50:12 +0000 |
commit | 92d99247ad8850e85d50d3e6561c83d066712a18 (patch) | |
tree | a48feb8c4b79b8c4f09b952ea1e0f1cbca855311 /gcc/diagnostic.h | |
parent | 46932f2c57551c6764d2dc9789140a043e00dc74 (diff) | |
download | gcc-92d99247ad8850e85d50d3e6561c83d066712a18.tar.gz |
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r-- | gcc/diagnostic.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 4108227f50b..07beb4b4458 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ /* Forward declarations. */ typedef struct output_buffer output_buffer; +typedef struct diagnostic_context diagnostic_context; #define DIAGNOSTICS_SHOW_PREFIX_ONCE 0x0 #define DIAGNOSTICS_SHOW_PREFIX_NEVER 0x1 @@ -79,6 +80,51 @@ struct output_buffer #define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor #define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args) +/* This data structure bundles altogether any information relevent to + the context of a diagnostic message. */ +struct diagnostic_context +{ + /* The diagnostic message to output. */ + const char *message; + + /* A pointer to a variable list of the arguments necessary for the + purpose of message formatting. */ + va_list *args_ptr; + + /* The name of the source file involved in the diiagnostic. */ + const char *file; + + /* The line-location in the source file. */ + int line; + + /* Is it message a warning? */ + int warn; + + /* This function is called before any message is printed out. It is + respondible 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: + ... + */ + void (*begin_diagnostic) PARAMS ((output_buffer *, diagnostic_context *)); + + /* This function is called after the diagnostic message is printed. */ + void (*end_diagnostic) PARAMS ((output_buffer *, diagnostic_context *)); + + /* Hook for front-end extensions. */ + void *x_data; +}; + +#define diagnostic_message(DC) (DC)->message +#define diagnostic_argument_list(DC) (DC)->args_ptr +#define diagnostic_file_location(DC) (DC)->file +#define diagnostic_line_location(DC) (DC)->line +#define diagnostic_is_warning(DC) (DC)->warn +#define diagnostic_starter(DC) (DC)->begin_diagnostic +#define diagnostic_finalizer(DC) (DC)->end_diagnostic +#define diagnostic_auxiliary_data(DC) (DC)->x_data + /* If non-NULL, this function formats data in the BUFFER. When called, output_buffer_text_cursor (BUFFER) points to a format code. LANG_PRINTER should call output_add_string (and related functions) to add data to @@ -101,10 +147,11 @@ extern int diagnostic_message_length_per_line; extern output_buffer *diagnostic_buffer; /* Prototypes */ +void set_diagnostic_context PARAMS ((diagnostic_context *, const char *, + va_list *, const char *, int, int)); void set_fatal_function PARAMS ((void (*) PARAMS ((const char *, va_list *)))); -void report_diagnostic PARAMS ((const char *, va_list *, - const char *, int, int)); +void report_diagnostic PARAMS ((diagnostic_context *)); void initialize_diagnostics PARAMS ((void)); void reshape_diagnostic_buffer PARAMS ((void)); void default_initialize_buffer PARAMS ((output_buffer *)); |