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 $ */
4 /* $DragonFly: src/contrib/gcc/ginclude/Attic/varargs.h,v 1.2 2003/06/17 04:24:02 dillon Exp $ */
25 #include "va-clipper.h"
30 #if defined(__hppa__) || defined(hp800)
39 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
42 #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
55 #include "va-mn10300.h"
58 #include "va-mn10200.h"
63 #if defined (_TMS320C4x) || defined (_TMS320C3x)
69 /* On Next, erase any vestiges of stdarg.h. */
71 #ifdef _ANSI_STDARG_H_
74 #define _ANSI_STDARG_H_
81 #undef __va_rounded_size
85 /* In GCC version 2, we want an ellipsis at the end of the declaration
86 of the argument list. GCC version 1 can't parse it. */
89 #define __va_ellipsis ...
94 /* These macros implement traditional (non-ANSI) varargs
97 #define va_alist __builtin_va_alist
98 /* The ... causes current_function_varargs to be set in cc1. */
99 /* ??? We don't process attributes correctly in K&R argument context. */
100 typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
101 #define va_dcl __builtin_va_alist_t __builtin_va_alist; __va_ellipsis
103 /* Define __gnuc_va_list, just as in gstdarg.h. */
105 #ifndef __GNUC_VA_LIST
106 #define __GNUC_VA_LIST
107 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
108 typedef char *__gnuc_va_list;
110 typedef void *__gnuc_va_list;
114 #define va_start(AP) AP=(char *) &__builtin_va_alist
116 #define va_end(AP) ((void)0)
119 #define __va_rounded_size(TYPE) \
120 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
122 #define __va_rounded_size(TYPE) \
123 (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
125 #define __va_rounded_size(TYPE) \
126 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
129 #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
130 /* This is for little-endian machines; small args are padded upward. */
131 #define va_arg(AP, TYPE) \
132 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
133 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
134 #else /* big-endian */
135 /* This is for big-endian machines; small args are padded downward. */
136 #define va_arg(AP, TYPE) \
137 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
138 *((TYPE *) (void *) ((char *) (AP) \
139 - ((sizeof (TYPE) < __va_rounded_size (char) \
140 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
141 #endif /* big-endian */
143 /* Copy __gnuc_va_list into another variable of this type. */
144 #define __va_copy(dest, src) (dest) = (src)
146 #endif /* not TMS320C3x or TMS320C4x */
147 #endif /* not v850 */
148 #endif /* not mn10200 */
149 #endif /* not mn10300 */
151 #endif /* not m32r */
153 #endif /* not powerpc with V.4 calling sequence */
154 #endif /* not h8300 */
155 #endif /* not alpha */
156 #endif /* not i960 */
157 #endif /* not hppa */
158 #endif /* not m88k */
159 #endif /* not clipper */
161 #endif /* not i860 */
162 #endif /* not mips */
163 #endif /* not spur */
164 #endif /* not sparc */
165 #endif /* not _VARARGS_H */
167 /* Define va_list from __gnuc_va_list. */
169 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
173 #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
174 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
175 so we must avoid testing it and setting it here.
176 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
177 have no conflict with that. */
182 #define _VA_LIST va_list
184 #endif /* __i860__ */
185 typedef __gnuc_va_list va_list;
189 #endif /* _VA_LIST_ */
191 #else /* not __svr4__ || _SCO_DS */
193 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
194 But on BSD NET2 we must not test or define or undef it.
195 (Note that the comments in NET 2's ansi.h
196 are incorrect for _VA_LIST_--see stdio.h!) */
197 /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
198 Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
199 use for va_list (``typedef _VA_LIST_ va_list'') */
200 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
201 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
202 #ifndef _VA_LIST_DEFINED
203 /* The macro _VA_LIST is used in SCO Unix 3.2. */
205 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
207 typedef __gnuc_va_list va_list;
208 #endif /* not _VA_LIST_T_H */
209 #endif /* not _VA_LIST */
210 #endif /* not _VA_LIST_DEFINED */
211 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
217 #ifndef _VA_LIST_DEFINED
218 #define _VA_LIST_DEFINED
224 #endif /* not _VA_LIST_, except on certain systems */
226 #endif /* not __svr4__ */
228 /* The next BSD release (if there is one) wants this symbol to be
229 undefined instead of _VA_LIST_. */