Skip to content

Commit 060b084

Browse files
alejandro-colomarhallyn
authored andcommitted
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: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796> Signed-off-by: Alejandro Colomar <alx@kernel.org>
1 parent 4eed3e8 commit 060b084

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/attr.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77

88
#if defined(__GNUC__)
9-
# define MAYBE_UNUSED __attribute__((unused))
10-
# define NORETURN __attribute__((__noreturn__))
11-
# define format_attr(type, fmt, va) __attribute__((format(type, fmt, va)))
12-
# define ATTR_ACCESS(...) __attribute__((access(__VA_ARGS__)))
13-
# define ATTR_ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__)))
9+
# define MAYBE_UNUSED [[gnu::unused]]
10+
# define NORETURN [[gnu::__noreturn__]]
11+
# define format_attr(type, fmt, va) [[gnu::format(type, fmt, va)]]
12+
# define ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]]
13+
# define ATTR_ALLOC_SIZE(...) [[gnu::alloc_size(__VA_ARGS__)]]
1414
#else
1515
# define MAYBE_UNUSED
1616
# define NORETURN

0 commit comments

Comments
 (0)