]>
Commit | Line | Data |
---|---|---|
f3db20a3 | 1 | /* This is just like the default gvarargs.h |
6dc42e49 | 2 | except for differences described below. */ |
f3db20a3 RS |
3 | |
4 | /* Make this a macro rather than a typedef, so we can undef any other defn. */ | |
5 | #define va_list __va___list | |
6 | /* This has to be a char * to be compatible with Sun. | |
7 | i.e., we have to pass a `va_list' to vsprintf. */ | |
8 | typedef char * __va___list; | |
9 | ||
10 | /* In GCC version 2, we want an ellipsis at the end of the declaration | |
11 | of the argument list. GCC version 1 can't parse it. */ | |
12 | ||
13 | #if __GNUC__ > 1 | |
14 | #define __va_ellipsis ... | |
15 | #else | |
16 | #define __va_ellipsis | |
17 | #endif | |
18 | ||
19 | #define va_alist __builtin_va_alist | |
20 | /* The ... causes current_function_varargs to be set in cc1. */ | |
21 | #define va_dcl int __builtin_va_alist; __va_ellipsis | |
22 | ||
5840cf94 JW |
23 | #ifdef _STDARG_H |
24 | #define va_start(AP, LASTARG) \ | |
25 | (__builtin_saveregs (), AP = ((char *) __builtin_next_arg ())) | |
26 | #else | |
f3db20a3 RS |
27 | #define va_start(AP) \ |
28 | (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist)) | |
5840cf94 JW |
29 | #endif |
30 | ||
f3db20a3 RS |
31 | #define va_end(pvar) |
32 | ||
33 | #define __va_rounded_size(TYPE) \ | |
34 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) | |
35 | ||
cc8995d5 RS |
36 | /* Avoid errors if compiling GCC v2 with GCC v1. */ |
37 | #if __GNUC__ == 1 | |
38 | #define __extension__ | |
39 | #endif | |
40 | ||
f3db20a3 RS |
41 | /* RECORD_TYPE args passed using the C calling convention are |
42 | passed by invisible reference. ??? RECORD_TYPE args passed | |
43 | in the stack are made to be word-aligned; for an aggregate that is | |
44 | not word-aligned, we advance the pointer to the first non-reg slot. */ | |
45 | #define va_arg(pvar,TYPE) \ | |
e13d81d0 | 46 | __extension__ \ |
f3db20a3 RS |
47 | ({ TYPE __va_temp; \ |
48 | ((__builtin_classify_type (__va_temp) >= 12) \ | |
49 | ? ((pvar) += __va_rounded_size (TYPE *), \ | |
5840cf94 JW |
50 | **(TYPE **) ((pvar) - __va_rounded_size (TYPE *))) \ |
51 | : ((pvar) += __va_rounded_size (TYPE), \ | |
f3db20a3 | 52 | *((TYPE *) ((pvar) - __va_rounded_size (TYPE)))));}) |