This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: varargs fix for array 'va_list'.
> Date: Thu, 23 Mar 2000 23:49:18 -0800
> From: Richard Henderson <rth@cygnus.com>
> Cc: gcc-patches@gcc.gnu.org
>
> > ! stabilize_va_list (valist, needs_lvalue)
> > tree valist;
> > ! int needs_lvalue ATTRIBUTE_UNUSED;
>
> You don't enforce needs_lvalue anywhere? What are you
> going to do with
>
> __builtin_stdarg_start(args+0)
> __builtin_stdarg_start(foo())
>
> If you can give an error, perfect, but I'm thinking it
> might be as bad as a crash.
Hmmm. I'll look at it.
> You waid you tried the reference thing and it failed?
> Was that just for ppc's array type, or in general? Cause
> there's nothing saying the internal prototype can't
> depend on the class of va_list_type.
It turns out that
struct foo;
typedef struct foo t[1];
extern void bar (t &);
void foo (t s)
{
bar (s);
}
which is what we want to do, is not legal C++:
t.cc: In function `void foo (foo *)':
t.cc:8: could not convert `s' to `foo (&)[1]'
t.cc:4: in passing argument 1 of `bar (foo (&)[1])'
Sigh. But now that you mention it, perhaps we _could_ do it for the
non-array case... I'll look into that too.
--
- Geoffrey Keating <geoffk@cygnus.com>