* varargs.h, stdarg.h: Include va-mn10200.h.
[gcc.git] / gcc / ginclude / stdarg.h
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
7 #ifndef _ANSI_STDARG_H_
8 #ifndef __need___va_list
9 #define _STDARG_H
10 #define _ANSI_STDARG_H_
11 #endif /* not __need___va_list */
12 #undef __need___va_list
13
14 #ifdef __clipper__
15 #include "va-clipper.h"
16 #else
17 #ifdef __m88k__
18 #include "va-m88k.h"
19 #else
20 #ifdef __i860__
21 #include "va-i860.h"
22 #else
23 #ifdef __hppa__
24 #include "va-pa.h"
25 #else
26 #ifdef __mips__
27 #include "va-mips.h"
28 #else
29 #ifdef __sparc__
30 #include "va-sparc.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 __M32R__
45 #include "va-m32r.h"
46 #else
47 #ifdef __sh__
48 #include "va-sh.h"
49 #else
50 #ifdef __mn10300__
51 #include "va-mn10300.h"
52 #else
53 #ifdef __mn10200__
54 #include "va-mn10200.h"
55 #else
56
57 /* Define __gnuc_va_list. */
58
59 #ifndef __GNUC_VA_LIST
60 #define __GNUC_VA_LIST
61 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
62 typedef char *__gnuc_va_list;
63 #else
64 typedef void *__gnuc_va_list;
65 #endif
66 #endif
67
68 /* Define the standard macros for the user,
69 if this invocation was from the user program. */
70 #ifdef _STDARG_H
71
72 /* Amount of space required in an argument list for an arg of type TYPE.
73 TYPE may alternatively be an expression whose type is used. */
74
75 #if defined(sysV68)
76 #define __va_rounded_size(TYPE) \
77 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
78 #else
79 #define __va_rounded_size(TYPE) \
80 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
81 #endif
82
83 #define va_start(AP, LASTARG) \
84 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
85
86 #undef va_end
87 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
88 #define va_end(AP) ((void)0)
89
90 /* We cast to void * and then to TYPE * because this avoids
91 a warning about increasing the alignment requirement. */
92
93 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
94 /* This is for little-endian machines; small args are padded upward. */
95 #define va_arg(AP, TYPE) \
96 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
97 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
98 #else /* big-endian */
99 /* This is for big-endian machines; small args are padded downward. */
100 #define va_arg(AP, TYPE) \
101 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
102 *((TYPE *) (void *) ((char *) (AP) \
103 - ((sizeof (TYPE) < __va_rounded_size (char) \
104 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
105 #endif /* big-endian */
106
107 /* Copy __gnuc_va_list into another variable of this type. */
108 #define __va_copy(dest, src) (dest) = (src)
109
110 #endif /* _STDARG_H */
111
112 #endif /* not mn10200 */
113 #endif /* not mn10300 */
114 #endif /* not sh */
115 #endif /* not m32r */
116 #endif /* not powerpc with V.4 calling sequence */
117 #endif /* not h8300 */
118 #endif /* not alpha */
119 #endif /* not i960 */
120 #endif /* not sparc */
121 #endif /* not mips */
122 #endif /* not hppa */
123 #endif /* not i860 */
124 #endif /* not m88k */
125 #endif /* not clipper */
126
127 #ifdef _STDARG_H
128 /* Define va_list, if desired, from __gnuc_va_list. */
129 /* We deliberately do not define va_list when called from
130 stdio.h, because ANSI C says that stdio.h is not supposed to define
131 va_list. stdio.h needs to have access to that data type,
132 but must not use that name. It should use the name __gnuc_va_list,
133 which is safe because it is reserved for the implementation. */
134
135 #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
136 #undef _VA_LIST
137 #endif
138
139 #ifdef _BSD_VA_LIST
140 #undef _BSD_VA_LIST
141 #endif
142
143 #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
144 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
145 so we must avoid testing it and setting it here.
146 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
147 have no conflict with that. */
148 #ifndef _VA_LIST_
149 #define _VA_LIST_
150 #ifdef __i860__
151 #ifndef _VA_LIST
152 #define _VA_LIST va_list
153 #endif
154 #endif /* __i860__ */
155 typedef __gnuc_va_list va_list;
156 #ifdef _SCO_DS
157 #define __VA_LIST
158 #endif
159 #endif /* _VA_LIST_ */
160 #else /* not __svr4__ || _SCO_DS */
161
162 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
163 But on BSD NET2 we must not test or define or undef it.
164 (Note that the comments in NET 2's ansi.h
165 are incorrect for _VA_LIST_--see stdio.h!) */
166 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
167 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
168 #ifndef _VA_LIST_DEFINED
169 /* The macro _VA_LIST is used in SCO Unix 3.2. */
170 #ifndef _VA_LIST
171 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
172 #ifndef _VA_LIST_T_H
173 typedef __gnuc_va_list va_list;
174 #endif /* not _VA_LIST_T_H */
175 #endif /* not _VA_LIST */
176 #endif /* not _VA_LIST_DEFINED */
177 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
178 #define _VA_LIST_
179 #endif
180 #ifndef _VA_LIST
181 #define _VA_LIST
182 #endif
183 #ifndef _VA_LIST_DEFINED
184 #define _VA_LIST_DEFINED
185 #endif
186 #ifndef _VA_LIST_T_H
187 #define _VA_LIST_T_H
188 #endif
189
190 #endif /* not _VA_LIST_, except on certain systems */
191
192 #endif /* not __svr4__ */
193
194 #endif /* _STDARG_H */
195
196 #endif /* not _ANSI_STDARG_H_ */
197 #endif /* not _STDARG_H */