1 /* Record that this is varargs.h; this turns off stdarg.h. */
3 /* $FreeBSD: src/contrib/gcc/ginclude/varargs.h,v 1.4 1999/10/16 07:12:34 obrien Exp $ */
24 #include "va-clipper.h"
29 #if defined(__hppa__) || defined(hp800)
38 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
41 #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
54 #include "va-mn10300.h"
57 #include "va-mn10200.h"
62 #if defined (_TMS320C4x) || defined (_TMS320C3x)
68 /* On Next, erase any vestiges of stdarg.h. */
70 #ifdef _ANSI_STDARG_H_
73 #define _ANSI_STDARG_H_
80 #undef __va_rounded_size
84 /* In GCC version 2, we want an ellipsis at the end of the declaration
85 of the argument list. GCC version 1 can't parse it. */
88 #define __va_ellipsis ...
93 /* These macros implement traditional (non-ANSI) varargs
96 #define va_alist __builtin_va_alist
97 /* The ... causes current_function_varargs to be set in cc1. */
98 /* ??? We don't process attributes correctly in K&R argument context. */
99 typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
100 #define va_dcl __builtin_va_alist_t __builtin_va_alist; __va_ellipsis
102 /* Define __gnuc_va_list, just as in gstdarg.h. */
104 #ifndef __GNUC_VA_LIST
105 #define __GNUC_VA_LIST
106 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
107 typedef char *__gnuc_va_list;
109 typedef void *__gnuc_va_list;
113 #define va_start(AP) AP=(char *) &__builtin_va_alist
115 #define va_end(AP) ((void)0)
118 #define __va_rounded_size(TYPE) \
119 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
121 #define __va_rounded_size(TYPE) \
122 (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
124 #define __va_rounded_size(TYPE) \
125 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
128 #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
129 /* This is for little-endian machines; small args are padded upward. */
130 #define va_arg(AP, TYPE) \
131 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
132 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
133 #else /* big-endian */
134 /* This is for big-endian machines; small args are padded downward. */
135 #define va_arg(AP, TYPE) \
136 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
137 *((TYPE *) (void *) ((char *) (AP) \
138 - ((sizeof (TYPE) < __va_rounded_size (char) \
139 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
140 #endif /* big-endian */
142 /* Copy __gnuc_va_list into another variable of this type. */
143 #define __va_copy(dest, src) (dest) = (src)
145 #endif /* not TMS320C3x or TMS320C4x */
146 #endif /* not v850 */
147 #endif /* not mn10200 */
148 #endif /* not mn10300 */
150 #endif /* not m32r */
152 #endif /* not powerpc with V.4 calling sequence */
153 #endif /* not h8300 */
154 #endif /* not alpha */
155 #endif /* not i960 */
156 #endif /* not hppa */
157 #endif /* not m88k */
158 #endif /* not clipper */
160 #endif /* not i860 */
161 #endif /* not mips */
162 #endif /* not spur */
163 #endif /* not sparc */
164 #endif /* not _VARARGS_H */
166 /* Define va_list from __gnuc_va_list. */
168 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
172 #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
173 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
174 so we must avoid testing it and setting it here.
175 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
176 have no conflict with that. */
181 #define _VA_LIST va_list
183 #endif /* __i860__ */
184 typedef __gnuc_va_list va_list;
188 #endif /* _VA_LIST_ */
190 #else /* not __svr4__ || _SCO_DS */
192 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
193 But on BSD NET2 we must not test or define or undef it.
194 (Note that the comments in NET 2's ansi.h
195 are incorrect for _VA_LIST_--see stdio.h!) */
196 /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
197 Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
198 use for va_list (``typedef _VA_LIST_ va_list'') */
199 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
200 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
201 #ifndef _VA_LIST_DEFINED
202 /* The macro _VA_LIST is used in SCO Unix 3.2. */
204 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
206 typedef __gnuc_va_list va_list;
207 #endif /* not _VA_LIST_T_H */
208 #endif /* not _VA_LIST */
209 #endif /* not _VA_LIST_DEFINED */
210 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
216 #ifndef _VA_LIST_DEFINED
217 #define _VA_LIST_DEFINED
223 #endif /* not _VA_LIST_, except on certain systems */
225 #endif /* not __svr4__ */
227 /* The next BSD release (if there is one) wants this symbol to be
228 undefined instead of _VA_LIST_. */