]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/libsa/ppc/stdarg_apple.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 Note that the type used in va_arg is supposed to match the
27 actual type **after default promotions**.
28 Thus, va_arg (..., short) is not valid. */
31 #ifndef _ANSI_STDARG_H_
32 #ifndef __need___va_list
34 #define _ANSI_STDARG_H_
35 #endif /* not __need___va_list */
36 #undef __need___va_list
39 #include <va-clipper.h>
62 #if defined (__H8300__) || defined (__H8300H__)
65 #if defined (__PPC__) && defined (_CALL_SYSV)
69 /* Define __gnuc_va_list. */
71 #ifndef __GNUC_VA_LIST
72 #define __GNUC_VA_LIST
73 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
74 typedef char * __gnuc_va_list
;
76 typedef void * __gnuc_va_list
;
80 /* Define the standard macros for the user,
81 if this invocation was from the user program. */
84 /* Amount of space required in an argument list for an arg of type TYPE.
85 TYPE may alternatively be an expression whose type is used. */
88 #define __va_rounded_size(TYPE) \
89 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
91 #define __va_rounded_size(TYPE) \
92 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
95 #define va_start(AP, LASTARG) \
96 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
99 void va_end ( __gnuc_va_list
); /* Defined in libgcc.a */
100 #define va_end(AP) ((void)0)
102 /* We cast to void * and then to TYPE * because this avoids
103 a warning about increasing the alignment requirement. */
105 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
106 /* This is for little-endian machines; small args are padded upward. */
107 #define va_arg(AP, TYPE) \
108 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
109 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
110 #else /* big-endian */
111 /* This is for big-endian machines; small args are padded downward. */
112 #define va_arg(AP, TYPE) \
113 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
114 *((TYPE *) (void *) ((char *) (AP) \
115 - ((sizeof (TYPE) < __va_rounded_size (char) \
116 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
117 #endif /* big-endian */
118 #endif /* _STDARG_H */
120 #endif /* not powerpc with V.4 calling sequence */
121 #endif /* not h8300 */
122 #endif /* not alpha */
123 #endif /* not i960 */
124 #endif /* not sparc */
125 #endif /* not mips */
126 #endif /* not hppa */
127 #endif /* not i860 */
128 #endif /* not m88k */
129 #endif /* not clipper */
132 /* Define va_list, if desired, from __gnuc_va_list. */
133 /* We deliberately do not define va_list when called from
134 stdio.h, because ANSI C says that stdio.h is not supposed to define
135 va_list. stdio.h needs to have access to that data type,
136 but must not use that name. It should use the name __gnuc_va_list,
137 which is safe because it is reserved for the implementation. */
139 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
148 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
149 so we must avoid testing it and setting it here.
150 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
151 have no conflict with that. */
156 #define _VA_LIST va_list
158 #endif /* __i860__ */
159 typedef __gnuc_va_list
va_list ;
160 #endif /* _VA_LIST_ */
161 #else /* not __svr4__ */
163 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
164 But on BSD NET2 we must not test or define or undef it.
165 (Note that the comments in NET 2's ansi.h
166 are incorrect for _VA_LIST_--see stdio.h!) */
167 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
168 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
169 #ifndef _VA_LIST_DEFINED
170 /* The macro _VA_LIST is used in SCO Unix 3.2. */
172 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
174 typedef __gnuc_va_list
va_list ;
175 #endif /* not _VA_LIST_T_H */
176 #endif /* not _VA_LIST */
177 #endif /* not _VA_LIST_DEFINED */
178 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
184 #ifndef _VA_LIST_DEFINED
185 #define _VA_LIST_DEFINED
191 #endif /* not _VA_LIST_, except on certain systems */
193 #endif /* not __svr4__ */
195 #endif /* _STDARG_H */
197 #endif /* not _ANSI_STDARG_H_ */
198 #endif /* not _STDARG_H */