From: Emil Velikov Date: Mon, 16 Jun 2025 17:10:08 +0000 (+0100) Subject: Globally silence all Wattribute warnings X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11553144caa89d026da60d6f676a44b15442f1b7;p=thirdparty%2Fkmod.git Globally silence all Wattribute warnings Instead of playing a game of whack-a-mole, disable any -Wattribute warnings globally. This means, people won't get the warnings when building with older compilers which lack certain attributes. Thus we can remove the _Pragma. With that gone, we no longer need the clang-format off segment. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/376 Signed-off-by: Lucas De Marchi --- diff --git a/meson.build b/meson.build index 75d309b1..5740e135 100644 --- a/meson.build +++ b/meson.build @@ -104,7 +104,7 @@ add_project_arguments( '-Wmissing-noreturn', '-Wmissing-prototypes', '-Wnested-externs', - '-Wno-attributes=clang::suppress', + '-Wno-attributes', '-Wno-declaration-after-statement', '-Wno-unused-parameter', '-Wold-style-definition', diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index ae17a321..04788e41 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -129,17 +129,9 @@ int test_run(const struct test *t); } while (false) /* Test definitions */ -// 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\"") \ - _used_ \ - _retain_ \ - _section_("kmod_tests") \ - _alignedptr_ \ - static const struct test UNIQ(s##_name) = { \ - .name = #_name, .func = _func, ##__VA_ARGS__ \ - } -// clang-format on +#define DEFINE_TEST_WITH_FUNC(_name, _func, ...) \ + _used_ _retain_ _section_("kmod_tests") _alignedptr_ static const struct test \ + UNIQ(s##_name) = { .name = #_name, .func = _func, ##__VA_ARGS__ } #define DEFINE_TEST(_name, ...) DEFINE_TEST_WITH_FUNC(_name, _name, __VA_ARGS__)