OSDN Git Service

(memory.h): Use proper ANSI syntax in `#endif __memory_h__'.
[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 __clipper__
26 #include <va-clipper.h>
27 #else
28 #ifdef __m88k__
29 #include <va-m88k.h>
30 #else
31 #if defined(__hppa__) || defined(hp800)
32 #include <va-pa.h>
33 #else
34 #ifdef __i960__
35 #include <va-i960.h>
36 #else
37 #ifdef __alpha__
38 #include <va-alpha.h>
39 #else
40
41 #ifdef __NeXT__
42
43 /* On Next, erase any vestiges of stdarg.h.  */
44
45 #ifdef _ANSI_STDARG_H_
46 #define _VA_LIST_
47 #endif
48 #define _ANSI_STDARG_H_ 
49
50 #undef va_alist
51 #undef va_dcl
52 #undef va_list
53 #undef va_start
54 #undef va_end
55 #undef __va_rounded_size
56 #undef va_arg
57 #endif  /* __NeXT__ */
58
59 /* In GCC version 2, we want an ellipsis at the end of the declaration
60    of the argument list.  GCC version 1 can't parse it.  */
61
62 #if __GNUC__ > 1
63 #define __va_ellipsis ...
64 #else
65 #define __va_ellipsis
66 #endif
67
68 /* These macros implement traditional (non-ANSI) varargs
69    for GNU C.  */
70
71 #define va_alist  __builtin_va_alist
72 /* The ... causes current_function_varargs to be set in cc1.  */
73 #define va_dcl    int __builtin_va_alist; __va_ellipsis
74
75 /* Define __gnuc_va_list, just as in gstdarg.h.  */
76
77 #ifndef __GNUC_VA_LIST
78 #define __GNUC_VA_LIST
79 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
80 typedef char *__gnuc_va_list;
81 #else
82 typedef void *__gnuc_va_list;
83 #endif
84 #endif
85
86 #define va_start(AP)  AP=(char *) &__builtin_va_alist
87
88 #define va_end(AP)
89
90 #define __va_rounded_size(TYPE)  \
91   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
92
93 #if defined (__arm__) || defined (__i386__) || 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) - ((sizeof (TYPE) < 4              \
103                                          ? sizeof (TYPE)                \
104                                          : __va_rounded_size (TYPE))))))
105 #endif /* big-endian */
106
107 #endif /* not alpha */
108 #endif /* not i960 */
109 #endif /* not hppa */
110 #endif /* not m88k */
111 #endif /* not clipper */
112 #endif /* not pyr */
113 #endif /* not i860 */
114 #endif /* not mips */
115 #endif /* not spur */
116 #endif /* not sparc */
117 #endif /* not _VARARGS_H */
118
119 /* Define va_list from __gnuc_va_list.  */
120
121 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
122 #undef _VA_LIST
123 #endif
124
125 #ifdef __SVR4_2__
126
127 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
128    so we must avoid testing it and setting it here.  */
129 #ifndef _VA_LIST_
130 #define _VA_LIST_
131 typedef __gnuc_va_list va_list;
132 #endif /* _VA_LIST_ */
133
134 #else /* not __SVR4_2__ */
135
136 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
137    But on BSD NET2 we must not test or define or undef it.
138    (Note that the comments in NET 2's ansi.h
139    are incorrect for _VA_LIST_--see stdio.h!)  */
140 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____)
141 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
142 #ifndef _VA_LIST
143 /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
144 #ifndef _VA_LIST_T_H
145 #define _VA_LIST_T_H
146 #if !(defined (__BSD_NET2__) || defined (____386BSD____))
147 #define _VA_LIST_
148 #endif
149 #define _VA_LIST
150 typedef __gnuc_va_list va_list;
151 #endif /* not _VA_LIST_T_H */
152 #endif /* not _VA_LIST */
153 #endif /* not _VA_LIST_ */
154
155 #endif /* not __SVR4_2__ */
156
157 /* The next BSD release (if there is one) wants this symbol to be
158    undefined instead of _VA_LIST_.  */
159 #ifdef _BSD_VA_LIST
160 #undef _BSD_VA_LIST
161 #endif
162
163 #endif /* __GNUC__ */