summaryrefslogtreecommitdiffstats
path: root/gcc/ginclude
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ginclude')
-rw-r--r--gcc/ginclude/stdarg.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h
index 4ee9bb9ae6c..2b360685559 100644
--- a/gcc/ginclude/stdarg.h
+++ b/gcc/ginclude/stdarg.h
@@ -62,14 +62,26 @@ typedef void *__gnuc_va_list;
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg ()))
+#undef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#define va_end(AP)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
+
+#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 = (__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 /* _STDARG_H */
#endif /* not alpha */
OpenPOWER on IntegriCloud