summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-28 09:44:02 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-28 09:45:19 +0100
commita73f6213849bc659b0188a7169913ab1035afa7d (patch)
treea1c7fbf35c43b70956fd5b1c039ede8ed370e4db /meson.build
parentee36fed4389e71f0859a7b5d40e6218f3af797a6 (diff)
downloadsystemd-a73f6213849bc659b0188a7169913ab1035afa7d.tar.gz
systemd-a73f6213849bc659b0188a7169913ab1035afa7d.tar.bz2
systemd-a73f6213849bc659b0188a7169913ab1035afa7d.zip
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.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build10
1 files changed, 10 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 20bcb9d8b1..e446fe7370 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')