2 Note that the type used in va_arg is supposed to match the
3 actual type **after default promotions**.
4 Thus, va_arg (..., short) is not valid. */
7 #ifndef _ANSI_STDARG_H_
8 #ifndef __need___va_list
10 #define _ANSI_STDARG_H_
11 #endif /* not __need___va_list */
12 #undef __need___va_list
15 #include "va-clipper.h"
38 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
41 #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
48 /* Define __gnuc_va_list. */
50 #ifndef __GNUC_VA_LIST
51 #define __GNUC_VA_LIST
52 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
53 typedef char *__gnuc_va_list;
55 typedef void *__gnuc_va_list;
59 /* Define the standard macros for the user,
60 if this invocation was from the user program. */
63 /* Amount of space required in an argument list for an arg of type TYPE.
64 TYPE may alternatively be an expression whose type is used. */
67 #define __va_rounded_size(TYPE) \
68 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
70 #define __va_rounded_size(TYPE) \
71 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
74 #define va_start(AP, LASTARG) \
75 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
78 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
79 #define va_end(AP) ((void)0)
81 /* We cast to void * and then to TYPE * because this avoids
82 a warning about increasing the alignment requirement. */
84 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
85 /* This is for little-endian machines; small args are padded upward. */
86 #define va_arg(AP, TYPE) \
87 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
88 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
89 #else /* big-endian */
90 /* This is for big-endian machines; small args are padded downward. */
91 #define va_arg(AP, TYPE) \
92 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
93 *((TYPE *) (void *) ((char *) (AP) \
94 - ((sizeof (TYPE) < __va_rounded_size (char) \
95 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
96 #endif /* big-endian */
97 #endif /* _STDARG_H */
100 #endif /* not powerpc with V.4 calling sequence */
101 #endif /* not h8300 */
102 #endif /* not alpha */
103 #endif /* not i960 */
104 #endif /* not sparc */
105 #endif /* not mips */
106 #endif /* not hppa */
107 #endif /* not i860 */
108 #endif /* not m88k */
109 #endif /* not clipper */
112 /* Define va_list, if desired, from __gnuc_va_list. */
113 /* We deliberately do not define va_list when called from
114 stdio.h, because ANSI C says that stdio.h is not supposed to define
115 va_list. stdio.h needs to have access to that data type,
116 but must not use that name. It should use the name __gnuc_va_list,
117 which is safe because it is reserved for the implementation. */
119 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
127 #if defined(__svr4__) || defined(_SCO_DS)
128 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
129 so we must avoid testing it and setting it here.
130 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
131 have no conflict with that. */
136 #define _VA_LIST va_list
138 #endif /* __i860__ */
139 typedef __gnuc_va_list va_list;
140 #endif /* _VA_LIST_ */
141 #else /* not __svr4__ || _SCO_DS */
143 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
144 But on BSD NET2 we must not test or define or undef it.
145 (Note that the comments in NET 2's ansi.h
146 are incorrect for _VA_LIST_--see stdio.h!) */
147 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
148 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
149 #ifndef _VA_LIST_DEFINED
150 /* The macro _VA_LIST is used in SCO Unix 3.2. */
152 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
154 typedef __gnuc_va_list va_list;
155 #endif /* not _VA_LIST_T_H */
156 #endif /* not _VA_LIST */
157 #endif /* not _VA_LIST_DEFINED */
158 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
164 #ifndef _VA_LIST_DEFINED
165 #define _VA_LIST_DEFINED
171 #endif /* not _VA_LIST_, except on certain systems */
173 #endif /* not __svr4__ */
175 #endif /* _STDARG_H */
177 #endif /* not _ANSI_STDARG_H_ */
178 #endif /* not _STDARG_H */