This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: va_list: ppc


At 11:55 06.08.99 , Richard Henderson wrote:
>On Fri, Aug 06, 1999 at 11:46:21AM +0200, Franz Sirl wrote:
> > I believe the first
> > line now needs a different access macro with the "struct in array" setup.
> >
> >    f_gpr = TYPE_FIELDS (va_list_type_node);
> >    f_fpr = TREE_CHAIN (f_gpr);
> >    f_ovf = TREE_CHAIN (f_fpr);
> >    f_sav = TREE_CHAIN (f_ovf);
>
>Oh, duh.  Try
>
>         f_gpr = TYPE_FIELDS (TREE_TYPE (va_list_type_node));

Yippie, this works fine :-).

Only one nit, I changed it in both va_start and va_arg, but now I get:

varargs3.c: In function `vvafunc':
varargs3.c:10: first argument to `__builtin_va_arg' not of type `va_list'
varargs3.c:12: first argument to `__builtin_va_arg' not of type `va_list'

for this testcase:
#include <stdarg.h>
int vvafunc(int fp, int fmt,va_list ap)
{
        if ( fp != 1)
              abort();
        if ( fmt != 2)
              abort();
        if ( va_arg(ap,int) != 3)
              abort();
        if ( va_arg(ap,int) != 4)
              abort();

    return 0;
}
int vafunc2(int fmt,...)
{
    va_list ap;

    va_start(ap,fmt);
    vvafunc(1, fmt, ap);
    va_end(ap);

    return 0;
}
int main(void)
{
      vafunc2(2, 3, 4);
      exit(0);
}

The rest of my testcases works fine.

Franz.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]