]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
stdio: Only use __va_arg_pack if compiler supports it
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 17 Oct 2025 19:13:24 +0000 (16:13 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 21 Oct 2025 12:26:04 +0000 (09:26 -0300)
Otherwise route __libc_message_wrapper to __libc_message_impl.

Reviewed-by: Sam James <sam@gentoo.org>
include/stdio.h

index 17f5516c2b477fdb61c4b35295af80d683812ab0..181a746949ca1bde104670e3799da69473fb2fe3 100644 (file)
@@ -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(...) \