]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ginclude/stdarg.h
(cacheflush): Flush the cache entries associated with
[thirdparty/gcc.git] / gcc / ginclude / stdarg.h
CommitLineData
0dbbbb09
RS
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
36228d08 7#ifndef _ANSI_STDARG_H_
0a85964e 8#ifndef __need___va_list
0dbbbb09 9#define _STDARG_H
36228d08 10#define _ANSI_STDARG_H_
6ed0be92 11#endif /* not __need___va_list */
0a85964e 12#undef __need___va_list
0dbbbb09 13
ea0ad163 14#ifndef __GNUC__
b3fab01d
RS
15/* Use the system's macros with the system's compiler.
16 This is relevant only when building GCC with some other compiler. */
ea0ad163
RS
17#include <stdarg.h>
18#else
d21a9121
RS
19#ifdef __clipper__
20#include <va-clipper.h>
21#else
0dbbbb09 22#ifdef __m88k__
b3fab01d 23#include <va-m88k.h>
0dbbbb09
RS
24#else
25#ifdef __i860__
b3fab01d 26#include <va-i860.h>
0dbbbb09 27#else
d9b694cb 28#ifdef __hppa__
b3fab01d 29#include <va-pa.h>
43b0eb42
RS
30#else
31#ifdef __mips__
b3fab01d 32#include <va-mips.h>
43b0eb42 33#else
5840cf94 34#ifdef __sparc__
b3fab01d 35#include <va-sparc.h>
5840cf94 36#else
6f90e075 37#ifdef __i960__
b3fab01d 38#include <va-i960.h>
6f90e075 39#else
e318a72a 40#ifdef __alpha__
b3fab01d 41#include <va-alpha.h>
e318a72a 42#else
0dbbbb09 43
0a85964e 44/* Define __gnuc_va_list. */
373b5e3b 45
0a85964e
RS
46#ifndef __GNUC_VA_LIST
47#define __GNUC_VA_LIST
b394f631 48#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
0a85964e 49typedef char *__gnuc_va_list;
69d6c854 50#else
0a85964e 51typedef void *__gnuc_va_list;
69d6c854 52#endif
0a85964e
RS
53#endif
54
55/* Define the standard macros for the user,
56 if this invocation was from the user program. */
a5a9fc56 57#ifdef _STDARG_H
0dbbbb09
RS
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
0dbbbb09 65#define va_start(AP, LASTARG) \
339ae22d 66 (AP = ((__gnuc_va_list) __builtin_next_arg ()))
0dbbbb09 67
0cd3c247 68#undef va_end
0a85964e 69void va_end (__gnuc_va_list); /* Defined in libgcc.a */
0dbbbb09
RS
70#define va_end(AP)
71
7436f435
RS
72/* We cast to void * and then to TYPE * because this avoids
73 a warning about increasing the alignment requirement. */
0cd3c247
RS
74
75#if defined (__arm__) || defined (__i386__) || defined (__ns32000__) || defined (__vax__)
76/* This is for little-endian machines; small args are padded upward. */
0dbbbb09 77#define va_arg(AP, TYPE) \
339ae22d 78 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
7436f435 79 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
0cd3c247
RS
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 */
0a85964e 88#endif /* _STDARG_H */
0dbbbb09 89
e318a72a 90#endif /* not alpha */
6f90e075 91#endif /* not i960 */
5840cf94 92#endif /* not sparc */
43b0eb42 93#endif /* not mips */
d9b694cb 94#endif /* not hppa */
0dbbbb09
RS
95#endif /* not i860 */
96#endif /* not m88k */
d21a9121 97#endif /* not clipper */
0a85964e
RS
98
99#ifdef _STDARG_H
100/* Define va_list, if desired, from __gnuc_va_list. */
da86800a
RS
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. */
0a85964e
RS
106
107#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
108#undef _VA_LIST
109#endif
110
eaec9d17
RS
111#ifdef _BSD_VA_LIST
112#undef _BSD_VA_LIST
113#endif
114
b7dd0967 115#ifdef __svr4__
eae92d82 116/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
b7dd0967
RS
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. */
eae92d82
RS
120#ifndef _VA_LIST_
121#define _VA_LIST_
9dace10d
RS
122#ifdef __i860__
123#define _VA_LIST va_list
124#endif
eae92d82
RS
125typedef __gnuc_va_list va_list;
126#endif /* _VA_LIST_ */
b7dd0967 127#else /* not __svr4__ */
eae92d82 128
5ce402b7
RS
129/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
130 But on BSD NET2 we must not test or define or undef it.
131 (Note that the comments in NET 2's ansi.h
132 are incorrect for _VA_LIST_--see stdio.h!) */
133#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____)
0a85964e
RS
134/* The macro _VA_LIST is used in SCO Unix 3.2. */
135#ifndef _VA_LIST
61a2ac12
RS
136/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
137#ifndef _VA_LIST_T_H
138#define _VA_LIST_T_H
5ce402b7 139#if !(defined (__BSD_NET2__) || defined (____386BSD____))
0a85964e 140#define _VA_LIST_
5ce402b7 141#endif
0a85964e
RS
142#define _VA_LIST
143typedef __gnuc_va_list va_list;
61a2ac12 144#endif /* not _VA_LIST_T_H */
36228d08 145#endif /* not _VA_LIST */
d9832c78
RS
146#endif /* not _VA_LIST_ */
147
b7dd0967 148#endif /* not __svr4__ */
eae92d82 149
0dbbbb09 150#endif /* _STDARG_H */
0a85964e
RS
151
152#endif /* __GNUC__ */
36228d08 153#endif /* not _ANSI_STDARG_H_ */
0a85964e 154#endif /* not _STDARG_H */