Import (slightly modified) ru.koi8-r.win.kbd:1.1 from FreeBSD (fjoe):
[dragonfly.git] / contrib / 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 /* $FreeBSD: src/contrib/gcc/ginclude/stdarg.h,v 1.4 1999/10/16 07:12:34 obrien Exp $ */
7 /* $DragonFly: src/contrib/gcc/ginclude/Attic/stdarg.h,v 1.2 2003/06/17 04:24:02 dillon Exp $ */
8
9 #ifndef _STDARG_H
10 #ifndef _ANSI_STDARG_H_
11 #ifndef __need___va_list
12 #define _STDARG_H
13 #define _ANSI_STDARG_H_
14 #endif /* not __need___va_list */
15 #undef __need___va_list
16
17 #ifdef __clipper__
18 #include "va-clipper.h"
19 #else
20 #ifdef __m88k__
21 #include "va-m88k.h"
22 #else
23 #ifdef __i860__
24 #include "va-i860.h"
25 #else
26 #ifdef __hppa__
27 #include "va-pa.h"
28 #else
29 #ifdef __mips__
30 #include "va-mips.h"
31 #else
32 #ifdef __sparc__
33 #include "va-sparc.h"
34 #else
35 #ifdef __i960__
36 #include "va-i960.h"
37 #else
38 #ifdef __alpha__
39 #include "va-alpha.h"
40 #else
41 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
42 #include "va-h8300.h"
43 #else
44 #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
45 #include "va-ppc.h"
46 #else
47 #ifdef __arc__
48 #include "va-arc.h"
49 #else
50 #ifdef __M32R__
51 #include "va-m32r.h"
52 #else
53 #ifdef __sh__
54 #include "va-sh.h"
55 #else
56 #ifdef __mn10300__
57 #include "va-mn10300.h"
58 #else
59 #ifdef __mn10200__
60 #include "va-mn10200.h"
61 #else
62 #ifdef __v850__
63 #include "va-v850.h"
64 #else
65 #if defined (_TMS320C4x) || defined (_TMS320C3x)
66 #include <va-c4x.h>
67 #else
68
69 /* Define __gnuc_va_list.  */
70
71 #ifndef __GNUC_VA_LIST
72 #define __GNUC_VA_LIST
73 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
74 typedef char *__gnuc_va_list;
75 #else
76 typedef void *__gnuc_va_list;
77 #endif
78 #endif
79
80 /* Define the standard macros for the user,
81    if this invocation was from the user program.  */
82 #ifdef _STDARG_H
83
84 /* Amount of space required in an argument list for an arg of type TYPE.
85    TYPE may alternatively be an expression whose type is used.  */
86
87 #if defined(sysV68)
88 #define __va_rounded_size(TYPE)  \
89   (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
90 #elif defined(_AIX)
91 #define __va_rounded_size(TYPE)  \
92   (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
93 #else
94 #define __va_rounded_size(TYPE)  \
95   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
96 #endif
97
98 #define va_start(AP, LASTARG)                                           \
99  (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
100
101 #undef va_end
102 void va_end (__gnuc_va_list);           /* Defined in libgcc.a */
103 #define va_end(AP)      ((void)0)
104
105 /* We cast to void * and then to TYPE * because this avoids
106    a warning about increasing the alignment requirement.  */
107
108 #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
109 /* This is for little-endian machines; small args are padded upward.  */
110 #define va_arg(AP, TYPE)                                                \
111  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
112   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
113 #else /* big-endian */
114 /* This is for big-endian machines; small args are padded downward.  */
115 #define va_arg(AP, TYPE)                                                \
116  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
117   *((TYPE *) (void *) ((char *) (AP)                                    \
118                        - ((sizeof (TYPE) < __va_rounded_size (char)     \
119                            ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
120 #endif /* big-endian */
121
122 /* Copy __gnuc_va_list into another variable of this type.  */
123 #define __va_copy(dest, src) (dest) = (src)
124
125 #endif /* _STDARG_H */
126
127 #endif /* not TMS320C3x or TMS320C4x */
128 #endif /* not v850 */
129 #endif /* not mn10200 */
130 #endif /* not mn10300 */
131 #endif /* not sh */
132 #endif /* not m32r */
133 #endif /* not arc */
134 #endif /* not powerpc with V.4 calling sequence */
135 #endif /* not h8300 */
136 #endif /* not alpha */
137 #endif /* not i960 */
138 #endif /* not sparc */
139 #endif /* not mips */
140 #endif /* not hppa */
141 #endif /* not i860 */
142 #endif /* not m88k */
143 #endif /* not clipper */
144
145 #ifdef _STDARG_H
146 /* Define va_list, if desired, from __gnuc_va_list. */
147 /* We deliberately do not define va_list when called from
148    stdio.h, because ANSI C says that stdio.h is not supposed to define
149    va_list.  stdio.h needs to have access to that data type, 
150    but must not use that name.  It should use the name __gnuc_va_list,
151    which is safe because it is reserved for the implementation.  */
152
153 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
154 #undef _VA_LIST
155 #endif
156
157 #ifdef _BSD_VA_LIST
158 #undef _BSD_VA_LIST
159 #endif
160
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_ */
178 #else /* not __svr4__ || _SCO_DS */
179
180 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
181    But on BSD NET2 we must not test or define or undef it.
182    (Note that the comments in NET 2's ansi.h
183    are incorrect for _VA_LIST_--see stdio.h!)  */
184 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
185 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
186 #ifndef _VA_LIST_DEFINED
187 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
188 #ifndef _VA_LIST
189 /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
190 #ifndef _VA_LIST_T_H
191 typedef __gnuc_va_list va_list;
192 #endif /* not _VA_LIST_T_H */
193 #endif /* not _VA_LIST */
194 #endif /* not _VA_LIST_DEFINED */
195 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
196 #define _VA_LIST_
197 #endif
198 #ifndef _VA_LIST
199 #define _VA_LIST
200 #endif
201 #ifndef _VA_LIST_DEFINED
202 #define _VA_LIST_DEFINED
203 #endif
204 #ifndef _VA_LIST_T_H
205 #define _VA_LIST_T_H
206 #endif
207
208 #endif /* not _VA_LIST_, except on certain systems */
209
210 #endif /* not __svr4__ */
211
212 #endif /* _STDARG_H */
213
214 #endif /* not _ANSI_STDARG_H_ */
215 #endif /* not _STDARG_H */