1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-11-02 09:33:31 +03:00

stdio: Only use __va_arg_pack if compiler supports it

Otherwise route __libc_message_wrapper to __libc_message_impl.

Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella
2025-10-17 16:13:24 -03:00
parent 2ebfb31b35
commit 228ae5a354

View 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(...) \