* invoke.texi (C++ Dialect Options): Document -fhonor-std.
[official-gcc.git] / gcc / ginclude / varargs.h
blob410d06aac69bc629dbfd238bda8966887af63df3
1 /* Record that this is varargs.h; this turns off stdarg.h. */
3 #ifndef _VARARGS_H
4 #define _VARARGS_H
6 #ifdef __sparc__
7 #include "va-sparc.h"
8 #else
9 #ifdef __spur__
10 #include "va-spur.h"
11 #else
12 #ifdef __mips__
13 #include "va-mips.h"
14 #else
15 #ifdef __i860__
16 #include "va-i860.h"
17 #else
18 #ifdef __pyr__
19 #include "va-pyr.h"
20 #else
21 #ifdef __clipper__
22 #include "va-clipper.h"
23 #else
24 #ifdef __m88k__
25 #include "va-m88k.h"
26 #else
27 #if defined(__hppa__) || defined(hp800)
28 #include "va-pa.h"
29 #else
30 #ifdef __i960__
31 #include "va-i960.h"
32 #else
33 #ifdef __alpha__
34 #include "va-alpha.h"
35 #else
36 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
37 #include "va-h8300.h"
38 #else
39 #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
40 #include "va-ppc.h"
41 #else
42 #ifdef __arc__
43 #include "va-arc.h"
44 #else
45 #ifdef __M32R__
46 #include "va-m32r.h"
47 #else
48 #ifdef __sh__
49 #include "va-sh.h"
50 #else
51 #ifdef __mn10300__
52 #include "va-mn10300.h"
53 #else
54 #ifdef __mn10200__
55 #include "va-mn10200.h"
56 #else
57 #ifdef __v850__
58 #include "va-v850.h"
59 #else
61 #ifdef __NeXT__
63 /* On Next, erase any vestiges of stdarg.h. */
65 #ifdef _ANSI_STDARG_H_
66 #define _VA_LIST_
67 #endif
68 #define _ANSI_STDARG_H_
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__ */
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. */
82 #if __GNUC__ > 1
83 #define __va_ellipsis ...
84 #else
85 #define __va_ellipsis
86 #endif
88 /* These macros implement traditional (non-ANSI) varargs
89 for GNU C. */
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
95 /* Define __gnuc_va_list, just as in gstdarg.h. */
97 #ifndef __GNUC_VA_LIST
98 #define __GNUC_VA_LIST
99 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
100 typedef char *__gnuc_va_list;
101 #else
102 typedef void *__gnuc_va_list;
103 #endif
104 #endif
106 #define va_start(AP) AP=(char *) &__builtin_va_alist
108 #define va_end(AP) ((void)0)
110 #if defined(sysV68)
111 #define __va_rounded_size(TYPE) \
112 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
113 #else
114 #define __va_rounded_size(TYPE) \
115 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
116 #endif
118 #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
119 /* This is for little-endian machines; small args are padded upward. */
120 #define va_arg(AP, TYPE) \
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)), \
127 *((TYPE *) (void *) ((char *) (AP) \
128 - ((sizeof (TYPE) < __va_rounded_size (char) \
129 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
130 #endif /* big-endian */
132 /* Copy __gnuc_va_list into another variable of this type. */
133 #define __va_copy(dest, src) (dest) = (src)
135 #endif /* not v850 */
136 #endif /* not mn10200 */
137 #endif /* not mn10300 */
138 #endif /* not sh */
139 #endif /* not m32r */
140 #endif /* not arc */
141 #endif /* not powerpc with V.4 calling sequence */
142 #endif /* not h8300 */
143 #endif /* not alpha */
144 #endif /* not i960 */
145 #endif /* not hppa */
146 #endif /* not m88k */
147 #endif /* not clipper */
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 */
155 /* Define va_list from __gnuc_va_list. */
157 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
158 #undef _VA_LIST
159 #endif
161 #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
162 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
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. */
166 #ifndef _VA_LIST_
167 #define _VA_LIST_
168 #ifdef __i860__
169 #ifndef _VA_LIST
170 #define _VA_LIST va_list
171 #endif
172 #endif /* __i860__ */
173 typedef __gnuc_va_list va_list;
174 #ifdef _SCO_DS
175 #define __VA_LIST
176 #endif
177 #endif /* _VA_LIST_ */
179 #else /* not __svr4__ || _SCO_DS */
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!) */
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'') */
188 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
189 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
190 #ifndef _VA_LIST_DEFINED
191 /* The macro _VA_LIST is used in SCO Unix 3.2. */
192 #ifndef _VA_LIST
193 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
194 #ifndef _VA_LIST_T_H
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 */
199 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
200 #define _VA_LIST_
201 #endif
202 #ifndef _VA_LIST
203 #define _VA_LIST
204 #endif
205 #ifndef _VA_LIST_DEFINED
206 #define _VA_LIST_DEFINED
207 #endif
208 #ifndef _VA_LIST_T_H
209 #define _VA_LIST_T_H
210 #endif
212 #endif /* not _VA_LIST_, except on certain systems */
214 #endif /* not __svr4__ */
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