The ABI requires that va_list is passed as a pointer although its contents is a kept in a structure. Therefore make it a single element array.
Unified · Split
| @@ -16,15 +16,15 @@ typedef struct { · 15 unmodified lines | |||
| 16 | char *reg_save_area; | 16 | char *reg_save_area; |
| 17 | } __va_list_struct; | 17 | } __va_list_struct; |
| 18 | 18 | ||
| 19 | typedef __va_list_struct va_list; | 19 | typedef __va_list_struct va_list[1]; |
| 20 | 20 | ||
| 21 | void __va_start(__va_list_struct *ap, void *fp); | 21 | void __va_start(__va_list_struct *ap, void *fp); |
| 22 | void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); | 22 | void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); |
| 23 | 23 | ||
| 24 | #define va_start(ap, last) __va_start(&ap, __builtin_frame_address(0)) | 24 | #define va_start(ap, last) __va_start(ap, __builtin_frame_address(0)) |
| 25 | #define va_arg(ap, type) \ | 25 | #define va_arg(ap, type) \ |
| 26 | (*(type *)(__va_arg(&ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type)))) | 26 | (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type)))) |
| 27 | #define va_copy(dest, src) ((dest) = (src)) | 27 | #define va_copy(dest, src) (*(dest) = *(src)) |
| 28 | #define va_end(ap) | 28 | #define va_end(ap) |
| 29 | 29 | ||
| 30 | #else /* _WIN64 */ | 30 | #else /* _WIN64 */ |