From 348ab17b3d00ebf8a5d210ae05aab5f73765cf05 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sun, 16 May 1993 04:15:14 +0000 Subject: [PATCH] (va_arg) [__MIPSEB__]: After incrementing, subtract the rounded size, not the size proper. From-SVN: r4478 --- gcc/ginclude/va-mips.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/ginclude/va-mips.h b/gcc/ginclude/va-mips.h index ce96411854d..3d377be9abf 100644 --- a/gcc/ginclude/va-mips.h +++ b/gcc/ginclude/va-mips.h @@ -47,17 +47,23 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif #define va_end(__AP) -#ifdef lint /* complains about constant in conditional context */ -#define va_arg(list, mode) ((mode *)(list += __va_rounded_size(mode)))[-1] - -#else /* !lint */ /* We cast to void * and then to TYPE * because this avoids a warning about increasing the alignment requirement. */ +#ifdef __MIPSEB__ +/* For big-endian machines. */ +#define va_arg(__AP, __type) \ + ((__AP = (char *) ((__alignof__ (__type) > 4 \ + ? ((int)__AP + 8 - 1) & -8 \ + : ((int)__AP + 4 - 1) & -4) \ + + __va_rounded_size (__type))), \ + *(__type *) (void *) (__AP - __va_rounded_size (__type))) +#else +/* For little-endian machines. */ #define va_arg(__AP, __type) \ ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ ? ((int)__AP + 8 - 1) & -8 \ : ((int)__AP + 4 - 1) & -4) \ + __va_rounded_size(__type))))[-1] -#endif /* lint */ +#endif #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ -- 2.30.2