diff --git a/include/stdarg.h b/include/stdarg.h index 6a8fee6a..5e4f5533 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -1,6 +1,7 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2021 W. J. van der Laan * * This file is part of GNU Mes. * @@ -26,7 +27,19 @@ #define va_arg8(ap, type) va_arg(ap, type) -#else // ! SYSTEM_LIBC +#elif __GNUC__ && __riscv + +// GCC on RISC-V always passes arguments in registers. Implementing these macros without +// the use of built-ins would be very involved. +typedef __builtin_va_list va_list; + +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#define va_arg8(ap, type) va_arg(ap, type) +#define va_copy(d,s) __builtin_va_copy(d,s) + +#else // ! SYSTEM_LIBC && ! __riscv #include