aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-impl.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2025-06-03 13:39:33 +0100
committerNick Alcock <nick.alcock@oracle.com>2025-06-04 12:51:29 +0100
commitf86f9fd85999c7a483855793b3efe85da1d6eb74 (patch)
treee72ac1a260820ade2b1231e4abeb269edf4a6619 /libctf/ctf-impl.h
parentd4e9d956572a7bbf96a5500d70ddfe5a33f23ced (diff)
downloadbinutils-f86f9fd85999c7a483855793b3efe85da1d6eb74.zip
binutils-f86f9fd85999c7a483855793b3efe85da1d6eb74.tar.gz
binutils-f86f9fd85999c7a483855793b3efe85da1d6eb74.tar.bz2
libctf: use __attribute__((__gnu_printf__)) where appropriate
We don't use any GNU-specific printf args, but this prevents warnings about %z, observed on MinGW even though every libc anyone is likely to use there supports %z perfectly well, and we're not stopping using it just because MinGW complains. Doing this means we stand more chance of seeing *actual* problems on such platforms without them being drowned in noise. We turn this off on clang, which doesn't support __gnu_printf__. Suggested by Eli Zaretskii. libctf/ PR libctf/31863 * ctf-impl.h (_libctf_printflike_): Use __gnu_printf__.
Diffstat (limited to 'libctf/ctf-impl.h')
-rw-r--r--libctf/ctf-impl.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index 2691a68..3217f92 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -66,8 +66,13 @@ extern "C"
macros glibc may introduce, which have names of the pattern
__attribute_blah__. */
+#if defined (__clang__)
#define _libctf_printflike_(string_index,first_to_check) \
__attribute__ ((__format__ (__printf__, (string_index), (first_to_check))))
+#else
+#define _libctf_printflike_(string_index,first_to_check) \
+ __attribute__ ((__format__ (__gnu_printf__, (string_index), (first_to_check))))
+#endif
#define _libctf_unlikely_(x) __builtin_expect ((x), 0)
#define _libctf_unused_ __attribute__ ((__unused__))
#define _libctf_malloc_ __attribute__((__malloc__))