From: Alejandro Colomar Date: Sun, 30 Jun 2024 22:24:40 +0000 (+0200) Subject: lib/attr.h: Use C23-style attributes X-Git-Tag: 4.17.0-rc1~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=060b0849a6433a17685cf73b1816603b00657f95;p=thirdparty%2Fshadow.git lib/attr.h: Use C23-style attributes They're stricter. The GNU attributes are too lazy, and can be misused more easily. Also, mixing both has its own problems. Link: Signed-off-by: Alejandro Colomar --- diff --git a/lib/attr.h b/lib/attr.h index 44177bfff..590a817b0 100644 --- a/lib/attr.h +++ b/lib/attr.h @@ -6,11 +6,11 @@ #if defined(__GNUC__) -# define MAYBE_UNUSED __attribute__((unused)) -# define NORETURN __attribute__((__noreturn__)) -# define format_attr(type, fmt, va) __attribute__((format(type, fmt, va))) -# define ATTR_ACCESS(...) __attribute__((access(__VA_ARGS__))) -# define ATTR_ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__))) +# 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