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.
This commit is contained in:
Thomas Haller 2020-09-08 18:35:56 +02:00
parent 391820da76
commit b867ac56a4
2 changed files with 8 additions and 1 deletions

View file

@ -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'

View file

@ -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')