From a73f6213849bc659b0188a7169913ab1035afa7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 28 Mar 2019 09:44:02 +0100 Subject: [PATCH] meson: disable warnings about unused variables for NDEBUG builds With assertions disabled, we'd get a bunch of warnings that really bring no value. With this change, a default meson build with -Db_ndebug=true generates no warnings. --- meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meson.build b/meson.build index 20bcb9d8b1a..e446fe73702 100644 --- a/meson.build +++ b/meson.build @@ -383,6 +383,16 @@ if get_option('buildtype') != 'debug' possible_link_flags += '-Wl,--gc-sections' endif +if get_option('b_ndebug') == 'true' + # With asserts disabled with get a bunch of warnings about variables which + # are used only in the asserts. This is not useful at all, so let's just silence + # those warnings. + possible_cc_flags += [ + '-Wno-unused-variable', + '-Wno-unused-but-set-variable', + ] +endif + add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') -- 2.47.3