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