va_list q

Peter Wemm peter at wemm.org
Thu Apr 22 10:24:55 PDT 2004


On Thursday 22 April 2004 01:24 am, Valentin Nechayev wrote:
>  Wed, Apr 21, 2004 at 22:58:01, peter wrote about "Re: va_list q":
> > amd64 needs to use the same code that is in the #ifdef __powerpc__.
> >  Its what we use in src/usr.sbin/pppd FWIW.
>
> Thanks, I couldn't find vfmtmsg() and thought it was introduced
> after.
>
> > On powerpc and amd64, the argument passing ABI is so complicated
> > that the sequence counters can't be fit in the spare bits in a
> > pointer like on the other platforms.  So on those two (and some
> > other) platforms, gcc implements va_list as a pointer to an
> > external structure.
> >
> > As an aside, this breaks code that assums it can copy va_lists by
> > assignment.  On powerpc and amd64, you *must* use va_copy(), or you
> > simply copy the pointer, not the actual argument passing state.
>
> I'll copy hack from system sources. But is it better to use
> va_copy()?

You can't use va_copy here.  The problem is what type do you give to 
va_arg() to pull a va_list off a va_list.  gcc is inconsistent with 
this.

But if this was copying args, you'd have to use va_copy.  But it 
isn't. :-)

>
> -netch-

-- 
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


More information about the freebsd-amd64 mailing list