]>
Commit | Line | Data |
---|---|---|
a5c8d722 | 1 | /* Record that this is varargs.h; this turns off stdarg.h. */ |
93980385 RS |
2 | |
3 | #ifndef _VARARGS_H | |
4 | #define _VARARGS_H | |
5 | ||
6 | #ifdef __sparc__ | |
d884dca3 | 7 | #include "va-sparc.h" |
93980385 RS |
8 | #else |
9 | #ifdef __spur__ | |
d884dca3 | 10 | #include "va-spur.h" |
93980385 RS |
11 | #else |
12 | #ifdef __mips__ | |
d884dca3 | 13 | #include "va-mips.h" |
93980385 RS |
14 | #else |
15 | #ifdef __i860__ | |
d884dca3 | 16 | #include "va-i860.h" |
93980385 RS |
17 | #else |
18 | #ifdef __pyr__ | |
d884dca3 | 19 | #include "va-pyr.h" |
93980385 | 20 | #else |
ade97c34 | 21 | #ifdef __clipper__ |
d884dca3 | 22 | #include "va-clipper.h" |
ade97c34 | 23 | #else |
93980385 | 24 | #ifdef __m88k__ |
d884dca3 | 25 | #include "va-m88k.h" |
93980385 | 26 | #else |
aa501fb7 | 27 | #if defined(__hppa__) || defined(hp800) |
d884dca3 | 28 | #include "va-pa.h" |
93980385 | 29 | #else |
6f90e075 | 30 | #ifdef __i960__ |
d884dca3 | 31 | #include "va-i960.h" |
6f90e075 | 32 | #else |
e318a72a | 33 | #ifdef __alpha__ |
d884dca3 | 34 | #include "va-alpha.h" |
e318a72a | 35 | #else |
8343b898 | 36 | #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) |
d884dca3 | 37 | #include "va-h8300.h" |
0b2c1648 | 38 | #else |
1143a698 | 39 | #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) |
d884dca3 | 40 | #include "va-ppc.h" |
0c125e91 | 41 | #else |
66ed0683 JL |
42 | #ifdef __arc__ |
43 | #include "va-arc.h" | |
44 | #else | |
90e6057b DE |
45 | #ifdef __M32R__ |
46 | #include "va-m32r.h" | |
47 | #else | |
385512eb | 48 | #ifdef __sh__ |
d884dca3 | 49 | #include "va-sh.h" |
385512eb | 50 | #else |
22ef4e9b JL |
51 | #ifdef __mn10300__ |
52 | #include "va-mn10300.h" | |
53 | #else | |
51593cc5 JL |
54 | #ifdef __mn10200__ |
55 | #include "va-mn10200.h" | |
56 | #else | |
f84271d9 JL |
57 | #ifdef __v850__ |
58 | #include "va-v850.h" | |
59 | #else | |
93980385 RS |
60 | |
61 | #ifdef __NeXT__ | |
62 | ||
63 | /* On Next, erase any vestiges of stdarg.h. */ | |
64 | ||
7dea1d59 RS |
65 | #ifdef _ANSI_STDARG_H_ |
66 | #define _VA_LIST_ | |
67 | #endif | |
68 | #define _ANSI_STDARG_H_ | |
69 | ||
93980385 RS |
70 | #undef va_alist |
71 | #undef va_dcl | |
72 | #undef va_list | |
73 | #undef va_start | |
74 | #undef va_end | |
75 | #undef __va_rounded_size | |
76 | #undef va_arg | |
77 | #endif /* __NeXT__ */ | |
78 | ||
79 | /* In GCC version 2, we want an ellipsis at the end of the declaration | |
80 | of the argument list. GCC version 1 can't parse it. */ | |
81 | ||
82 | #if __GNUC__ > 1 | |
83 | #define __va_ellipsis ... | |
84 | #else | |
85 | #define __va_ellipsis | |
86 | #endif | |
87 | ||
88 | /* These macros implement traditional (non-ANSI) varargs | |
89 | for GNU C. */ | |
90 | ||
91 | #define va_alist __builtin_va_alist | |
92 | /* The ... causes current_function_varargs to be set in cc1. */ | |
93 | #define va_dcl int __builtin_va_alist; __va_ellipsis | |
94 | ||
a5c8d722 | 95 | /* Define __gnuc_va_list, just as in gstdarg.h. */ |
34df360c | 96 | |
a5c8d722 RS |
97 | #ifndef __GNUC_VA_LIST |
98 | #define __GNUC_VA_LIST | |
b394f631 | 99 | #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) |
a5c8d722 RS |
100 | typedef char *__gnuc_va_list; |
101 | #else | |
102 | typedef void *__gnuc_va_list; | |
34df360c | 103 | #endif |
593d2459 RS |
104 | #endif |
105 | ||
93980385 RS |
106 | #define va_start(AP) AP=(char *) &__builtin_va_alist |
107 | ||
ed73e9f1 | 108 | #define va_end(AP) ((void)0) |
93980385 | 109 | |
e9de0fec RK |
110 | #if defined(sysV68) |
111 | #define __va_rounded_size(TYPE) \ | |
112 | (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short)) | |
113 | #else | |
93980385 RS |
114 | #define __va_rounded_size(TYPE) \ |
115 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) | |
e9de0fec | 116 | #endif |
93980385 | 117 | |
22ef4e9b | 118 | #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) |
5153d9d6 | 119 | /* This is for little-endian machines; small args are padded upward. */ |
93980385 | 120 | #define va_arg(AP, TYPE) \ |
5153d9d6 RS |
121 | (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ |
122 | *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) | |
123 | #else /* big-endian */ | |
124 | /* This is for big-endian machines; small args are padded downward. */ | |
125 | #define va_arg(AP, TYPE) \ | |
126 | (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ | |
92c874f7 RK |
127 | *((TYPE *) (void *) ((char *) (AP) \ |
128 | - ((sizeof (TYPE) < __va_rounded_size (char) \ | |
129 | ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) | |
5153d9d6 | 130 | #endif /* big-endian */ |
93980385 | 131 | |
a52a564c RK |
132 | /* Copy __gnuc_va_list into another variable of this type. */ |
133 | #define __va_copy(dest, src) (dest) = (src) | |
134 | ||
f84271d9 | 135 | #endif /* not v850 */ |
51593cc5 | 136 | #endif /* not mn10200 */ |
22ef4e9b | 137 | #endif /* not mn10300 */ |
385512eb | 138 | #endif /* not sh */ |
90e6057b | 139 | #endif /* not m32r */ |
66ed0683 | 140 | #endif /* not arc */ |
0c125e91 | 141 | #endif /* not powerpc with V.4 calling sequence */ |
0b2c1648 | 142 | #endif /* not h8300 */ |
e318a72a | 143 | #endif /* not alpha */ |
6f90e075 | 144 | #endif /* not i960 */ |
d9bacbad | 145 | #endif /* not hppa */ |
93980385 | 146 | #endif /* not m88k */ |
ade97c34 | 147 | #endif /* not clipper */ |
93980385 RS |
148 | #endif /* not pyr */ |
149 | #endif /* not i860 */ | |
150 | #endif /* not mips */ | |
151 | #endif /* not spur */ | |
152 | #endif /* not sparc */ | |
153 | #endif /* not _VARARGS_H */ | |
21d7516d | 154 | |
a5c8d722 | 155 | /* Define va_list from __gnuc_va_list. */ |
21d7516d RS |
156 | |
157 | #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ | |
158 | #undef _VA_LIST | |
159 | #endif | |
160 | ||
1997cb46 | 161 | #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) |
eae92d82 | 162 | /* SVR4.2 uses _VA_LIST for an internal alias for va_list, |
32e69e1d RS |
163 | so we must avoid testing it and setting it here. |
164 | SVR4 uses _VA_LIST as a flag in stdarg.h, but we should | |
165 | have no conflict with that. */ | |
eae92d82 RS |
166 | #ifndef _VA_LIST_ |
167 | #define _VA_LIST_ | |
9dace10d | 168 | #ifdef __i860__ |
51eeee3e | 169 | #ifndef _VA_LIST |
9dace10d RS |
170 | #define _VA_LIST va_list |
171 | #endif | |
51eeee3e | 172 | #endif /* __i860__ */ |
eae92d82 | 173 | typedef __gnuc_va_list va_list; |
1997cb46 RK |
174 | #ifdef _SCO_DS |
175 | #define __VA_LIST | |
176 | #endif | |
eae92d82 RS |
177 | #endif /* _VA_LIST_ */ |
178 | ||
d33fc50c | 179 | #else /* not __svr4__ || _SCO_DS */ |
eae92d82 | 180 | |
5ce402b7 RS |
181 | /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. |
182 | But on BSD NET2 we must not test or define or undef it. | |
183 | (Note that the comments in NET 2's ansi.h | |
184 | are incorrect for _VA_LIST_--see stdio.h!) */ | |
c8cdb42b RS |
185 | /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993: |
186 | Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to | |
187 | use for va_list (``typedef _VA_LIST_ va_list'') */ | |
0f2101cc | 188 | #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) |
c4f0e497 RK |
189 | /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ |
190 | #ifndef _VA_LIST_DEFINED | |
21d7516d RS |
191 | /* The macro _VA_LIST is used in SCO Unix 3.2. */ |
192 | #ifndef _VA_LIST | |
61a2ac12 RS |
193 | /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ |
194 | #ifndef _VA_LIST_T_H | |
0f2101cc RK |
195 | typedef __gnuc_va_list va_list; |
196 | #endif /* not _VA_LIST_T_H */ | |
197 | #endif /* not _VA_LIST */ | |
198 | #endif /* not _VA_LIST_DEFINED */ | |
6c68c4ab | 199 | #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) |
21d7516d | 200 | #define _VA_LIST_ |
5ce402b7 | 201 | #endif |
0f2101cc | 202 | #ifndef _VA_LIST |
21d7516d | 203 | #define _VA_LIST |
0f2101cc RK |
204 | #endif |
205 | #ifndef _VA_LIST_DEFINED | |
c4f0e497 | 206 | #define _VA_LIST_DEFINED |
0f2101cc RK |
207 | #endif |
208 | #ifndef _VA_LIST_T_H | |
209 | #define _VA_LIST_T_H | |
210 | #endif | |
211 | ||
c8cdb42b | 212 | #endif /* not _VA_LIST_, except on certain systems */ |
a5c8d722 | 213 | |
32e69e1d | 214 | #endif /* not __svr4__ */ |
eae92d82 | 215 | |
a5c8d722 RS |
216 | /* The next BSD release (if there is one) wants this symbol to be |
217 | undefined instead of _VA_LIST_. */ | |
218 | #ifdef _BSD_VA_LIST | |
219 | #undef _BSD_VA_LIST | |
220 | #endif |