Commit f68fc4db by Gabriel Dos Reis Committed by Gabriel Dos Reis

diagnostic.h (struct diagnostic_context): Add new field.

	* diagnostic.h (struct diagnostic_context): Add new field.
	(lang_diagnostic_starter, lang_diagnostic_finalizer): Remove
	declaratons.
	(global_dc): Declare.
	* diagnostic.c (global_diagnostic_context): New variable.
	(global_output_buffer): Remove.
	(global_dc): Define.
	(lang_diagnostic_starter, lang_diagnostic_finalizer): Remove
 	definitions.
	(initialize_diagnostics): Adjust initialization.
	(set_diagnostic_context): Adjust setting.

cp/

	* error.c (init_error): Adjust settings.

From-SVN: r43581
parent d7f4934b
2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.h (struct diagnostic_context): Add new field.
(lang_diagnostic_starter, lang_diagnostic_finalizer): Remove
declaratons.
(global_dc): Declare.
* diagnostic.c (global_diagnostic_context): New variable.
(global_output_buffer): Remove.
(global_dc): Define.
(lang_diagnostic_starter, lang_diagnostic_finalizer): Remove
definitions.
(initialize_diagnostics): Adjust initialization.
(set_diagnostic_context): Adjust setting.
2001-06-26 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> 2001-06-26 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/mips/iris5.h (UNALIGNED_INT_ASM_OP, * config/mips/iris5.h (UNALIGNED_INT_ASM_OP,
......
2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
* error.c (init_error): Adjust settings.
2001-06-19 Richard Sandiford <rsandifo@redhat.com> 2001-06-19 Richard Sandiford <rsandifo@redhat.com>
* except.c (initialize_handler_parm): Expect __cxa_begin_catch to * except.c (initialize_handler_parm): Expect __cxa_begin_catch to
......
...@@ -191,13 +191,12 @@ cp_printer * cp_printers[256] = ...@@ -191,13 +191,12 @@ cp_printer * cp_printers[256] =
void void
init_error () init_error ()
{ {
init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0);
print_error_function = lang_print_error_function; print_error_function = lang_print_error_function;
lang_diagnostic_starter = cp_diagnostic_starter; diagnostic_starter (global_dc) = cp_diagnostic_starter;
lang_diagnostic_finalizer = cp_diagnostic_finalizer; diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
lang_printer = cp_tree_printer; lang_printer = cp_tree_printer;
init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0);
} }
/* Dump a scope, if deemed necessary. */ /* Dump a scope, if deemed necessary. */
......
...@@ -108,9 +108,12 @@ extern int warnings_are_errors; ...@@ -108,9 +108,12 @@ extern int warnings_are_errors;
/* Front-end specific tree formatter, if non-NULL. */ /* Front-end specific tree formatter, if non-NULL. */
printer_fn lang_printer = NULL; printer_fn lang_printer = NULL;
/* An output_buffer surrogate for stderr. */ /* A diagnostic_context surrogate for stderr. */
static output_buffer global_output_buffer; static diagnostic_context global_diagnostic_context;
output_buffer *diagnostic_buffer = &global_output_buffer; diagnostic_context *global_dc = &global_diagnostic_context;
/* This will be removed shortly. */
output_buffer *diagnostic_buffer = &global_diagnostic_context.buffer;
/* Function of last error message; /* Function of last error message;
more generally, function such that if next error message is in it more generally, function such that if next error message is in it
...@@ -126,10 +129,6 @@ static int last_error_tick; ...@@ -126,10 +129,6 @@ static int last_error_tick;
void (*print_error_function) PARAMS ((const char *)) = void (*print_error_function) PARAMS ((const char *)) =
default_print_error_function; default_print_error_function;
/* Hooks for language specific diagnostic messages pager and finalizer. */
diagnostic_starter_fn lang_diagnostic_starter;
diagnostic_finalizer_fn lang_diagnostic_finalizer;
/* Maximum characters per line in automatic line wrapping mode. /* Maximum characters per line in automatic line wrapping mode.
Zero means don't wrap lines. */ Zero means don't wrap lines. */
...@@ -189,8 +188,8 @@ initialize_diagnostics () ...@@ -189,8 +188,8 @@ initialize_diagnostics ()
/* Proceed to actual initialization. */ /* Proceed to actual initialization. */
default_initialize_buffer (diagnostic_buffer); default_initialize_buffer (diagnostic_buffer);
lang_diagnostic_starter = default_diagnostic_starter; diagnostic_starter (global_dc) = default_diagnostic_starter;
lang_diagnostic_finalizer = default_diagnostic_finalizer; diagnostic_finalizer (global_dc) = default_diagnostic_finalizer;
} }
void void
...@@ -1772,8 +1771,8 @@ set_diagnostic_context (dc, msgid, args_ptr, file, line, warn) ...@@ -1772,8 +1771,8 @@ set_diagnostic_context (dc, msgid, args_ptr, file, line, warn)
diagnostic_file_location (dc) = file; diagnostic_file_location (dc) = file;
diagnostic_line_location (dc) = line; diagnostic_line_location (dc) = line;
diagnostic_is_warning (dc) = warn; diagnostic_is_warning (dc) = warn;
diagnostic_starter (dc) = lang_diagnostic_starter; diagnostic_starter (dc) = diagnostic_starter (global_dc);
diagnostic_finalizer (dc) = lang_diagnostic_finalizer; diagnostic_finalizer (dc) = diagnostic_finalizer (global_dc);
} }
void void
......
...@@ -132,6 +132,11 @@ struct output_buffer ...@@ -132,6 +132,11 @@ struct output_buffer
the context of a diagnostic message. */ the context of a diagnostic message. */
struct diagnostic_context struct diagnostic_context
{ {
/* Where most of the diagnostic formatting work is done. In Object
Oriented terms, we'll say that diagnostic_context is a sub-class of
output_buffer. */
output_buffer buffer;
/* The diagnostic message to output. */ /* The diagnostic message to output. */
const char *message; const char *message;
...@@ -185,9 +190,6 @@ struct diagnostic_context ...@@ -185,9 +190,6 @@ struct diagnostic_context
extern printer_fn lang_printer; extern printer_fn lang_printer;
extern diagnostic_starter_fn lang_diagnostic_starter;
extern diagnostic_finalizer_fn lang_diagnostic_finalizer;
extern int diagnostic_message_length_per_line; extern int diagnostic_message_length_per_line;
/* This output buffer is used by front-ends that directly output /* This output buffer is used by front-ends that directly output
...@@ -196,6 +198,7 @@ extern int diagnostic_message_length_per_line; ...@@ -196,6 +198,7 @@ extern int diagnostic_message_length_per_line;
avoided. This global buffer will go away, once all such usage avoided. This global buffer will go away, once all such usage
has been removed. */ has been removed. */
extern output_buffer *diagnostic_buffer; extern output_buffer *diagnostic_buffer;
extern diagnostic_context *global_dc;
#define diagnostic_kind_count(BUFFER, DK) \ #define diagnostic_kind_count(BUFFER, DK) \
(BUFFER)->state.diagnostic_count[(int) DK] (BUFFER)->state.diagnostic_count[(int) DK]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment