]>
Commit | Line | Data |
---|---|---|
0dbbbb09 RS |
1 | /* stdarg.h for GNU. |
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. */ | |
5 | ||
6 | #ifndef _STDARG_H | |
36228d08 | 7 | #ifndef _ANSI_STDARG_H_ |
0a85964e | 8 | #ifndef __need___va_list |
0dbbbb09 | 9 | #define _STDARG_H |
36228d08 | 10 | #define _ANSI_STDARG_H_ |
6ed0be92 | 11 | #endif /* not __need___va_list */ |
0a85964e | 12 | #undef __need___va_list |
0dbbbb09 | 13 | |
d21a9121 | 14 | #ifdef __clipper__ |
d884dca3 | 15 | #include "va-clipper.h" |
d21a9121 | 16 | #else |
0dbbbb09 | 17 | #ifdef __m88k__ |
d884dca3 | 18 | #include "va-m88k.h" |
0dbbbb09 RS |
19 | #else |
20 | #ifdef __i860__ | |
d884dca3 | 21 | #include "va-i860.h" |
0dbbbb09 | 22 | #else |
d9b694cb | 23 | #ifdef __hppa__ |
d884dca3 | 24 | #include "va-pa.h" |
43b0eb42 RS |
25 | #else |
26 | #ifdef __mips__ | |
d884dca3 | 27 | #include "va-mips.h" |
43b0eb42 | 28 | #else |
5840cf94 | 29 | #ifdef __sparc__ |
d884dca3 | 30 | #include "va-sparc.h" |
5840cf94 | 31 | #else |
6f90e075 | 32 | #ifdef __i960__ |
d884dca3 | 33 | #include "va-i960.h" |
6f90e075 | 34 | #else |
e318a72a | 35 | #ifdef __alpha__ |
d884dca3 | 36 | #include "va-alpha.h" |
e318a72a | 37 | #else |
8343b898 | 38 | #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) |
d884dca3 | 39 | #include "va-h8300.h" |
0b2c1648 | 40 | #else |
1143a698 | 41 | #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) |
d884dca3 | 42 | #include "va-ppc.h" |
0c125e91 | 43 | #else |
66ed0683 JL |
44 | #ifdef __arc__ |
45 | #include "va-arc.h" | |
46 | #else | |
90e6057b DE |
47 | #ifdef __M32R__ |
48 | #include "va-m32r.h" | |
49 | #else | |
385512eb | 50 | #ifdef __sh__ |
d884dca3 | 51 | #include "va-sh.h" |
385512eb | 52 | #else |
22ef4e9b JL |
53 | #ifdef __mn10300__ |
54 | #include "va-mn10300.h" | |
55 | #else | |
51593cc5 JL |
56 | #ifdef __mn10200__ |
57 | #include "va-mn10200.h" | |
58 | #else | |
f84271d9 JL |
59 | #ifdef __v850__ |
60 | #include "va-v850.h" | |
61 | #else | |
0dbbbb09 | 62 | |
0a85964e | 63 | /* Define __gnuc_va_list. */ |
373b5e3b | 64 | |
0a85964e RS |
65 | #ifndef __GNUC_VA_LIST |
66 | #define __GNUC_VA_LIST | |
ba5c3ac4 | 67 | #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) |
0a85964e | 68 | typedef char *__gnuc_va_list; |
69d6c854 | 69 | #else |
0a85964e | 70 | typedef void *__gnuc_va_list; |
69d6c854 | 71 | #endif |
0a85964e RS |
72 | #endif |
73 | ||
74 | /* Define the standard macros for the user, | |
75 | if this invocation was from the user program. */ | |
a5a9fc56 | 76 | #ifdef _STDARG_H |
0dbbbb09 RS |
77 | |
78 | /* Amount of space required in an argument list for an arg of type TYPE. | |
79 | TYPE may alternatively be an expression whose type is used. */ | |
80 | ||
e9de0fec RK |
81 | #if defined(sysV68) |
82 | #define __va_rounded_size(TYPE) \ | |
83 | (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short)) | |
84 | #else | |
0dbbbb09 RS |
85 | #define __va_rounded_size(TYPE) \ |
86 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) | |
e9de0fec | 87 | #endif |
0dbbbb09 | 88 | |
0dbbbb09 | 89 | #define va_start(AP, LASTARG) \ |
117aea7a | 90 | (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) |
0dbbbb09 | 91 | |
0cd3c247 | 92 | #undef va_end |
0a85964e | 93 | void va_end (__gnuc_va_list); /* Defined in libgcc.a */ |
ed73e9f1 | 94 | #define va_end(AP) ((void)0) |
0dbbbb09 | 95 | |
7436f435 RS |
96 | /* We cast to void * and then to TYPE * because this avoids |
97 | a warning about increasing the alignment requirement. */ | |
0cd3c247 | 98 | |
e9a25f70 | 99 | #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) |
0cd3c247 | 100 | /* This is for little-endian machines; small args are padded upward. */ |
0dbbbb09 | 101 | #define va_arg(AP, TYPE) \ |
339ae22d | 102 | (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ |
7436f435 | 103 | *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) |
0cd3c247 RS |
104 | #else /* big-endian */ |
105 | /* This is for big-endian machines; small args are padded downward. */ | |
106 | #define va_arg(AP, TYPE) \ | |
107 | (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ | |
92c874f7 RK |
108 | *((TYPE *) (void *) ((char *) (AP) \ |
109 | - ((sizeof (TYPE) < __va_rounded_size (char) \ | |
110 | ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) | |
0cd3c247 | 111 | #endif /* big-endian */ |
9d661e56 RK |
112 | |
113 | /* Copy __gnuc_va_list into another variable of this type. */ | |
114 | #define __va_copy(dest, src) (dest) = (src) | |
115 | ||
0a85964e | 116 | #endif /* _STDARG_H */ |
0dbbbb09 | 117 | |
f84271d9 | 118 | #endif /* not v850 */ |
51593cc5 | 119 | #endif /* not mn10200 */ |
22ef4e9b | 120 | #endif /* not mn10300 */ |
385512eb | 121 | #endif /* not sh */ |
90e6057b | 122 | #endif /* not m32r */ |
66ed0683 | 123 | #endif /* not arc */ |
0c125e91 | 124 | #endif /* not powerpc with V.4 calling sequence */ |
0b2c1648 | 125 | #endif /* not h8300 */ |
e318a72a | 126 | #endif /* not alpha */ |
6f90e075 | 127 | #endif /* not i960 */ |
5840cf94 | 128 | #endif /* not sparc */ |
43b0eb42 | 129 | #endif /* not mips */ |
d9b694cb | 130 | #endif /* not hppa */ |
0dbbbb09 RS |
131 | #endif /* not i860 */ |
132 | #endif /* not m88k */ | |
d21a9121 | 133 | #endif /* not clipper */ |
0a85964e RS |
134 | |
135 | #ifdef _STDARG_H | |
136 | /* Define va_list, if desired, from __gnuc_va_list. */ | |
da86800a RS |
137 | /* We deliberately do not define va_list when called from |
138 | stdio.h, because ANSI C says that stdio.h is not supposed to define | |
139 | va_list. stdio.h needs to have access to that data type, | |
140 | but must not use that name. It should use the name __gnuc_va_list, | |
141 | which is safe because it is reserved for the implementation. */ | |
0a85964e RS |
142 | |
143 | #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ | |
144 | #undef _VA_LIST | |
145 | #endif | |
146 | ||
eaec9d17 RS |
147 | #ifdef _BSD_VA_LIST |
148 | #undef _BSD_VA_LIST | |
149 | #endif | |
150 | ||
1997cb46 | 151 | #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) |
eae92d82 | 152 | /* SVR4.2 uses _VA_LIST for an internal alias for va_list, |
b7dd0967 RS |
153 | so we must avoid testing it and setting it here. |
154 | SVR4 uses _VA_LIST as a flag in stdarg.h, but we should | |
155 | have no conflict with that. */ | |
eae92d82 RS |
156 | #ifndef _VA_LIST_ |
157 | #define _VA_LIST_ | |
9dace10d | 158 | #ifdef __i860__ |
51eeee3e | 159 | #ifndef _VA_LIST |
9dace10d RS |
160 | #define _VA_LIST va_list |
161 | #endif | |
51eeee3e | 162 | #endif /* __i860__ */ |
eae92d82 | 163 | typedef __gnuc_va_list va_list; |
1997cb46 RK |
164 | #ifdef _SCO_DS |
165 | #define __VA_LIST | |
166 | #endif | |
eae92d82 | 167 | #endif /* _VA_LIST_ */ |
d33fc50c | 168 | #else /* not __svr4__ || _SCO_DS */ |
eae92d82 | 169 | |
5ce402b7 RS |
170 | /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. |
171 | But on BSD NET2 we must not test or define or undef it. | |
172 | (Note that the comments in NET 2's ansi.h | |
173 | are incorrect for _VA_LIST_--see stdio.h!) */ | |
0f2101cc RK |
174 | #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) |
175 | /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ | |
c4f0e497 | 176 | #ifndef _VA_LIST_DEFINED |
0a85964e RS |
177 | /* The macro _VA_LIST is used in SCO Unix 3.2. */ |
178 | #ifndef _VA_LIST | |
61a2ac12 RS |
179 | /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ |
180 | #ifndef _VA_LIST_T_H | |
0a85964e | 181 | typedef __gnuc_va_list va_list; |
61a2ac12 | 182 | #endif /* not _VA_LIST_T_H */ |
36228d08 | 183 | #endif /* not _VA_LIST */ |
c4f0e497 | 184 | #endif /* not _VA_LIST_DEFINED */ |
0f2101cc RK |
185 | #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) |
186 | #define _VA_LIST_ | |
187 | #endif | |
188 | #ifndef _VA_LIST | |
189 | #define _VA_LIST | |
190 | #endif | |
191 | #ifndef _VA_LIST_DEFINED | |
192 | #define _VA_LIST_DEFINED | |
193 | #endif | |
194 | #ifndef _VA_LIST_T_H | |
195 | #define _VA_LIST_T_H | |
196 | #endif | |
197 | ||
198 | #endif /* not _VA_LIST_, except on certain systems */ | |
d9832c78 | 199 | |
b7dd0967 | 200 | #endif /* not __svr4__ */ |
eae92d82 | 201 | |
0dbbbb09 | 202 | #endif /* _STDARG_H */ |
0a85964e | 203 | |
36228d08 | 204 | #endif /* not _ANSI_STDARG_H_ */ |
0a85964e | 205 | #endif /* not _STDARG_H */ |