7 //This should be in sync with the declaration on our lib/libtcc1.c
8 /* GCC compatible definition of va_list. */
10 unsigned int gp_offset
;
11 unsigned int fp_offset
;
13 unsigned int overflow_offset
;
14 char *overflow_arg_area
;
19 /* Avoid conflicting definition for va_list on musl libc */
20 #ifndef __DEFINED_va_list
21 typedef __va_list_struct
va_list[1];
22 #define __DEFINED_va_list
25 void __va_start(__va_list_struct
*ap
, void *fp
);
26 void *__va_arg(__va_list_struct
*ap
, int arg_type
, int size
, int align
);
28 #define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
29 #define va_arg(ap, type) \
30 (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type))))
31 #define va_copy(dest, src) (*(dest) = *(src))
34 /* avoid conflicting definition for va_list on Macs. */
38 typedef char *va_list;
39 #define va_start(ap,last) __builtin_va_start(ap,last)
40 #define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
41 ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8))
42 #define va_copy(dest, src) ((dest) = (src))
47 typedef char *va_list;
48 #define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
49 #define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
50 & ~(_tcc_alignof(type) - 1))
51 #define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
52 #define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
53 &~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
54 #define va_copy(dest, src) (dest) = (src)
57 #elif defined(__aarch64__)
65 #define va_start(ap, last) __va_start(ap, last)
66 #define va_arg(ap, type) __va_arg(ap, type)
68 #define va_copy(dest, src) ((dest) = (src))
71 typedef char *va_list;
72 /* only correct for i386 */
73 #define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
74 #define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
75 #define va_copy(dest, src) (dest) = (src)
79 /* fix a buggy dependency on GCC in libio.h */
80 typedef va_list __gnuc_va_list
;
81 #define _VA_LIST_DEFINED
83 #endif /* _STDARG_H */