OSDN Git Service

7df05ae7e5ec7b2628524cef53195b1c49cdb5fb
[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 #ifdef __svr4__
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 /*  In 4.3bsd-net2, _VA_LIST_ is defined by machine/ansi.h, but no
112     typedef for va_list is in that file.  Undef _VA_LIST_ here
113     so we do define va_list.  */
114 #ifdef _ANSI_H_
115 #undef _VA_LIST_
116 #endif
117
118 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
119 #ifndef _VA_LIST_
120 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
121 #ifndef _VA_LIST
122 #define _VA_LIST_
123 #define _VA_LIST
124 typedef __gnuc_va_list va_list;
125 #endif /* _VA_LIST */
126 #endif /* _VA_LIST_ */
127
128 /*  I think that in 4.3bsd-net2 there is some need
129     to leave _VA_LIST_ undefined after.  I don't know why. -- rms.  */
130 #ifdef _ANSI_H_
131 #undef _VA_LIST_
132 #endif
133
134 /* The next BSD release (if there is one) wants this symbol to be
135    undefined instead of _VA_LIST_.  */
136 #ifdef _BSD_VA_LIST
137 #undef _BSD_VA_LIST
138 #endif
139
140 #endif /* __GNUC__ */