]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h: Use C23-style attributes
authorAlejandro Colomar <alx@kernel.org>
Sun, 30 Jun 2024 22:24:40 +0000 (00:24 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 2 Jul 2024 02:40:11 +0000 (21:40 -0500)
They're stricter.  The GNU attributes are too lazy, and can be misused
more easily.  Also, mixing both has its own problems.

Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/attr.h

index 44177bfff45be629a56694b96413ad3dcdd5bf99..590a817b05988d1e2143c9025afd84a76b538bee 100644 (file)
@@ -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