Commit 6f81b1ad by Richard Henderson Committed by Richard Henderson

diagnostic.c (init_output_buffer): Don't initialize format_args.

        * diagnostic.c (init_output_buffer): Don't initialize format_args.
        (output_clear): Likewise.
        (output_printf): Use va_copy.
        (vline_wrapper_message_with_location): Likewise.
        (v_message_with_decl): Likewise.
        (line_wrapper_printf): VA_START infor buffer.format_args directly.
        * system.h (va_copy): Provide default implementation.

From-SVN: r33341
parent d9490f2f
2000-04-22 Richard Henderson <rth@cygnus.com> 2000-04-22 Richard Henderson <rth@cygnus.com>
* diagnostic.c (init_output_buffer): Don't initialize format_args.
(output_clear): Likewise.
(output_printf): Use va_copy.
(vline_wrapper_message_with_location): Likewise.
(v_message_with_decl): Likewise.
(line_wrapper_printf): VA_START infor buffer.format_args directly.
* system.h (va_copy): Provide default implementation.
2000-04-22 Richard Henderson <rth@cygnus.com>
* predict.c (expected_value_to_br_prob): Don't bomb if op1 of * predict.c (expected_value_to_br_prob): Don't bomb if op1 of
the collected condition is not a constant. the collected condition is not a constant.
......
...@@ -198,7 +198,6 @@ init_output_buffer (buffer, prefix, maximum_length) ...@@ -198,7 +198,6 @@ init_output_buffer (buffer, prefix, maximum_length)
output_set_prefix (buffer, prefix); output_set_prefix (buffer, prefix);
buffer->cursor = NULL; buffer->cursor = NULL;
buffer->format_args = NULL;
} }
/* Reinitialize BUFFER. */ /* Reinitialize BUFFER. */
...@@ -209,7 +208,6 @@ output_clear (buffer) ...@@ -209,7 +208,6 @@ output_clear (buffer)
obstack_free (&buffer->obstack, obstack_base (&buffer->obstack)); obstack_free (&buffer->obstack, obstack_base (&buffer->obstack));
buffer->line_length = 0; buffer->line_length = 0;
buffer->cursor = NULL; buffer->cursor = NULL;
buffer->format_args = NULL;
} }
/* Finishes to construct a NULL-terminated character string representing /* Finishes to construct a NULL-terminated character string representing
...@@ -493,7 +491,7 @@ output_printf VPARAMS ((struct output_buffer *buffer, const char *msgid, ...)) ...@@ -493,7 +491,7 @@ output_printf VPARAMS ((struct output_buffer *buffer, const char *msgid, ...))
msgid = va_arg (ap, const char *); msgid = va_arg (ap, const char *);
#endif #endif
buffer->format_args = ap; va_copy (buffer->format_args, ap);
output_notice (buffer, msgid); output_notice (buffer, msgid);
va_end (buffer->format_args); va_end (buffer->format_args);
} }
...@@ -510,17 +508,15 @@ line_wrapper_printf VPARAMS ((FILE *file, const char *msgid, ...)) ...@@ -510,17 +508,15 @@ line_wrapper_printf VPARAMS ((FILE *file, const char *msgid, ...))
const char *msgid; const char *msgid;
#endif #endif
output_buffer buffer; output_buffer buffer;
va_list ap;
VA_START (ap, msgid); init_output_buffer (&buffer, NULL, output_maximum_width);
VA_START (buffer.format_args, msgid);
#ifndef ANSI_PROTOTYPES #ifndef ANSI_PROTOTYPES
file = va_arg (ap, FILE *); file = va_arg (buffer.format_args, FILE *);
msgid = va_arg (ap, const char *); msgid = va_arg (buffer.format_args, const char *);
#endif #endif
init_output_buffer (&buffer, NULL, output_maximum_width);
buffer.format_args = ap;
output_notice (&buffer, msgid); output_notice (&buffer, msgid);
output_flush_on (&buffer, file); output_flush_on (&buffer, file);
...@@ -538,9 +534,9 @@ vline_wrapper_message_with_location (file, line, warn, msgid, ap) ...@@ -538,9 +534,9 @@ vline_wrapper_message_with_location (file, line, warn, msgid, ap)
{ {
output_buffer buffer; output_buffer buffer;
init_output_buffer init_output_buffer (&buffer, build_location_prefix (file, line, warn),
(&buffer, build_location_prefix (file, line, warn), output_maximum_width); output_maximum_width);
buffer.format_args = ap; va_copy (buffer.format_args, ap);
output_notice (&buffer, msgid); output_notice (&buffer, msgid);
output_flush_on (&buffer, stderr); output_flush_on (&buffer, stderr);
...@@ -681,9 +677,9 @@ v_message_with_decl (decl, warn, msgid, ap) ...@@ -681,9 +677,9 @@ v_message_with_decl (decl, warn, msgid, ap)
{ {
if (doing_line_wrapping ()) if (doing_line_wrapping ())
{ {
buffer.format_args = ap; va_copy (buffer.format_args, ap);
output_notice (&buffer, p); output_notice (&buffer, p);
ap = buffer.format_args; va_copy (ap, buffer.format_args);
} }
else else
vfprintf (stderr, p, ap); vfprintf (stderr, p, ap);
......
...@@ -35,6 +35,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -35,6 +35,14 @@ Boston, MA 02111-1307, USA. */
#include <varargs.h> #include <varargs.h>
#endif #endif
#ifndef va_copy
# ifdef __va_copy
# define va_copy(d,s) __va_copy((d),(s))
# else
# define va_copy(d,s) ((d) = (s))
# endif
#endif
#include <stdio.h> #include <stdio.h>
/* Define a generic NULL if one hasn't already been defined. */ /* Define a generic NULL if one hasn't already been defined. */
......
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