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 /* Use the system's macros with the system's compiler.
16 This is relevant only when building GCC with some other compiler. */
41 /* Define __gnuc_va_list. */
43 #ifndef __GNUC_VA_LIST
44 #define __GNUC_VA_LIST
45 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
46 typedef char *__gnuc_va_list;
48 typedef void *__gnuc_va_list;
52 /* Define the standard macros for the user,
53 if this invocation was from the user program. */
56 /* Amount of space required in an argument list for an arg of type TYPE.
57 TYPE may alternatively be an expression whose type is used. */
59 #define __va_rounded_size(TYPE) \
60 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
62 #define va_start(AP, LASTARG) \
63 (AP = ((__gnuc_va_list) __builtin_next_arg ()))
65 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
68 /* We cast to void * and then to TYPE * because this avoids
69 a warning about increasing the alignment requirement. */
70 #define va_arg(AP, TYPE) \
71 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
72 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
73 #endif /* _STDARG_H */
75 #endif /* not alpha */
77 #endif /* not sparc */
84 /* Define va_list, if desired, from __gnuc_va_list. */
85 /* We deliberately do not define va_list when called from
86 stdio.h, because ANSI C says that stdio.h is not supposed to define
87 va_list. stdio.h needs to have access to that data type,
88 but must not use that name. It should use the name __gnuc_va_list,
89 which is safe because it is reserved for the implementation. */
91 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
100 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
101 so we must avoid testing it and setting it here. */
104 typedef __gnuc_va_list va_list;
105 #endif /* _VA_LIST_ */
106 #else /* not __SVR4_2__ */
108 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. */
109 /* However, 4.3bsd-net2 uses it in a completely different way.
110 So if we are in 4.3bsd-net2, pay no attention to _VA_LIST_. */
111 #if ! defined (_VA_LIST_) || defined (_ANSI_H_) || defined (__BSD_NET2__) || defined (____386BSD____)
112 /* The macro _VA_LIST is used in SCO Unix 3.2. */
114 #if !(defined (_ANSI_H_) || defined (__BSD_NET2__) || defined (____386BSD____))
115 /* Don't mess with _VA_LIST_ at all, on 4.3bsd-net2. */
117 #endif /* not net2 */
119 typedef __gnuc_va_list va_list;
120 #endif /* not _VA_LIST */
121 #endif /* not _VA_LIST_ (or _ANSI_H_) */
123 #endif /* not __SVR4_2__ */
125 #endif /* _STDARG_H */
127 #endif /* __GNUC__ */
128 #endif /* not _ANSI_STDARG_H_ */
129 #endif /* not _STDARG_H */