]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h: MAYBE_UNUSED: Implement with [[maybe_unused]]
authorAlejandro Colomar <alx@kernel.org>
Thu, 7 Aug 2025 12:28:22 +0000 (14:28 +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 8150ddb60b3f840643b879c623a024aa6a85b5cb..7d1bf375515c0b8f53922bcb856c506df490bdb6 100644 (file)
 #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(...)