From 060b0849a6433a17685cf73b1816603b00657f95 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 1 Jul 2024 00:24:40 +0200 Subject: [PATCH] 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 --- lib/attr.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/attr.h b/lib/attr.h index 44177bff..590a817b 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