]>
Commit | Line | Data |
---|---|---|
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 | |
7 | #define _STDARG_H | |
8 | ||
ea0ad163 RS |
9 | #ifndef __GNUC__ |
10 | /* Use the system's macros with the system's compiler. */ | |
11 | #include <stdarg.h> | |
12 | #else | |
0dbbbb09 RS |
13 | #ifdef __m88k__ |
14 | #include "va-m88k.h" | |
15 | #else | |
16 | #ifdef __i860__ | |
17 | #include "va-i860.h" | |
18 | #else | |
43b0eb42 RS |
19 | #ifdef __hp9000s800__ |
20 | #include "va-hp800.h" | |
21 | #else | |
22 | #ifdef __mips__ | |
23 | #include "va-mips.h" | |
24 | #else | |
0dbbbb09 RS |
25 | |
26 | /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. */ | |
27 | #ifndef _VA_LIST_ | |
6a592e69 RS |
28 | /* The macro _VA_LIST is used in SCO Unix 3.2. */ |
29 | #ifndef _VA_LIST | |
0dbbbb09 | 30 | #define _VA_LIST_ |
6a592e69 | 31 | #define _VA_LIST |
0dbbbb09 | 32 | typedef char *va_list; |
6a592e69 | 33 | #endif /* _VA_LIST */ |
0dbbbb09 RS |
34 | #endif /* _VA_LIST_ */ |
35 | ||
36 | /* Amount of space required in an argument list for an arg of type TYPE. | |
37 | TYPE may alternatively be an expression whose type is used. */ | |
38 | ||
39 | #define __va_rounded_size(TYPE) \ | |
40 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) | |
41 | ||
42 | #ifndef __sparc__ | |
43 | #define va_start(AP, LASTARG) \ | |
44 | (AP = ((char *) __builtin_next_arg ())) | |
45 | #else | |
46 | #define va_start(AP, LASTARG) \ | |
47 | (__builtin_saveregs (), \ | |
48 | AP = ((char *) __builtin_next_arg ())) | |
49 | #endif | |
50 | ||
6a592e69 | 51 | void va_end (va_list); /* Defined in libgcc.a */ |
0dbbbb09 RS |
52 | #define va_end(AP) |
53 | ||
54 | #define va_arg(AP, TYPE) \ | |
55 | (AP += __va_rounded_size (TYPE), \ | |
56 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) | |
57 | ||
43b0eb42 RS |
58 | #endif /* not mips */ |
59 | #endif /* not hp9000s800 */ | |
0dbbbb09 RS |
60 | #endif /* not i860 */ |
61 | #endif /* not m88k */ | |
ea0ad163 | 62 | #endif /* __GNUC__ */ |
0dbbbb09 | 63 | #endif /* _STDARG_H */ |