2 /* Use the system's macros with the system's compiler. */
5 /* Record that this is varargs.h; this turns off stdarg.h. */
26 #include <va-clipper.h>
31 #if defined(__hppa__) || defined(hp800)
40 #if defined (__H8300__) || defined (__H8300H__)
46 /* On Next, erase any vestiges of stdarg.h. */
48 #ifdef _ANSI_STDARG_H_
51 #define _ANSI_STDARG_H_
58 #undef __va_rounded_size
62 /* In GCC version 2, we want an ellipsis at the end of the declaration
63 of the argument list. GCC version 1 can't parse it. */
66 #define __va_ellipsis ...
71 /* These macros implement traditional (non-ANSI) varargs
74 #define va_alist __builtin_va_alist
75 /* The ... causes current_function_varargs to be set in cc1. */
76 #define va_dcl int __builtin_va_alist; __va_ellipsis
78 /* Define __gnuc_va_list, just as in gstdarg.h. */
80 #ifndef __GNUC_VA_LIST
81 #define __GNUC_VA_LIST
82 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
83 typedef char *__gnuc_va_list;
85 typedef void *__gnuc_va_list;
89 #define va_start(AP) AP=(char *) &__builtin_va_alist
94 #define __va_rounded_size(TYPE) \
95 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
97 #define __va_rounded_size(TYPE) \
98 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
101 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
102 /* This is for little-endian machines; small args are padded upward. */
103 #define va_arg(AP, TYPE) \
104 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
105 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
106 #else /* big-endian */
107 /* This is for big-endian machines; small args are padded downward. */
108 #define va_arg(AP, TYPE) \
109 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
110 *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \
112 : __va_rounded_size (TYPE))))))
113 #endif /* big-endian */
115 #endif /* not h8300 */
116 #endif /* not alpha */
117 #endif /* not i960 */
118 #endif /* not hppa */
119 #endif /* not m88k */
120 #endif /* not clipper */
122 #endif /* not i860 */
123 #endif /* not mips */
124 #endif /* not spur */
125 #endif /* not sparc */
126 #endif /* not _VARARGS_H */
128 /* Define va_list from __gnuc_va_list. */
130 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
135 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
136 so we must avoid testing it and setting it here.
137 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
138 have no conflict with that. */
143 #define _VA_LIST va_list
145 #endif /* __i860__ */
146 typedef __gnuc_va_list va_list;
147 #endif /* _VA_LIST_ */
149 #else /* not __svr4__ */
151 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
152 But on BSD NET2 we must not test or define or undef it.
153 (Note that the comments in NET 2's ansi.h
154 are incorrect for _VA_LIST_--see stdio.h!) */
155 /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
156 Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
157 use for va_list (``typedef _VA_LIST_ va_list'') */
158 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)
159 /* The macro _VA_LIST is used in SCO Unix 3.2. */
161 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
164 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
168 typedef __gnuc_va_list va_list;
169 #endif /* not _VA_LIST_T_H */
170 #endif /* not _VA_LIST */
171 #endif /* not _VA_LIST_, except on certain systems */
173 #endif /* not __svr4__ */
175 /* The next BSD release (if there is one) wants this symbol to be
176 undefined instead of _VA_LIST_. */
181 #endif /* __GNUC__ */