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
This commit is contained in:
Gabriel Dos Reis 2001-02-23 17:28:25 +00:00 committed by Gabriel Dos Reis
parent fba2c0cdbc
commit 3d7c9b7e5b
3 changed files with 29 additions and 12 deletions

View File

@ -1,3 +1,16 @@
2001-02-23 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* 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 <jakub@redhat.com>
* fold-const.c (extract_muldiv) [case PLUS_EXPR]: If not MULT_EXPR,

View File

@ -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);
}

View File

@ -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