1 /* This is just like the default gvarargs.h
2 except for differences described below. */
4 /* Define __gnuc_va_list. */
10 /* This has to be a char * to be compatible with Sun.
11 i.e., we have to pass a `va_list' to vsprintf. */
12 typedef char * __gnuc_va_list;
14 /* This has to be a void * to be compatible with Sun svr4.
15 i.e., we have to pass a `va_list' to vsprintf. */
16 typedef void * __gnuc_va_list;
18 #endif /* not __GNUC_VA_LIST */
20 /* If this is for internal libc use, don't define anything but
22 #if defined (_STDARG_H) || defined (_VARARGS_H)
26 /* Call __builtin_next_arg even though we aren't using its value, so that
27 we can verify that LASTARG is correct. */
28 #ifdef __GCC_NEW_VARARGS__
29 #define va_start(AP, LASTARG) \
30 (__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ())
32 #define va_start(AP, LASTARG) \
33 (__builtin_saveregs (), AP = ((char *) __builtin_next_arg (LASTARG)))
38 #define va_alist __builtin_va_alist
39 #define va_dcl int __builtin_va_alist;...
41 #ifdef __GCC_NEW_VARARGS__
42 #define va_start(AP) ((AP) = (char *) __builtin_saveregs ())
44 #define va_start(AP) \
45 (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist))
51 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
55 #define __va_rounded_size(TYPE) \
56 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
58 /* Avoid errors if compiling GCC v2 with GCC v1. */
63 /* RECORD_TYPE args passed using the C calling convention are
64 passed by invisible reference. ??? RECORD_TYPE args passed
65 in the stack are made to be word-aligned; for an aggregate that is
66 not word-aligned, we advance the pointer to the first non-reg slot. */
67 /* We don't declare the union member `d' to have type TYPE
68 because that would lose in C++ if TYPE has a constructor. */
69 /* We cast to void * and then to TYPE * because this avoids
70 a warning about increasing the alignment requirement.
71 The casts to char * avoid warnings about invalid pointer arithmetic. */
72 #define va_arg(pvar,TYPE) \
75 ((__builtin_classify_type (__va_temp) >= 12) \
76 ? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
77 **(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
78 : __va_rounded_size (TYPE) == 8 \
79 ? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
80 __u.__i[0] = ((int *) (void *) (pvar))[0]; \
81 __u.__i[1] = ((int *) (void *) (pvar))[1]; \
82 (pvar) = (char *)(pvar) + 8; \
83 *(TYPE *) (void *) __u.__d; }) \
84 : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
85 *((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));})
87 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */