From b867ac56a48167fb3263fbe569898e7b16c18ca3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 8 Sep 2020 18:35:56 +0200 Subject: [PATCH] build/meson: enable "more_asserts" only for devel builds more_asserts are our NetworkManager specific assertions, and the only point of having them at all (beside g_assert(), assert() and g_return*()), is that these assertions are disabled by default in production. meson always enabled them by default. That is definitely wrong. autotools enables more_asserts by default if we build a devel version from master. I think that is bad too, because (again) having these assertions disabled by default is the only point of having them. Anyway, mimic the behavior of autotools, to at least disable them in release builds. --- meson.build | 7 +++++++ meson_options.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 28913600d2..ffb0cb87dc 100644 --- a/meson.build +++ b/meson.build @@ -750,6 +750,13 @@ if enable_nm_cloud_setup endif more_asserts = get_option('more_asserts') +if more_asserts == 'auto' + if nm_minor_version % 2 == 0 + more_asserts = 'no' + else + more_asserts = 'all' + endif +endif if more_asserts == 'no' more_asserts = 0 elif more_asserts == 'all' diff --git a/meson_options.txt b/meson_options.txt index 8d243974d3..d4f62829fa 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -63,7 +63,7 @@ option('vapi', type : 'combo', choices : ['auto', 'true', 'false'], description: option('docs', type: 'boolean', value: false, description: 'use to build documentation') option('tests', type: 'combo', choices: ['yes', 'no', 'root'], value: 'yes', description: 'Build NetworkManager tests') option('firewalld_zone', type: 'boolean', value: true, description: 'Install and use firewalld zone for shared mode') -option('more_asserts', type: 'string', value: 'all', description: 'Enable more assertions for debugging (0 = no, 100 = all, default: all)') +option('more_asserts', type: 'string', value: 'auto', description: 'Enable more assertions for debugging (0 = no, 100 = all, default: auto)') option('more_logging', type: 'boolean', value: true, description: 'Enable more debug logging') option('valgrind', type: 'array', value: ['no'], description: 'Use valgrind to memory-check the tests') option('valgrind_suppressions', type: 'string', value: '', description: 'Use specific valgrind suppression file')