OSDN Git Service

971aba6a1032442f47aae6b3854448afe7ca1e47
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / varargs.h
1 #ifndef __GNUC__
2 /* Use the system's macros with the system's compiler.  */
3 #include <varargs.h>
4 #else
5 /* Record that this is varargs.h; this turns off stdarg.h.  */
6
7 #ifndef _VARARGS_H
8 #define _VARARGS_H
9
10 #ifdef __sparc__
11 #include <va-sparc.h>
12 #else
13 #ifdef __spur__
14 #include <va-spur.h>
15 #else
16 #ifdef __mips__
17 #include <va-mips.h>
18 #else
19 #ifdef __i860__
20 #include <va-i860.h>
21 #else
22 #ifdef __pyr__
23 #include <va-pyr.h>
24 #else
25 #ifdef __m88k__
26 #include <va-m88k.h>
27 #else
28 #if defined(__hppa__) || defined(hp800)
29 #include <va-pa.h>
30 #else
31 #ifdef __i960__
32 #include <va-i960.h>
33 #else
34 #ifdef __alpha__
35 #include <va-alpha.h>
36 #else
37
38 #ifdef __NeXT__
39
40 /* On Next, erase any vestiges of stdarg.h.  */
41
42 #ifdef _ANSI_STDARG_H_
43 #define _VA_LIST_
44 #endif
45 #define _ANSI_STDARG_H_ 
46
47 #undef va_alist
48 #undef va_dcl
49 #undef va_list
50 #undef va_start
51 #undef va_end
52 #undef __va_rounded_size
53 #undef va_arg
54 #endif  /* __NeXT__ */
55
56 /* In GCC version 2, we want an ellipsis at the end of the declaration
57    of the argument list.  GCC version 1 can't parse it.  */
58
59 #if __GNUC__ > 1
60 #define __va_ellipsis ...
61 #else
62 #define __va_ellipsis
63 #endif
64
65 /* These macros implement traditional (non-ANSI) varargs
66    for GNU C.  */
67
68 #define va_alist  __builtin_va_alist
69 /* The ... causes current_function_varargs to be set in cc1.  */
70 #define va_dcl    int __builtin_va_alist; __va_ellipsis
71
72 /* Define __gnuc_va_list, just as in gstdarg.h.  */
73
74 #ifndef __GNUC_VA_LIST
75 #define __GNUC_VA_LIST
76 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
77 typedef char *__gnuc_va_list;
78 #else
79 typedef void *__gnuc_va_list;
80 #endif
81 #endif
82
83 #define va_start(AP)  AP=(char *) &__builtin_va_alist
84
85 #define va_end(AP)
86
87 #define __va_rounded_size(TYPE)  \
88   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
89
90 #define va_arg(AP, TYPE)                                                \
91  (AP += __va_rounded_size (TYPE),                                       \
92   *((TYPE *) (AP - __va_rounded_size (TYPE))))
93
94 #endif /* not alpha */
95 #endif /* not i960 */
96 #endif /* not hppa */
97 #endif /* not m88k */
98 #endif /* not pyr */
99 #endif /* not i860 */
100 #endif /* not mips */
101 #endif /* not spur */
102 #endif /* not sparc */
103 #endif /* not _VARARGS_H */
104
105 /* Define va_list from __gnuc_va_list.  */
106
107 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
108 #undef _VA_LIST
109 #endif
110
111 #ifdef __SVR4_2__
112
113 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
114    so we must avoid testing it and setting it here.  */
115 #ifndef _VA_LIST_
116 #define _VA_LIST_
117 typedef __gnuc_va_list va_list;
118 #endif /* _VA_LIST_ */
119
120 #else /* not __SVR4_2__ */
121
122 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
123    one less case to deal with in the following.  */
124 #if defined (__BSD_NET2__) || defined (____386BSD____)
125 #include <ansi.h>
126 #endif
127
128 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which remain
129    defined as long as the corresponding type is *not* defined.  */
130 #ifdef _ANSI_H_
131 #ifndef _VA_LIST_
132 #define _VA_LIST
133 #endif
134 #undef _VA_LIST_
135 #endif /* _ANSI_H_ */
136
137 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
138 #ifndef _VA_LIST_
139 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
140 #ifndef _VA_LIST
141 #define _VA_LIST_
142 #define _VA_LIST
143 typedef __gnuc_va_list va_list;
144 #endif /* not _VA_LIST */
145 #endif /* not _VA_LIST_ */
146
147 #endif /* not __SVR4_2__ */
148
149 /* On 4.3bsd-net2, leave _VA_LIST_ undef to indicate va_list is defined.  */
150 #ifdef _ANSI_H_
151 #undef _VA_LIST_
152 #endif
153
154 /* The next BSD release (if there is one) wants this symbol to be
155    undefined instead of _VA_LIST_.  */
156 #ifdef _BSD_VA_LIST
157 #undef _BSD_VA_LIST
158 #endif
159
160 #endif /* __GNUC__ */