]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Globally silence all Wattribute warnings
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 16 Jun 2025 17:10:08 +0000 (18:10 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 8 Jul 2025 12:17:14 +0000 (07:17 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
meson.build
testsuite/testsuite.h

index 75d309b170735e755c84125fb33a4a3d1d9f1509..5740e135b57be56efa1d129b87f7b390de9cf2b9 100644 (file)
@@ -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',
index ae17a3216ff1f97185136c526ff023fe35584127..04788e41bf78b673afdac02dc5698a6aa8a40c60 100644 (file)
@@ -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__)