]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h: NORETURN: Implement with [[noreturn]]
authorAlejandro Colomar <alx@kernel.org>
Thu, 7 Aug 2025 12:29:43 +0000 (14:29 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 28 Nov 2025 02:35:26 +0000 (20:35 -0600)
This is a C23 standard attribute with the same semantics.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/attr.h

index 7d1bf375515c0b8f53922bcb856c506df490bdb6..a77e3e35f7270ddf58770041a24cfc9369616ea5 100644 (file)
 # 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(...)