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