#define _printf_format_(a, b) __attribute__((format(printf, a, b)))
#define _always_inline_ __inline__ __attribute__((always_inline))
#define _sentinel_ __attribute__((sentinel))
+#define _used_ __attribute((used))
+#define _retain_ __attribute((retain))
+#define _section_(a) __attribute((section(a)))
+#define _aligned_(a) __attribute((aligned(a)))
#if defined(__clang_analyzer__)
#define _clang_suppress_ __attribute__((suppress))
// clang-format off: At least up to version 18, it just makes a mess with _Pragma()
#define DEFINE_TEST_WITH_FUNC(_name, _func, ...) \
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
- static const struct test UNIQ(s##_name) \
- __attribute__((retain, used, section("kmod_tests"), aligned(8))) = { \
+ _used_ \
+ _retain_ \
+ _section_("kmod_tests") \
+ _aligned_(8) \
+ static const struct test UNIQ(s##_name) = { \
.name = #_name, .func = _func, ##__VA_ARGS__ \
};
// clang-format on