From 3d7c9b7e5b96c13586119a25e4e6141f060bf79d Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Fri, 23 Feb 2001 17:28:25 +0000 Subject: [PATCH] diagnostic.c (output_to_stream): Rename to output_buffer_to_stream. * diagnostic.c (output_to_stream): Rename to output_buffer_to_stream. Loses the stream parameter. (init_output_buffer): Set diagnosic_buffer's stream. (flush_diagnostic_buffer): Adjust. (default_print_error_function): Likewise. (finish_diagnostic): Likewise. (verbatim): Likewise. * diagnostic.h (struct output_buffer): Add `stream' field. (output_buffer_attached_stream): New macro. From-SVN: r39999 --- gcc/ChangeLog | 13 +++++++++++++ gcc/diagnostic.c | 25 +++++++++++++------------ gcc/diagnostic.h | 3 +++ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3ad2434057..e87303d23e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2001-02-23 Gabriel Dos Reis + + * diagnostic.c (output_to_stream): Rename to + output_buffer_to_stream. Loses the stream parameter. + (init_output_buffer): Set diagnosic_buffer's stream. + (flush_diagnostic_buffer): Adjust. + (default_print_error_function): Likewise. + (finish_diagnostic): Likewise. + (verbatim): Likewise. + + * diagnostic.h (struct output_buffer): Add `stream' field. + (output_buffer_attached_stream): New macro. + 2001-02-23 Jakub Jelinek * fold-const.c (extract_muldiv) [case PLUS_EXPR]: If not MULT_EXPR, diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 32688b39f08..24aa3489412 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -65,7 +65,7 @@ Boston, MA 02111-1307, USA. */ static void finish_diagnostic PARAMS ((void)); static void output_do_verbatim PARAMS ((output_buffer *, const char *, va_list *)); -static void output_to_stream PARAMS ((output_buffer *, FILE *)); +static void output_buffer_to_stream PARAMS ((output_buffer *)); static void output_format PARAMS ((output_buffer *)); static void output_indent PARAMS ((output_buffer *)); @@ -340,6 +340,7 @@ init_output_buffer (buffer, prefix, maximum_length) { memset (buffer, 0, sizeof (output_buffer)); obstack_init (&buffer->obstack); + output_buffer_attached_stream (buffer) = stderr; ideal_line_wrap_cutoff (buffer) = maximum_length; prefixing_policy (buffer) = current_prefixing_rule; output_set_prefix (buffer, prefix); @@ -393,8 +394,8 @@ output_finalize_message (buffer) void flush_diagnostic_buffer () { - output_to_stream (diagnostic_buffer, stderr); - fflush (stderr); + output_buffer_to_stream (diagnostic_buffer); + fflush (output_buffer_attached_stream (diagnostic_buffer)); } /* Return the amount of characters BUFFER can accept to @@ -654,15 +655,15 @@ output_add_string (buffer, str) maybe_wrap_text (buffer, str, str + (str ? strlen (str) : 0)); } -/* Flush the content of BUFFER onto FILE and reinitialize BUFFER. */ +/* Flush the content of BUFFER onto the attached stream, + and reinitialize. */ static void -output_to_stream (buffer, file) +output_buffer_to_stream (buffer) output_buffer *buffer; - FILE *file; { const char *text = output_finalize_message (buffer); - fputs (text, file); + fputs (text, output_buffer_attached_stream (buffer)); output_clear_message_text (buffer); } @@ -1294,7 +1295,7 @@ default_print_error_function (file) output_add_newline (diagnostic_buffer); record_last_error_function (); - output_to_stream (diagnostic_buffer, stderr); + output_buffer_to_stream (diagnostic_buffer); output_buffer_state (diagnostic_buffer) = os; free ((char*) prefix); } @@ -1600,10 +1601,10 @@ warning VPARAMS ((const char *msgid, ...)) static void finish_diagnostic () { - output_to_stream (diagnostic_buffer, stderr); + output_buffer_to_stream (diagnostic_buffer); clear_diagnostic_info (diagnostic_buffer); - fputc ('\n', stderr); - fflush (stderr); + fputc ('\n', output_buffer_attached_stream (diagnostic_buffer)); + fflush (output_buffer_attached_stream (diagnostic_buffer)); } /* Helper subroutine of output_verbatim and verbatim. Do the approriate @@ -1662,7 +1663,7 @@ verbatim VPARAMS ((const char *msg, ...)) msg = va_arg (ap, const char *); #endif output_do_verbatim (diagnostic_buffer, msg, &ap); - output_to_stream (diagnostic_buffer, stderr); + output_buffer_to_stream (diagnostic_buffer); va_end (ap); } diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 5217e384b9d..eb7594e16fc 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -80,6 +80,8 @@ struct output_buffer /* Internal data. These fields should not be accessed directly by front-ends. */ + /* Where to output formatted text. */ + FILE* stream; /* The obstack where the text is built up. */ struct obstack obstack; /* The amount of characters output so far. */ @@ -88,6 +90,7 @@ struct output_buffer output_state state; }; +#define output_buffer_attached_stream(BUFFER) (BUFFER)->stream #define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor #define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args) #define output_needs_newline(BUFFER) (BUFFER)->state.need_newline_p -- 2.30.2