From 60523606cf57306ae86d25f664131c5243baf40c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 1 Mar 2022 15:09:15 +1000 Subject: [PATCH] meson.build: add -Wno-unused-variables when buildling with clang The test suite makes a lot of use of this pattern: _unref_(ei_event) *ev = peck_ei_event(....) Most of the work is done in the peck function, with the caller just needing cleanup. Unfortunately clang sees this as unused variable and insists on warning about all of them. Signed-off-by: Peter Hutterer --- meson.build | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meson.build b/meson.build index c6375ad..ae5937c 100644 --- a/meson.build +++ b/meson.build @@ -30,6 +30,17 @@ cflags =[ '-Wstrict-overflow=2', '-Wswitch', ] + +if cc.get_id() == 'clang' + cflags += [ + # clang doesn't think just using _unref_ is a use of the variable + # _unref_(foo) *bar = something_that_gives_a_ref + # but we make heavy use of that in the test suite for convenience + # of events we know must exist but we don't care about specifically + '-Wno-unused-variable', + ] +endif + add_project_arguments(cc.get_supported_arguments(cflags), language: 'c') config_h = configuration_data()