From: Alejandro Colomar Date: Thu, 7 Aug 2025 12:28:22 +0000 (+0200) Subject: lib/attr.h: MAYBE_UNUSED: Implement with [[maybe_unused]] X-Git-Tag: 4.19.0-rc1~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c07265c16f1941a1d4e746740ffd4f12d84ec9fe;p=thirdparty%2Fshadow.git lib/attr.h: MAYBE_UNUSED: Implement with [[maybe_unused]] This is a C23 standard attribute with the same semantics. Signed-off-by: Alejandro Colomar --- diff --git a/lib/attr.h b/lib/attr.h index 8150ddb60..7d1bf3755 100644 --- a/lib/attr.h +++ b/lib/attr.h @@ -10,14 +10,18 @@ #endif +#if __has_c_attribute(maybe_unused) +# define MAYBE_UNUSED [[maybe_unused]] +#else +# define MAYBE_UNUSED +#endif + #if (__GNUC__ >= 10) -# define MAYBE_UNUSED [[gnu::unused]] # define NORETURN [[gnu::__noreturn__]] # define format_attr(type, fmt, va) [[gnu::format(type, fmt, va)]] # define ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]] # define ATTR_ALLOC_SIZE(...) [[gnu::alloc_size(__VA_ARGS__)]] #else -# define MAYBE_UNUSED # define NORETURN # define format_attr(type, fmt, va) # define ATTR_ACCESS(...)