]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/stdarg.h
6c497e3e0484ef76e4b12541d6da0c05d9edb431
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 Note that the type used in va_arg is supposed to match the
25 actual type **after default promotions**.
26 Thus, va_arg (..., short) is not valid. */
29 #ifndef _ANSI_STDARG_H_
30 #ifndef __need___va_list
32 #define _ANSI_STDARG_H_
33 #endif /* not __need___va_list */
34 #undef __need___va_list
37 #include <va-clipper.h>
60 #if defined (__H8300__) || defined (__H8300H__)
63 #if defined (__PPC__) && defined (_CALL_SYSV)
67 /* Define __gnuc_va_list. */
69 #ifndef __GNUC_VA_LIST
70 #define __GNUC_VA_LIST
71 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__ppc__))
72 typedef char * __gnuc_va_list
;
74 typedef void * __gnuc_va_list
;
78 /* Define the standard macros for the user,
79 if this invocation was from the user program. */
82 /* Amount of space required in an argument list for an arg of type TYPE.
83 TYPE may alternatively be an expression whose type is used. */
86 #define __va_rounded_size(TYPE) \
87 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
89 #define __va_rounded_size(TYPE) \
90 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
93 #define va_start(AP, LASTARG) \
94 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
97 void va_end ( __gnuc_va_list
); /* Defined in libgcc.a */
98 #define va_end(AP) ((void)0)
100 /* We cast to void * and then to TYPE * because this avoids
101 a warning about increasing the alignment requirement. */
103 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
104 /* This is for little-endian machines; small args are padded upward. */
105 #define va_arg(AP, TYPE) \
106 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
107 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
108 #else /* big-endian */
109 /* This is for big-endian machines; small args are padded downward. */
110 #define va_arg(AP, TYPE) \
111 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
112 *((TYPE *) (void *) ((char *) (AP) \
113 - ((sizeof (TYPE) < __va_rounded_size (char) \
114 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
115 #endif /* big-endian */
116 #endif /* _STDARG_H */
118 #endif /* not powerpc with V.4 calling sequence */
119 #endif /* not h8300 */
120 #endif /* not alpha */
121 #endif /* not i960 */
122 #endif /* not sparc */
123 #endif /* not mips */
124 #endif /* not hppa */
125 #endif /* not i860 */
126 #endif /* not m88k */
127 #endif /* not clipper */
130 /* Define va_list, if desired, from __gnuc_va_list. */
131 /* We deliberately do not define va_list when called from
132 stdio.h, because ANSI C says that stdio.h is not supposed to define
133 va_list. stdio.h needs to have access to that data type,
134 but must not use that name. It should use the name __gnuc_va_list,
135 which is safe because it is reserved for the implementation. */
137 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
146 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
147 so we must avoid testing it and setting it here.
148 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
149 have no conflict with that. */
154 #define _VA_LIST va_list
156 #endif /* __i860__ */
157 typedef __gnuc_va_list
va_list ;
158 #endif /* _VA_LIST_ */
159 #else /* not __svr4__ */
161 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
162 But on BSD NET2 we must not test or define or undef it.
163 (Note that the comments in NET 2's ansi.h
164 are incorrect for _VA_LIST_--see stdio.h!) */
165 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
166 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
167 #ifndef _VA_LIST_DEFINED
168 /* The macro _VA_LIST is used in SCO Unix 3.2. */
170 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
172 typedef __gnuc_va_list
va_list ;
173 #endif /* not _VA_LIST_T_H */
174 #endif /* not _VA_LIST */
175 #endif /* not _VA_LIST_DEFINED */
176 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
182 #ifndef _VA_LIST_DEFINED
183 #define _VA_LIST_DEFINED
189 #endif /* not _VA_LIST_, except on certain systems */
191 #endif /* not __svr4__ */
193 #endif /* _STDARG_H */
195 #endif /* not _ANSI_STDARG_H_ */
196 #endif /* not _STDARG_H */