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__)
42 /* Define __gnuc_va_list. */
44 #ifndef __GNUC_VA_LIST
45 #define __GNUC_VA_LIST
46 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
47 typedef char *__gnuc_va_list;
49 typedef void *__gnuc_va_list;
53 /* Define the standard macros for the user,
54 if this invocation was from the user program. */
57 /* Amount of space required in an argument list for an arg of type TYPE.
58 TYPE may alternatively be an expression whose type is used. */
61 #define __va_rounded_size(TYPE) \
62 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
64 #define __va_rounded_size(TYPE) \
65 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
68 #define va_start(AP, LASTARG) \
69 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
72 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
73 #define va_end(AP) ((void)0)
75 /* We cast to void * and then to TYPE * because this avoids
76 a warning about increasing the alignment requirement. */
78 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
79 /* This is for little-endian machines; small args are padded upward. */
80 #define va_arg(AP, TYPE) \
81 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
82 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
83 #else /* big-endian */
84 /* This is for big-endian machines; small args are padded downward. */
85 #define va_arg(AP, TYPE) \
86 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
87 *((TYPE *) (void *) ((char *) (AP) \
88 - ((sizeof (TYPE) < __va_rounded_size (char) \
89 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
90 #endif /* big-endian */
91 #endif /* _STDARG_H */
93 #endif /* not h8300 */
94 #endif /* not alpha */
96 #endif /* not sparc */
100 #endif /* not m88k */
101 #endif /* not clipper */
104 /* Define va_list, if desired, from __gnuc_va_list. */
105 /* We deliberately do not define va_list when called from
106 stdio.h, because ANSI C says that stdio.h is not supposed to define
107 va_list. stdio.h needs to have access to that data type,
108 but must not use that name. It should use the name __gnuc_va_list,
109 which is safe because it is reserved for the implementation. */
111 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
120 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
121 so we must avoid testing it and setting it here.
122 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
123 have no conflict with that. */
128 #define _VA_LIST va_list
130 #endif /* __i860__ */
131 typedef __gnuc_va_list va_list;
132 #endif /* _VA_LIST_ */
133 #else /* not __svr4__ */
135 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
136 But on BSD NET2 we must not test or define or undef it.
137 (Note that the comments in NET 2's ansi.h
138 are incorrect for _VA_LIST_--see stdio.h!) */
139 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
140 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
141 #ifndef _VA_LIST_DEFINED
142 /* The macro _VA_LIST is used in SCO Unix 3.2. */
144 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
146 typedef __gnuc_va_list va_list;
147 #endif /* not _VA_LIST_T_H */
148 #endif /* not _VA_LIST */
149 #endif /* not _VA_LIST_DEFINED */
150 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
156 #ifndef _VA_LIST_DEFINED
157 #define _VA_LIST_DEFINED
163 #endif /* not _VA_LIST_, except on certain systems */
165 #endif /* not __svr4__ */
167 #endif /* _STDARG_H */
169 #endif /* not _ANSI_STDARG_H_ */
170 #endif /* not _STDARG_H */