[PATCH 49/59] stdio: Only use __va_arg_pack if compiler supports it
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Oct 17 19:13:24 GMT 2025
Otherwise route __libc_message_wrapper to __libc_message_impl.
---
include/stdio.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/stdio.h b/include/stdio.h
index 17f5516c2b..181a746949 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -184,18 +184,21 @@ _Noreturn void __libc_message_impl (const char *__vmaname, const char *__fmt,
#define __libc_fatal_vma_name "glibc: fatal"
#define __libc_assert_vma_name "glibc: assert"
+#ifdef __va_arg_pack
static inline _Noreturn void __libc_message_wrapper (const char *vmaname,
const char *fmt, ...)
{
-#ifdef __va_arg_pack_len
if (__va_arg_pack_len () > LIBC_MESSAGE_MAX_ARGS)
{
__errordecl (__libc_message_error, "invalid number of arguments");
__libc_message_error ();
}
-#endif
__libc_message_impl (vmaname, fmt, __va_arg_pack ());
}
+#else
+# define __libc_message_wrapper(__vmaname, __fmt, ...) \
+ __libc_message_impl (__vmaname, __fmt, __VA_ARGS__)
+#endif
#define __libc_message(...) \
__libc_message_wrapper (__libc_fatal_vma_name, __VA_ARGS__)
#define __libc_assert(...) \
--
2.43.0
More information about the Libc-alpha
mailing list