1991-09-12 18:22:50 -04:00
|
|
|
/* ---------------------------------------- */
|
|
|
|
/* VARARGS for MIPS/GNU CC */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* ---------------------------------------- */
|
|
|
|
|
|
|
|
|
1992-06-26 04:38:37 -04:00
|
|
|
/* These macros implement varargs for GNU C--either traditional or ANSU. */
|
|
|
|
|
|
|
|
/* Define __gnuc_va_list. */
|
|
|
|
|
|
|
|
#ifndef __GNUC_VA_LIST
|
|
|
|
#define __GNUC_VA_LIST
|
|
|
|
typedef char * __gnuc_va_list;
|
|
|
|
#endif /* not __GNUC_VA_LIST */
|
|
|
|
|
|
|
|
/* If this is for internal libc use, don't define anything but
|
|
|
|
__gnuc_va_list. */
|
|
|
|
#if defined (_STDARG_H) || defined (_VARARGS_H)
|
1991-09-12 18:22:50 -04:00
|
|
|
|
|
|
|
/* In GCC version 2, we want an ellipsis at the end of the declaration
|
|
|
|
of the argument list. GCC version 1 can't parse it. */
|
|
|
|
|
|
|
|
#if __GNUC__ > 1
|
|
|
|
#define __va_ellipsis ...
|
|
|
|
#else
|
|
|
|
#define __va_ellipsis
|
|
|
|
#endif
|
|
|
|
|
1994-01-13 18:54:09 -05:00
|
|
|
#if __mips==3
|
|
|
|
#define __va_rounded_size(__TYPE) \
|
|
|
|
(((sizeof (__TYPE) + 8 - 1) / 8) * 8)
|
|
|
|
#else
|
1992-09-09 10:12:07 -04:00
|
|
|
#define __va_rounded_size(__TYPE) \
|
|
|
|
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
1994-01-13 18:54:09 -05:00
|
|
|
#endif
|
1992-01-30 15:37:09 -05:00
|
|
|
|
|
|
|
#ifdef _STDARG_H
|
1994-08-14 19:03:47 -04:00
|
|
|
#define va_start(__AP, __LASTARG) \
|
|
|
|
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
|
1992-09-09 10:12:07 -04:00
|
|
|
|
1992-01-30 15:37:09 -05:00
|
|
|
#else
|
1992-05-26 00:05:00 -04:00
|
|
|
#define va_alist __builtin_va_alist
|
1994-01-13 18:54:09 -05:00
|
|
|
#if __mips==3
|
|
|
|
/* This assumes that `long long int' is always a 64 bit type. */
|
|
|
|
#define va_dcl long long int __builtin_va_alist; __va_ellipsis
|
|
|
|
#else
|
1992-05-26 00:05:00 -04:00
|
|
|
#define va_dcl int __builtin_va_alist; __va_ellipsis
|
1994-01-13 18:54:09 -05:00
|
|
|
#endif
|
1992-09-09 10:12:07 -04:00
|
|
|
#define va_start(__AP) __AP = (char *) &__builtin_va_alist
|
1992-01-30 15:37:09 -05:00
|
|
|
#endif
|
|
|
|
|
1992-11-03 02:59:13 -05:00
|
|
|
#ifndef va_end
|
1992-06-26 04:38:37 -04:00
|
|
|
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
1992-11-03 02:59:13 -05:00
|
|
|
#endif
|
1992-09-09 10:12:07 -04:00
|
|
|
#define va_end(__AP)
|
1991-09-12 18:22:50 -04:00
|
|
|
|
1992-09-15 01:08:02 -04:00
|
|
|
/* We cast to void * and then to TYPE * because this avoids
|
|
|
|
a warning about increasing the alignment requirement. */
|
1994-01-13 18:54:09 -05:00
|
|
|
#if __mips==3
|
|
|
|
#define va_arg(__AP, __type) \
|
|
|
|
((__type *) (void *) (__AP = (char *) ((((int)__AP + 8 - 1) & -8) \
|
|
|
|
+ __va_rounded_size (__type))))[-1]
|
|
|
|
#else
|
1993-05-16 00:15:14 -04:00
|
|
|
#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. */
|
1992-09-15 01:08:02 -04:00
|
|
|
#define va_arg(__AP, __type) \
|
1993-05-10 11:51:47 -04:00
|
|
|
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
|
1992-09-15 01:08:02 -04:00
|
|
|
? ((int)__AP + 8 - 1) & -8 \
|
|
|
|
: ((int)__AP + 4 - 1) & -4) \
|
|
|
|
+ __va_rounded_size(__type))))[-1]
|
1993-05-16 00:15:14 -04:00
|
|
|
#endif
|
1994-01-13 18:54:09 -05:00
|
|
|
#endif
|
1991-09-12 18:22:50 -04:00
|
|
|
|
1992-06-26 04:38:37 -04:00
|
|
|
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
|