From: Alejandro Colomar Date: Thu, 7 Aug 2025 12:32:11 +0000 (+0200) Subject: lib/attr.h: format_attr(): Use it also with Clang X-Git-Tag: 4.19.0-rc1~82 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12a702e8157153de602ad0e1ddf5b97255b32b8f;p=thirdparty%2Fshadow.git lib/attr.h: format_attr(): Use it also with Clang Signed-off-by: Alejandro Colomar --- diff --git a/lib/attr.h b/lib/attr.h index a77e3e35f..a60b9f2cb 100644 --- a/lib/attr.h +++ b/lib/attr.h @@ -22,12 +22,16 @@ # define NORETURN #endif -#if (__GNUC__ >= 10) +#if __has_c_attribute(gnu::format) # define format_attr(type, fmt, va) [[gnu::format(type, fmt, va)]] +#else +# define format_attr(type, fmt, va) +#endif + +#if (__GNUC__ >= 10) # define ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]] # define ATTR_ALLOC_SIZE(...) [[gnu::alloc_size(__VA_ARGS__)]] #else -# define format_attr(type, fmt, va) # define ATTR_ACCESS(...) # define ATTR_ALLOC_SIZE(...) #endif