]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/stdarg.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 Note that the type used in va_arg is supposed to match the
32 actual type **after default promotions**.
33 Thus, va_arg (..., short) is not valid. */
36 #ifndef _ANSI_STDARG_H_
37 #ifndef __need___va_list
39 #define _ANSI_STDARG_H_
40 #endif /* not __need___va_list */
41 #undef __need___va_list
44 #include <va-clipper.h>
67 #if defined (__H8300__) || defined (__H8300H__)
70 #if defined (__PPC__) && defined (_CALL_SYSV)
74 /* Define __gnuc_va_list. */
76 #ifndef __GNUC_VA_LIST
77 #define __GNUC_VA_LIST
78 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__ppc__))
79 typedef char * __gnuc_va_list
;
81 typedef void * __gnuc_va_list
;
85 /* Define the standard macros for the user,
86 if this invocation was from the user program. */
89 /* Amount of space required in an argument list for an arg of type TYPE.
90 TYPE may alternatively be an expression whose type is used. */
93 #define __va_rounded_size(TYPE) \
94 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
96 #define __va_rounded_size(TYPE) \
97 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
100 #define va_start(AP, LASTARG) \
101 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
104 void va_end ( __gnuc_va_list
); /* Defined in libgcc.a */
105 #define va_end(AP) ((void)0)
107 /* We cast to void * and then to TYPE * because this avoids
108 a warning about increasing the alignment requirement. */
110 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
111 /* This is for little-endian machines; small args are padded upward. */
112 #define va_arg(AP, TYPE) \
113 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
114 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
115 #else /* big-endian */
116 /* This is for big-endian machines; small args are padded downward. */
117 #define va_arg(AP, TYPE) \
118 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
119 *((TYPE *) (void *) ((char *) (AP) \
120 - ((sizeof (TYPE) < __va_rounded_size (char) \
121 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
122 #endif /* big-endian */
123 #endif /* _STDARG_H */
125 #endif /* not powerpc with V.4 calling sequence */
126 #endif /* not h8300 */
127 #endif /* not alpha */
128 #endif /* not i960 */
129 #endif /* not sparc */
130 #endif /* not mips */
131 #endif /* not hppa */
132 #endif /* not i860 */
133 #endif /* not m88k */
134 #endif /* not clipper */
137 /* Define va_list, if desired, from __gnuc_va_list. */
138 /* We deliberately do not define va_list when called from
139 stdio.h, because ANSI C says that stdio.h is not supposed to define
140 va_list. stdio.h needs to have access to that data type,
141 but must not use that name. It should use the name __gnuc_va_list,
142 which is safe because it is reserved for the implementation. */
144 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
153 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
154 so we must avoid testing it and setting it here.
155 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
156 have no conflict with that. */
161 #define _VA_LIST va_list
163 #endif /* __i860__ */
164 typedef __gnuc_va_list
va_list ;
165 #endif /* _VA_LIST_ */
166 #else /* not __svr4__ */
168 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
169 But on BSD NET2 we must not test or define or undef it.
170 (Note that the comments in NET 2's ansi.h
171 are incorrect for _VA_LIST_--see stdio.h!) */
172 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
173 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
174 #ifndef _VA_LIST_DEFINED
175 /* The macro _VA_LIST is used in SCO Unix 3.2. */
177 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
179 typedef __gnuc_va_list
va_list ;
180 #endif /* not _VA_LIST_T_H */
181 #endif /* not _VA_LIST */
182 #endif /* not _VA_LIST_DEFINED */
183 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
189 #ifndef _VA_LIST_DEFINED
190 #define _VA_LIST_DEFINED
196 #endif /* not _VA_LIST_, except on certain systems */
198 #endif /* not __svr4__ */
200 #endif /* _STDARG_H */
202 #endif /* not _ANSI_STDARG_H_ */
203 #endif /* not _STDARG_H */