Commit 92c26242 by Gabriel Dos Reis Committed by Gabriel Dos Reis

diagnostic.c (output_octal): Second parameter is unsigned.

2000-07-10  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.c (output_octal): Second parameter is unsigned.
	(output_long_octal): Likewise.
	(output_hexadecimal): Likewise.
	(output_long_hexadecimal): Likewise.
	(output_format): Adjust arguments extraction. Tweak.
	(output_verbatim, verbatim): End variable argument list.
	(report_diagnostic): Improve documentation.

From-SVN: r34945
parent 5ecdf775
2000-07-10 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (output_octal): Second parameter is unsigned.
(output_long_octal): Likewise.
(output_hexadecimal): Likewise.
(output_long_hexadecimal): Likewise.
(output_format): Adjust arguments extraction. Tweak.
(output_verbatim, verbatim): End variable argument list.
(report_diagnostic): Improve documentation.
2000-07-10 Benjamin Chelf <chelf@codesourcery.com> 2000-07-10 Benjamin Chelf <chelf@codesourcery.com>
* c-common.h (build_stmt): Declare. * c-common.h (build_stmt): Declare.
......
...@@ -113,10 +113,11 @@ static void output_unsigned_decimal PARAMS ((output_buffer *, unsigned int)); ...@@ -113,10 +113,11 @@ static void output_unsigned_decimal PARAMS ((output_buffer *, unsigned int));
static void output_long_decimal PARAMS ((output_buffer *, long int)); static void output_long_decimal PARAMS ((output_buffer *, long int));
static void output_long_unsigned_decimal PARAMS ((output_buffer *, static void output_long_unsigned_decimal PARAMS ((output_buffer *,
long unsigned int)); long unsigned int));
static void output_octal PARAMS ((output_buffer *, int)); static void output_octal PARAMS ((output_buffer *, unsigned int));
static void output_long_octal PARAMS ((output_buffer *, long int)); static void output_long_octal PARAMS ((output_buffer *, unsigned long int));
static void output_hexadecimal PARAMS ((output_buffer *, int)); static void output_hexadecimal PARAMS ((output_buffer *, unsigned int));
static void output_long_hexadecimal PARAMS ((output_buffer *, long int)); static void output_long_hexadecimal PARAMS ((output_buffer *,
unsigned long int));
static void output_append_r PARAMS ((output_buffer *, const char *, int)); static void output_append_r PARAMS ((output_buffer *, const char *, int));
static void wrap_text PARAMS ((output_buffer *, const char *, const char *)); static void wrap_text PARAMS ((output_buffer *, const char *, const char *));
static void maybe_wrap_text PARAMS ((output_buffer *, const char *, static void maybe_wrap_text PARAMS ((output_buffer *, const char *,
...@@ -431,7 +432,7 @@ output_long_unsigned_decimal (buffer, i) ...@@ -431,7 +432,7 @@ output_long_unsigned_decimal (buffer, i)
static void static void
output_octal (buffer, i) output_octal (buffer, i)
output_buffer *buffer; output_buffer *buffer;
int i; unsigned int i;
{ {
output_formatted_integer (buffer, "%o", i); output_formatted_integer (buffer, "%o", i);
} }
...@@ -439,7 +440,7 @@ output_octal (buffer, i) ...@@ -439,7 +440,7 @@ output_octal (buffer, i)
static void static void
output_long_octal (buffer, i) output_long_octal (buffer, i)
output_buffer *buffer; output_buffer *buffer;
long int i; unsigned long int i;
{ {
output_formatted_integer (buffer, "%lo", i); output_formatted_integer (buffer, "%lo", i);
} }
...@@ -447,7 +448,7 @@ output_long_octal (buffer, i) ...@@ -447,7 +448,7 @@ output_long_octal (buffer, i)
static void static void
output_hexadecimal (buffer, i) output_hexadecimal (buffer, i)
output_buffer *buffer; output_buffer *buffer;
int i; unsigned int i;
{ {
output_formatted_integer (buffer, "%x", i); output_formatted_integer (buffer, "%x", i);
} }
...@@ -455,7 +456,7 @@ output_hexadecimal (buffer, i) ...@@ -455,7 +456,7 @@ output_hexadecimal (buffer, i)
static void static void
output_long_hexadecimal (buffer, i) output_long_hexadecimal (buffer, i)
output_buffer *buffer; output_buffer *buffer;
long int i; unsigned long int i;
{ {
output_formatted_integer (buffer, "%lx", i); output_formatted_integer (buffer, "%lx", i);
} }
...@@ -579,7 +580,6 @@ static void ...@@ -579,7 +580,6 @@ static void
output_format (buffer) output_format (buffer)
output_buffer *buffer; output_buffer *buffer;
{ {
const char *msg = buffer->cursor;
for (; *buffer->cursor; ++buffer->cursor) for (; *buffer->cursor; ++buffer->cursor)
{ {
int long_integer = 0; int long_integer = 0;
...@@ -624,9 +624,9 @@ output_format (buffer) ...@@ -624,9 +624,9 @@ output_format (buffer)
case 'o': case 'o':
if (long_integer) if (long_integer)
output_long_octal output_long_octal
(buffer, va_arg (buffer->format_args, long int)); (buffer, va_arg (buffer->format_args, unsigned long int));
else else
output_octal (buffer, va_arg (buffer->format_args, int)); output_octal (buffer, va_arg (buffer->format_args, unsigned int));
break; break;
case 's': case 's':
...@@ -645,9 +645,10 @@ output_format (buffer) ...@@ -645,9 +645,10 @@ output_format (buffer)
case 'x': case 'x':
if (long_integer) if (long_integer)
output_long_hexadecimal output_long_hexadecimal
(buffer, va_arg (buffer->format_args, long int)); (buffer, va_arg (buffer->format_args, unsigned long int));
else else
output_hexadecimal (buffer, va_arg (buffer->format_args, int)); output_hexadecimal
(buffer, va_arg (buffer->format_args, unsigned int));
break; break;
case '%': case '%':
...@@ -657,13 +658,15 @@ output_format (buffer) ...@@ -657,13 +658,15 @@ output_format (buffer)
case '.': case '.':
{ {
int n; int n;
const char *s;
/* We handle no precision specifier but `%.*s'. */ /* We handle no precision specifier but `%.*s'. */
if (*++buffer->cursor != '*') if (*++buffer->cursor != '*')
abort (); abort ();
else if (*++buffer->cursor != 's') else if (*++buffer->cursor != 's')
abort(); abort();
n = va_arg (buffer->format_args, int); n = va_arg (buffer->format_args, int);
output_append (buffer, msg, msg + n); s = va_arg (buffer->format_args, const char *);
output_append (buffer, s, s + n);
} }
break; break;
...@@ -1799,6 +1802,7 @@ output_verbatim VPARAMS ((output_buffer *buffer, const char *msg, ...)) ...@@ -1799,6 +1802,7 @@ output_verbatim VPARAMS ((output_buffer *buffer, const char *msg, ...))
msg = va_arg (ap, const char *); msg = va_arg (ap, const char *);
#endif #endif
output_do_verbatim (buffer, msg, ap); output_do_verbatim (buffer, msg, ap);
va_end (ap);
} }
/* Same as above but use diagnostic_buffer. */ /* Same as above but use diagnostic_buffer. */
...@@ -1816,12 +1820,15 @@ verbatim VPARAMS ((const char *msg, ...)) ...@@ -1816,12 +1820,15 @@ verbatim VPARAMS ((const char *msg, ...))
#endif #endif
output_do_verbatim (diagnostic_buffer, msg, ap); output_do_verbatim (diagnostic_buffer, msg, ap);
output_to_stream (diagnostic_buffer, stderr); output_to_stream (diagnostic_buffer, stderr);
va_end (ap);
} }
/* Report a diagnostic MESSAGE (an error or a WARNING) involving /* Report a diagnostic MESSAGE (an error or a WARNING) involving
entities in ARGUMENTS. FILE and LINE indicate where the diagnostic entities in ARGUMENTS. FILE and LINE indicate where the diagnostic
occurs. This function is *the* subroutine in terms of which front-ends occurs. This function is *the* subroutine in terms of which front-ends
should implement their specific diagnostic handling modules. */ should implement their specific diagnostic handling modules.
The front-end independent format specifiers are exactly those described
in the documentation of output_format. */
void void
report_diagnostic (msg, args, file, line, warn) report_diagnostic (msg, args, file, line, warn)
const char *msg; const char *msg;
......
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