diagnostic.h (output_formatted_scalar): Tweak.
* diagnostic.h (output_formatted_scalar): Tweak. * diagnostic.c (output_long_decimal): Likewise. (output_unsigned_decimal): Likewise. (output_long_unsigned_decimal): Likewise. (output_octal): Likewise. (output_long_octal): Likewise. (output_hexadecimal): Likewise. (output_long_hexadecimal): Likewise. (output_pointer): New function. (output_format): Use it. Recognize "%p" format specifier. From-SVN: r66287
This commit is contained in:
parent
b2a7fa89ee
commit
10256cf5f6
3 changed files with 41 additions and 31 deletions
|
@ -1,3 +1,16 @@
|
|||
2003-04-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* diagnostic.h (output_formatted_scalar): Tweak.
|
||||
* diagnostic.c (output_long_decimal): Likewise.
|
||||
(output_unsigned_decimal): Likewise.
|
||||
(output_long_unsigned_decimal): Likewise.
|
||||
(output_octal): Likewise.
|
||||
(output_long_octal): Likewise.
|
||||
(output_hexadecimal): Likewise.
|
||||
(output_long_hexadecimal): Likewise.
|
||||
(output_pointer): New function.
|
||||
(output_format): Use it. Recognize "%p" format specifier.
|
||||
|
||||
2003-04-30 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
|
||||
|
||||
* function.c (purge_addressof_1): Postpone insn in fewer cases.
|
||||
|
|
|
@ -307,62 +307,54 @@ output_decimal (buffer, i)
|
|||
output_formatted_scalar (buffer, "%d", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_long_decimal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
long int i;
|
||||
static inline void
|
||||
output_long_decimal (output_buffer *buffer, long int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%ld", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_unsigned_decimal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
unsigned int i;
|
||||
static inline void
|
||||
output_unsigned_decimal (output_buffer *buffer, unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%u", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_long_unsigned_decimal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
long unsigned int i;
|
||||
static inline void
|
||||
output_long_unsigned_decimal (output_buffer *buffer, long unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%lu", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_octal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
unsigned int i;
|
||||
static inline void
|
||||
output_octal (output_buffer *buffer, unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%o", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_long_octal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
unsigned long int i;
|
||||
static inline void
|
||||
output_long_octal (output_buffer *buffer, long unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%lo", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_hexadecimal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
unsigned int i;
|
||||
static inline void
|
||||
output_hexadecimal (output_buffer *buffer, unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%x", i);
|
||||
}
|
||||
|
||||
static void
|
||||
output_long_hexadecimal (buffer, i)
|
||||
output_buffer *buffer;
|
||||
unsigned long int i;
|
||||
static inline void
|
||||
output_long_hexadecimal (output_buffer *buffer, long unsigned int i)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%lx", i);
|
||||
}
|
||||
|
||||
static inline void
|
||||
output_pointer (output_buffer *buffer, void *p)
|
||||
{
|
||||
output_formatted_scalar (buffer, "%p", p);
|
||||
}
|
||||
|
||||
/* Append to BUFFER a string specified by its STARTING character
|
||||
and LENGTH. */
|
||||
static void
|
||||
|
@ -497,6 +489,7 @@ output_buffer_to_stream (buffer)
|
|||
%ld, %li, %lo, %lu, %lx: long versions of the above.
|
||||
%c: character.
|
||||
%s: string.
|
||||
%p: pointer.
|
||||
%%: `%'.
|
||||
%*.s: a substring the length of which is specified by an integer.
|
||||
%H: location_t. */
|
||||
|
@ -530,7 +523,7 @@ output_format (buffer, text)
|
|||
}
|
||||
|
||||
/* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %o, %s, %u,
|
||||
%x, %.*s; %%. And nothing else. Front-ends should install
|
||||
%x, %p, %.*s; %%. And nothing else. Front-ends should install
|
||||
printers to grok language specific format specifiers. */
|
||||
switch (*text->format_spec)
|
||||
{
|
||||
|
@ -558,6 +551,10 @@ output_format (buffer, text)
|
|||
output_add_string (buffer, va_arg (*text->args_ptr, const char *));
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
output_pointer (buffer, va_arg (*text->args_ptr, void *));
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
if (long_integer)
|
||||
output_long_unsigned_decimal
|
||||
|
|
|
@ -160,10 +160,10 @@ struct output_buffer
|
|||
/* True if BUFFER is in line-wrapping mode. */
|
||||
#define output_is_line_wrapping(BUFFER) (output_line_cutoff (BUFFER) > 0)
|
||||
|
||||
#define output_formatted_scalar(BUFFER, FORMAT, INTEGER) \
|
||||
#define output_formatted_scalar(BUFFER, FORMAT, SCALAR) \
|
||||
do \
|
||||
{ \
|
||||
sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER); \
|
||||
sprintf ((BUFFER)->digit_buffer, FORMAT, SCALAR); \
|
||||
output_add_string (BUFFER, (BUFFER)->digit_buffer); \
|
||||
} \
|
||||
while (0)
|
||||
|
|
Loading…
Add table
Reference in a new issue