|
|
1.1 root 1: /* stdarg.h for GNU.
2: Note that the type used in va_arg is supposed to match the
3: actual type **after default promotions**.
4: Thus, va_arg (..., short) is not valid. */
5:
6: #ifndef _STDARG_H
1.1.1.4 root 7: #ifndef _ANSI_STDARG_H_
8: #ifndef __need___va_list
1.1 root 9: #define _STDARG_H
1.1.1.4 root 10: #define _ANSI_STDARG_H_
11: #endif /* not __need___va_list */
12: #undef __need___va_list
1.1 root 13:
14: #ifndef __GNUC__
1.1.1.4 root 15: /* Use the system's macros with the system's compiler.
16: This is relevant only when building GCC with some other compiler. */
1.1 root 17: #include <stdarg.h>
18: #else
1.1.1.5 root 19: #ifdef __clipper__
20: #include <va-clipper.h>
21: #else
1.1 root 22: #ifdef __m88k__
1.1.1.4 root 23: #include <va-m88k.h>
1.1 root 24: #else
25: #ifdef __i860__
1.1.1.4 root 26: #include <va-i860.h>
1.1 root 27: #else
1.1.1.4 root 28: #ifdef __hppa__
29: #include <va-pa.h>
1.1 root 30: #else
31: #ifdef __mips__
1.1.1.4 root 32: #include <va-mips.h>
1.1 root 33: #else
1.1.1.2 root 34: #ifdef __sparc__
1.1.1.4 root 35: #include <va-sparc.h>
1.1.1.2 root 36: #else
1.1.1.3 root 37: #ifdef __i960__
1.1.1.4 root 38: #include <va-i960.h>
39: #else
40: #ifdef __alpha__
41: #include <va-alpha.h>
1.1.1.3 root 42: #else
1.1.1.6 ! root 43: #if defined (__H8300__) || defined (__H8300H__)
! 44: #include <va-h8300.h>
! 45: #else
1.1 root 46:
1.1.1.4 root 47: /* Define __gnuc_va_list. */
1.1 root 48:
1.1.1.4 root 49: #ifndef __GNUC_VA_LIST
50: #define __GNUC_VA_LIST
51: #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
52: typedef char *__gnuc_va_list;
1.1.1.3 root 53: #else
1.1.1.4 root 54: typedef void *__gnuc_va_list;
1.1.1.3 root 55: #endif
1.1.1.4 root 56: #endif
57:
58: /* Define the standard macros for the user,
59: if this invocation was from the user program. */
60: #ifdef _STDARG_H
1.1 root 61:
62: /* Amount of space required in an argument list for an arg of type TYPE.
63: TYPE may alternatively be an expression whose type is used. */
64:
65: #define __va_rounded_size(TYPE) \
66: (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
67:
68: #define va_start(AP, LASTARG) \
1.1.1.4 root 69: (AP = ((__gnuc_va_list) __builtin_next_arg ()))
1.1 root 70:
1.1.1.4 root 71: #undef va_end
72: void va_end (__gnuc_va_list); /* Defined in libgcc.a */
1.1 root 73: #define va_end(AP)
74:
1.1.1.4 root 75: /* We cast to void * and then to TYPE * because this avoids
76: a warning about increasing the alignment requirement. */
77:
1.1.1.6 ! root 78: #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
1.1.1.4 root 79: /* This is for little-endian machines; small args are padded upward. */
1.1 root 80: #define va_arg(AP, TYPE) \
1.1.1.4 root 81: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
82: *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
83: #else /* big-endian */
84: /* This is for big-endian machines; small args are padded downward. */
85: #define va_arg(AP, TYPE) \
86: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
87: *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \
88: ? sizeof (TYPE) \
89: : __va_rounded_size (TYPE))))))
90: #endif /* big-endian */
91: #endif /* _STDARG_H */
1.1 root 92:
1.1.1.6 ! root 93: #endif /* not h8300 */
1.1.1.4 root 94: #endif /* not alpha */
1.1.1.3 root 95: #endif /* not i960 */
1.1.1.2 root 96: #endif /* not sparc */
1.1 root 97: #endif /* not mips */
1.1.1.4 root 98: #endif /* not hppa */
1.1 root 99: #endif /* not i860 */
100: #endif /* not m88k */
1.1.1.5 root 101: #endif /* not clipper */
1.1.1.4 root 102:
103: #ifdef _STDARG_H
104: /* Define va_list, if desired, from __gnuc_va_list. */
105: /* We deliberately do not define va_list when called from
106: stdio.h, because ANSI C says that stdio.h is not supposed to define
107: va_list. stdio.h needs to have access to that data type,
108: but must not use that name. It should use the name __gnuc_va_list,
109: which is safe because it is reserved for the implementation. */
110:
111: #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
112: #undef _VA_LIST
113: #endif
114:
115: #ifdef _BSD_VA_LIST
116: #undef _BSD_VA_LIST
117: #endif
118:
1.1.1.5 root 119: #ifdef __svr4__
1.1.1.4 root 120: /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
1.1.1.5 root 121: so we must avoid testing it and setting it here.
122: SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
123: have no conflict with that. */
1.1.1.4 root 124: #ifndef _VA_LIST_
125: #define _VA_LIST_
1.1.1.5 root 126: #ifdef __i860__
127: #ifndef _VA_LIST
128: #define _VA_LIST va_list
129: #endif
130: #endif /* __i860__ */
1.1.1.4 root 131: typedef __gnuc_va_list va_list;
132: #endif /* _VA_LIST_ */
1.1.1.5 root 133: #else /* not __svr4__ */
1.1.1.4 root 134:
135: /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
136: But on BSD NET2 we must not test or define or undef it.
137: (Note that the comments in NET 2's ansi.h
138: are incorrect for _VA_LIST_--see stdio.h!) */
1.1.1.6 ! root 139: #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__)
1.1.1.4 root 140: /* The macro _VA_LIST is used in SCO Unix 3.2. */
141: #ifndef _VA_LIST
1.1.1.5 root 142: /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
143: #ifndef _VA_LIST_T_H
144: #define _VA_LIST_T_H
1.1.1.6 ! root 145: #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__))
1.1.1.4 root 146: #define _VA_LIST_
147: #endif
148: #define _VA_LIST
149: typedef __gnuc_va_list va_list;
1.1.1.5 root 150: #endif /* not _VA_LIST_T_H */
1.1.1.4 root 151: #endif /* not _VA_LIST */
152: #endif /* not _VA_LIST_ */
153:
1.1.1.5 root 154: #endif /* not __svr4__ */
1.1.1.4 root 155:
1.1 root 156: #endif /* _STDARG_H */
1.1.1.4 root 157:
158: #endif /* __GNUC__ */
159: #endif /* not _ANSI_STDARG_H_ */
160: #endif /* not _STDARG_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.