diff options
author | Richard Stallman <rms@gnu.org> | 1992-11-30 23:07:11 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-11-30 23:07:11 +0000 |
commit | 5153d9d693cf55f66212390278efe0dc73b772c2 (patch) | |
tree | f2c3b55b4077782c4884d442aa33a2e6cdcce484 /gcc | |
parent | 0cd3c247a3b77a858b713e4da4271e4b9f6e31bb (diff) | |
download | gcc-5153d9d693cf55f66212390278efe0dc73b772c2.zip gcc-5153d9d693cf55f66212390278efe0dc73b772c2.tar.gz gcc-5153d9d693cf55f66212390278efe0dc73b772c2.tar.bz2 |
(va_arg): Copy both definitions from gstdarg.h.
From-SVN: r2821
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ginclude/varargs.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ginclude/varargs.h b/gcc/ginclude/varargs.h index b04dced..a66c72a 100644 --- a/gcc/ginclude/varargs.h +++ b/gcc/ginclude/varargs.h @@ -87,9 +87,19 @@ typedef void *__gnuc_va_list; #define __va_rounded_size(TYPE) \ (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#if defined (__arm__) || defined (__i386__) || defined (__ns32000__) || defined (__vax__) +/* This is for little-endian machines; small args are padded upward. */ #define va_arg(AP, TYPE) \ - (AP += __va_rounded_size (TYPE), \ - *((TYPE *) (AP - __va_rounded_size (TYPE)))) + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) +#else /* big-endian */ +/* This is for big-endian machines; small args are padded downward. */ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \ + ? sizeof (TYPE) \ + : __va_rounded_size (TYPE)))))) +#endif /* big-endian */ #endif /* not alpha */ #endif /* not i960 */ |