+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,
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 *));
{
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);
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
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);
}
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);
}
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
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);
}