OSDN Git Service

* ginclude/stdarg.h: Handle the H8/S.
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / varargs.h
1 /* Record that this is varargs.h; this turns off stdarg.h.  */
2
3 #ifndef _VARARGS_H
4 #define _VARARGS_H
5
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)
40 #include <va-ppc.h>
41 #else
42 #ifdef __sh__
43 #include <va-sh.h>
44 #else
45
46 #ifdef __NeXT__
47
48 /* On Next, erase any vestiges of stdarg.h.  */
49
50 #ifdef _ANSI_STDARG_H_
51 #define _VA_LIST_
52 #endif
53 #define _ANSI_STDARG_H_ 
54
55 #undef va_alist
56 #undef va_dcl
57 #undef va_list
58 #undef va_start
59 #undef va_end
60 #undef __va_rounded_size
61 #undef va_arg
62 #endif  /* __NeXT__ */
63
64 /* In GCC version 2, we want an ellipsis at the end of the declaration
65    of the argument list.  GCC version 1 can't parse it.  */
66
67 #if __GNUC__ > 1
68 #define __va_ellipsis ...
69 #else
70 #define __va_ellipsis
71 #endif
72
73 /* These macros implement traditional (non-ANSI) varargs
74    for GNU C.  */
75
76 #define va_alist  __builtin_va_alist
77 /* The ... causes current_function_varargs to be set in cc1.  */
78 #define va_dcl    int __builtin_va_alist; __va_ellipsis
79
80 /* Define __gnuc_va_list, just as in gstdarg.h.  */
81
82 #ifndef __GNUC_VA_LIST
83 #define __GNUC_VA_LIST
84 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
85 typedef char *__gnuc_va_list;
86 #else
87 typedef void *__gnuc_va_list;
88 #endif
89 #endif
90
91 #define va_start(AP)  AP=(char *) &__builtin_va_alist
92
93 #define va_end(AP)      ((void)0)
94
95 #if defined(sysV68)
96 #define __va_rounded_size(TYPE)  \
97   (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
98 #else
99 #define __va_rounded_size(TYPE)  \
100   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
101 #endif
102
103 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
104 /* This is for little-endian machines; small args are padded upward.  */
105 #define va_arg(AP, TYPE)                                                \
106  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
107   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
108 #else /* big-endian */
109 /* This is for big-endian machines; small args are padded downward.  */
110 #define va_arg(AP, TYPE)                                                \
111  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
112   *((TYPE *) (void *) ((char *) (AP)                                    \
113                        - ((sizeof (TYPE) < __va_rounded_size (char)     \
114                            ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
115 #endif /* big-endian */
116
117 #endif /* not sh */
118 #endif /* not powerpc with V.4 calling sequence */
119 #endif /* not h8300 */
120 #endif /* not alpha */
121 #endif /* not i960 */
122 #endif /* not hppa */
123 #endif /* not m88k */
124 #endif /* not clipper */
125 #endif /* not pyr */
126 #endif /* not i860 */
127 #endif /* not mips */
128 #endif /* not spur */
129 #endif /* not sparc */
130 #endif /* not _VARARGS_H */
131
132 /* Define va_list from __gnuc_va_list.  */
133
134 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
135 #undef _VA_LIST
136 #endif
137
138 #if defined(__svr4__) || defined(_SCO_DS)
139 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
140    so we must avoid testing it and setting it here.
141    SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
142    have no conflict with that.  */
143 #ifndef _VA_LIST_
144 #define _VA_LIST_
145 #ifdef __i860__
146 #ifndef _VA_LIST
147 #define _VA_LIST va_list
148 #endif
149 #endif /* __i860__ */
150 typedef __gnuc_va_list va_list;
151 #endif /* _VA_LIST_ */
152
153 #else /* not __svr4__  || _SCO_DS */
154
155 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
156    But on BSD NET2 we must not test or define or undef it.
157    (Note that the comments in NET 2's ansi.h
158    are incorrect for _VA_LIST_--see stdio.h!)  */
159 /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
160    Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
161    use for va_list (``typedef _VA_LIST_ va_list'') */
162 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
163 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
164 #ifndef _VA_LIST_DEFINED
165 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
166 #ifndef _VA_LIST
167 /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
168 #ifndef _VA_LIST_T_H
169 typedef __gnuc_va_list va_list;
170 #endif /* not _VA_LIST_T_H */
171 #endif /* not _VA_LIST */
172 #endif /* not _VA_LIST_DEFINED */
173 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
174 #define _VA_LIST_
175 #endif
176 #ifndef _VA_LIST
177 #define _VA_LIST
178 #endif
179 #ifndef _VA_LIST_DEFINED
180 #define _VA_LIST_DEFINED
181 #endif
182 #ifndef _VA_LIST_T_H
183 #define _VA_LIST_T_H
184 #endif
185
186 #endif /* not _VA_LIST_, except on certain systems */
187
188 #endif /* not __svr4__ */
189
190 /* The next BSD release (if there is one) wants this symbol to be
191    undefined instead of _VA_LIST_.  */
192 #ifdef _BSD_VA_LIST
193 #undef _BSD_VA_LIST
194 #endif