meson: add -Werror=empty-body to disallow `if(x);`
authorEric Engestrom <eric.engestrom@intel.com>
Mon, 23 Sep 2019 16:21:20 +0000 (17:21 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 24 Oct 2019 13:54:09 +0000 (14:54 +0100)
This would have prevented a bug in MR 2058 [1]; with that MR fixed,
nothing else uses empty-body blocks, so let's just forbid them altogether.

[1] https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2058#note_237880

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
meson.build

index b4cd79995667b9ce51ad98c96b5f3e53d169aa53..ac864819013df9c89682e5ec01ae6ae27ea5f8f9 100644 (file)
@@ -939,6 +939,7 @@ else
     '-Werror=implicit-function-declaration',
     '-Werror=missing-prototypes',
     '-Werror=return-type',
+    '-Werror=empty-body',
     '-Werror=incompatible-pointer-types',
     '-Wno-missing-field-initializers',
     '-Wno-format-truncation',
@@ -958,6 +959,7 @@ else
 
   _trial = [
     '-Werror=return-type',
+    '-Werror=empty-body',
     '-Wno-non-virtual-dtor',
     '-Wno-missing-field-initializers',
     '-Wno-format-truncation',