| 1 | /* <stdarg.h> for the Aro C compiler */ |
| 2 | |
| 3 | #pragma once |
| 4 | /* Todo: Set to 202311L once header is compliant with C23 */ |
| 5 | #define __STDC_VERSION_STDARG_H__ 0 |
| 6 | |
| 7 | typedef __builtin_va_list va_list; |
| 8 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L |
| 9 | /* C23 no longer requires the second parameter */ |
| 10 | #define va_start(ap, ...) __builtin_va_start(ap, __VA_ARGS__) |
| 11 | #else |
| 12 | #define va_start(ap, param) __builtin_va_start(ap, param) |
| 13 | #endif |
| 14 | #define va_end(ap) __builtin_va_end(ap) |
| 15 | #define va_arg(ap, type) __builtin_va_arg(ap, type) |
| 16 | |
| 17 | /* GCC and Clang always define __va_copy */ |
| 18 | #define __va_copy(d, s) __builtin_va_copy(d, s) |
| 19 | |
| 20 | /* but va_copy only on c99+ or when strict ansi mode is turned off */ |
| 21 | #if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) |
| 22 | #define va_copy(d, s) __builtin_va_copy(d, s) |
| 23 | #endif |
| 24 | |
| 25 | #ifndef __GNUC_VA_LIST |
| 26 | #define __GNUC_VA_LIST 1 |
| 27 | typedef __builtin_va_list __gnuc_va_list; |
| 28 | #endif |