From 4500013326dfbd5d2366f5f0b7c86f87b5dc83fc Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 7 Aug 2025 14:29:43 +0200 Subject: [PATCH] lib/attr.h: NORETURN: Implement with [[noreturn]] This is a C23 standard attribute with the same semantics. Signed-off-by: Alejandro Colomar --- lib/attr.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/attr.h b/lib/attr.h index 7d1bf3755..a77e3e35f 100644 --- a/lib/attr.h +++ b/lib/attr.h @@ -16,13 +16,17 @@ # define MAYBE_UNUSED #endif +#if __has_c_attribute(noreturn) +# define NORETURN [[noreturn]] +#else +# define NORETURN +#endif + #if (__GNUC__ >= 10) -# 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 NORETURN # define format_attr(type, fmt, va) # define ATTR_ACCESS(...) # define ATTR_ALLOC_SIZE(...) -- 2.47.3