diff options
authorLyude Paul <>2019-04-24 14:48:35 -0400
committerLyude Paul <>2019-05-07 17:38:03 -0400
commit3f26aa32f2f9a17dd7fdf1a22321be02a6e63374 (patch)
parent800618644a61acb1a00aa0459cd3432d68e1eac7 (diff)
meson: Don't allow building with NDEBUG, ever
Following some discussion and confusion around whether or not assert() should be used, it seems the decision has come to "yes, sometimes". To quote Petri Latvala on the appropriate points to use assert() in lib/: However, it's the thought that matters, and this is slightly going off on a tangent. Those uses of assert in lib/ are for places where 1) something is fatally wrong and we need to drop everything and stop executing 2) cannot use igt_assert for it. That's for places where we can say "you tried testing your kernel but it has a bug". The lib/ asserts are for "IGT has a bug", or in a couple of cases, "your IGT setup has a bug". While we did come to the conclusion that we should possibly consider introducing a new API to check for bugs with igt (and prevent further testing if any are found), until then let's at least make sure that assert() always works where we expect it. So, accomplish this by raising an error if b_ndebug isn't set to 'false'. Additionally, run the compile check in lib/check-ndebug.h to make sure that the user does not have -DNDEBUG set in their CFLAGS, c_args options, etc. Reviewed-by: Petri Latvala <> Signed-off-by: Lyude Paul <>
1 files changed, 10 insertions, 0 deletions
diff --git a/ b/
index 3d466d52..8196ab63 100644
--- a/
+++ b/
@@ -3,12 +3,22 @@ project('igt-gpu-tools', 'c',
default_options: [
+ 'b_ndebug=false',
license : 'MIT',
meson_version : '>=0.46.0')
+if get_option('b_ndebug') != 'false'
+ error('Building without -Db_ndebug=false is not supported')
cc = meson.get_compiler('c')
+# Also make sure that the user doesn't have -DNDEBUG defined in their config
+if not cc.compiles(files('lib/check-ndebug.h'), args: get_option('c_args'))
+ error('Building with NDEBUG defined is not supported')
cc_args = [