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