va_arg *, and why not.
Mark Mitchell
mark@codesourcery.com
Sun Jul 16 19:00:00 GMT 2000
>>>>> "Geoff" == Geoff Keating <geoffk@cygnus.com> writes:
Geoff> 1. implement va_copy, by using an autoconf test to
Geoff> determine whether or not va_list is an array type; or
Geoff> 2. only pass around va_list *.
Geoff> This breaks the bootstrap on powerpc-linux.
Fascinating.
I see that libiberty's vasprintf has:
static int
int_vasprintf (result, format, args)
char **result;
const char *format;
va_list *args;
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */
int total_width = strlen (format) + 1;
va_list ap;
memcpy ((PTR) &ap, (PTR) args, sizeof (va_list));
and a bit later:
int
vasprintf (result, format, args)
char **result;
const char *format;
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
_BSD_VA_LIST_ args;
#else
va_list args;
#endif
{
return int_vasprintf (result, format, &args);
}
Does that not work on your platform? If not, this code should be
changed, too.
I think that the right solution here is that the diagnostic buffer to
contain a va_list, and that we initialize it either with va_copy (if
available) or an as-yet-nonexistant libiberty equivalent, presumably
using the `memcpy' trick shown above.
Gaby, please take care of this as soon as possible so that we can get
Geoff back into bootstrap-land.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-bugs
mailing list