]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: handle bool-compare warning as error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 14 Mar 2025 22:21:33 +0000 (07:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 14 Mar 2025 23:56:38 +0000 (08:56 +0900)
Then we can detect the error fixed by the previous commit like the following:

../src/libsystemd/sd-device/test-sd-device.c: In function ‘test_sd_device_enumerator_add_all_parents’:
../src/shared/tests.h:225:51: error: comparison of constant ‘0’ with boolean expression is always true [-Werror=bool-compare]
  225 | #define ASSERT_OK(expr) __coverity_check__((expr) >= 0)
      |                                                   ^~
../src/libsystemd/sd-device/test-sd-device.c:547:9: note: in expansion of macro ‘ASSERT_OK’
  547 |         ASSERT_OK(sd_device_enumerator_add_all_parents(e) >= 0);
      |         ^~~~~~~~~

meson.build

index d87c651fc66d3c3ebf24a659867109b4483d664e..9cbfffb8c3089df712d7a7a44dc77b0e7f43d802 100644 (file)
@@ -379,6 +379,7 @@ possible_common_cc_flags = [
         '-Warray-bounds=2',
         '-Wdate-time',
         '-Wendif-labels',
+        '-Werror=bool-compare',
         '-Werror=discarded-qualifiers',
         '-Werror=format=2',
         '-Werror=format-signedness',