public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Stan Shebs <shebs@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] Use a better workaround for clang lack of _builtin_va_arg_pack Date: Fri, 12 Nov 2021 14:48:39 +0000 (GMT) [thread overview] Message-ID: <20211112144839.2C1A43858402@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b0d12dcb635744a4fa0ebd13b6e5743d67da1046 commit b0d12dcb635744a4fa0ebd13b6e5743d67da1046 Author: Stan Shebs <stanshebs@google.com> Date: Fri Nov 12 06:48:03 2021 -0800 Use a better workaround for clang lack of _builtin_va_arg_pack Diff: --- sysdeps/generic/ldsodefs.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 0495f85e84..8759f6e561 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -744,15 +744,26 @@ extern void _dl_dprintf (int fd, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden; #else +#if defined(__clang__) +#include <stdarg.h> +#endif __attribute__ ((always_inline, __format__ (__printf__, 2, 3))) static inline void _dl_dprintf (int fd, const char *fmt, ...) { - /* Use local declaration to avoid includign <stdio.h>. */ - extern int __dprintf(int fd, const char *format, ...) attribute_hidden; #if defined(__clang__) - __dprintf (fd, fmt); + /* In the absence of __builtin_va_arg_pack, use varargs macros to construct a + direct call to the stdio function that __dprintf eventually gets to. This + is not a robust hack, will break if stdio changes much. */ + extern int _IO_vdprintf (int d, const char *format, va_list arg); + va_list arg; + + va_start (arg, fmt); + _IO_vdprintf (fd, fmt, arg); + va_end (arg); #else + /* Use local declaration to avoid includign <stdio.h>. */ + extern int __dprintf(int fd, const char *format, ...) attribute_hidden; __dprintf (fd, fmt, __builtin_va_arg_pack ()); #endif }
reply other threads:[~2021-11-12 14:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211112144839.2C1A43858402@sourceware.org \ --to=shebs@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).