build: Turn off tautological-constant-out-of-range-compare warning
authorBenjamin Otte <otte@redhat.com>
Wed, 3 Nov 2021 23:27:27 +0000 (00:27 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 7 Jan 2023 00:46:58 +0000 (19:46 -0500)
This issues a warning when an enum value is compared to a value that is
out of range for the enum.

We do this a lot, either when using -1 for undefined values or when
comparing array sizes to enum values like so:

  enum {
    ONE,
    TWO,
    THREE
  } some_enum_value;
  const char *names= { "one", "two", "three" };

  g_assert (some_enum_value < G_N_ELEMENTS (names));

meson.build

index 4282f2701c5e11c8b882d9a204d290d13d1d8beb..e1d46538846f89755db24531b8d13b070bbf6f50 100644 (file)
@@ -271,6 +271,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
     '-Wno-c++11-extensions',
     '-Wno-missing-include-dirs',
     '-Wno-typedef-redefinition',
+    '-Wno-tautological-constant-out-of-range-compare',
     '-Wduplicated-branches',
     '-Wduplicated-cond',
     '-Wformat=2',