summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-17 22:21:35 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-17 22:21:35 +0000
commitee582a61a63edc4257e8bb2f52ab65356f165249 (patch)
tree719ac752ade2a25c0a0f01395e94e785860a6b61 /gcc/diagnostic.c
parent759a79416513f4efdccce8c5c4dc34cd7021cc2a (diff)
downloadgcc-ee582a61a63edc4257e8bb2f52ab65356f165249.tar.gz
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66919 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c136
1 files changed, 62 insertions, 74 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 53399fcf4a8..6d254337ce7 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -636,16 +636,14 @@ output_format (buffer, text)
/* Return a malloc'd string containing MSG formatted a la printf. The
caller is responsible for freeing the memory. */
static char *
-build_message_string VPARAMS ((const char *msg, ...))
+build_message_string (const char *msg, ...)
{
char *str;
+ va_list ap;
- VA_OPEN (ap, msg);
- VA_FIXEDARG (ap, const char *, msg);
-
+ va_start (ap, msg);
vasprintf (&str, msg, ap);
-
- VA_CLOSE (ap);
+ va_end (ap);
return str;
}
@@ -660,18 +658,17 @@ file_name_as_prefix (f)
/* Format a message into BUFFER a la printf. */
void
-output_printf VPARAMS ((struct output_buffer *buffer, const char *msgid, ...))
+output_printf (struct output_buffer *buffer, const char *msgid, ...)
{
text_info text;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, output_buffer *, buffer);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
text.err_no = errno;
text.args_ptr = &ap;
text.format_spec = _(msgid);
output_format (buffer, &text);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* Print a message relevant to the given DECL. */
@@ -756,18 +753,17 @@ output_do_verbatim (buffer, text)
/* Output MESSAGE verbatim into BUFFER. */
void
-output_verbatim VPARAMS ((output_buffer *buffer, const char *msgid, ...))
+output_verbatim (output_buffer *buffer, const char *msgid, ...)
{
text_info text;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, output_buffer *, buffer);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
text.err_no = errno;
text.args_ptr = &ap;
text.format_spec = _(msgid);
output_do_verbatim (buffer, &text);
- VA_CLOSE (ap);
+ va_end (ap);
}
@@ -1184,50 +1180,48 @@ trim_filename (name)
/* Text to be emitted verbatim to the error message stream; this
produces no prefix and disables line-wrapping. Use rarely. */
void
-verbatim VPARAMS ((const char *msgid, ...))
+verbatim (const char *msgid, ...)
{
text_info text;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
text.err_no = errno;
text.args_ptr = &ap;
text.format_spec = _(msgid);
output_do_verbatim (&global_dc->buffer, &text);
output_buffer_to_stream (&global_dc->buffer);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* An informative note. Use this for additional details on an error
message. */
void
-inform VPARAMS ((const char *msgid, ...))
+inform (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_NOTE);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* A warning. Use this for code which is correct according to the
relevant language specification but is likely to be buggy anyway. */
void
-warning VPARAMS ((const char *msgid, ...))
+warning (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_WARNING);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* A "pedantic" warning: issues a warning unless -pedantic-errors was
@@ -1239,66 +1233,63 @@ warning VPARAMS ((const char *msgid, ...))
of the -pedantic command-line switch. To get a warning enabled
only with that switch, write "if (pedantic) pedwarn (...);" */
void
-pedwarn VPARAMS ((const char *msgid, ...))
+pedwarn (const char *msgid, ...)
{
diagnostic_info diagnostic;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
pedantic_error_kind ());
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* A hard error: the code is definitely ill-formed, and an object file
will not be produced. */
void
-error VPARAMS ((const char *msgid, ...))
+error (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_ERROR);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* "Sorry, not implemented." Use for a language feature which is
required by the relevant specification but not implemented by GCC.
An object file will not be produced. */
void
-sorry VPARAMS ((const char *msgid, ...))
+sorry (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_SORRY);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* An error which is severe enough that we make no attempt to
continue. Do not use this for internal consistency checks; that's
internal_error. Use of this function should be rare. */
void
-fatal_error VPARAMS ((const char *msgid, ...))
+fatal_error (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_FATAL);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
/* NOTREACHED */
real_abort ();
@@ -1309,17 +1300,16 @@ fatal_error VPARAMS ((const char *msgid, ...))
a more specific message, or some other good reason, you should use
abort () instead of calling this function directly. */
void
-internal_error VPARAMS ((const char *msgid, ...))
+internal_error (const char *msgid, ...)
{
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
-
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_ICE);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
/* NOTREACHED */
real_abort ();
@@ -1329,12 +1319,12 @@ internal_error VPARAMS ((const char *msgid, ...))
DECL node. These are deprecated. */
void
-warning_with_decl VPARAMS ((tree decl, const char *msgid, ...))
+warning_with_decl (tree decl, const char *msgid, ...)
{
diagnostic_info diagnostic;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, tree, decl);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+
+ va_start (ap, msgid);
/* Do not issue a warning about a decl which came from a system header,
unless -Wsystem-headers. */
@@ -1345,16 +1335,16 @@ warning_with_decl VPARAMS ((tree decl, const char *msgid, ...))
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DK_WARNING);
diagnostic_for_decl (global_dc, &diagnostic, decl);
- VA_CLOSE (ap);
+ va_end (ap);
}
void
-pedwarn_with_decl VPARAMS ((tree decl, const char *msgid, ...))
+pedwarn_with_decl (tree decl, const char *msgid, ...)
{
diagnostic_info diagnostic;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, tree, decl);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+
+ va_start (ap, msgid);
/* Do not issue a warning about a decl which came from a system header,
unless -Wsystem-headers. */
@@ -1366,22 +1356,21 @@ pedwarn_with_decl VPARAMS ((tree decl, const char *msgid, ...))
pedantic_error_kind ());
diagnostic_for_decl (global_dc, &diagnostic, decl);
- VA_CLOSE (ap);
+ va_end (ap);
}
void
-error_with_decl VPARAMS ((tree decl, const char *msgid, ...))
+error_with_decl (tree decl, const char *msgid, ...)
{
diagnostic_info diagnostic;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, tree, decl);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DK_ERROR);
diagnostic_for_decl (global_dc, &diagnostic, decl);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* Special case error functions. Most are implemented in terms of the
@@ -1390,14 +1379,13 @@ error_with_decl VPARAMS ((tree decl, const char *msgid, ...))
/* Print a diagnostic MSGID on FILE. This is just fprintf, except it
runs its second argument through gettext. */
void
-fnotice VPARAMS ((FILE *file, const char *msgid, ...))
+fnotice (FILE *file, const char *msgid, ...)
{
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, FILE *, file);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_list ap;
+ va_start (ap, msgid);
vfprintf (file, _(msgid), ap);
- VA_CLOSE (ap);
+ va_end (ap);
}
/* Warn about a use of an identifier which was marked deprecated. */