aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-05-05 11:53:42 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-05-20 14:20:26 -0700
commitd04e2c2f1fcf35501a1fdc87524b890c5f367995 (patch)
tree93a9d929ecd8ac51ccb0a6e87cd35f2af376b825
parent589a6249f0ffb0295c3f15233d1b6b3af9e4de16 (diff)
downloadmeson-d04e2c2f1fcf35501a1fdc87524b890c5f367995.zip
meson-d04e2c2f1fcf35501a1fdc87524b890c5f367995.tar.gz
meson-d04e2c2f1fcf35501a1fdc87524b890c5f367995.tar.bz2
compilers: Move b_ndebug into the compiler classes
Right now we hardcode -DNDEBUG as the value to be added for b_ndebug. Which is a not the correct behavior for non C/C++ languages. By pushing this back into the compiler classes we can change this for other languages.
-rw-r--r--mesonbuild/compilers/compilers.py5
-rw-r--r--mesonbuild/compilers/mixins/clike.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 9575273..d950e8f 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -320,7 +320,7 @@ def get_base_compile_args(options, compiler):
if (options['b_ndebug'].value == 'true' or
(options['b_ndebug'].value == 'if-release' and
options['buildtype'].value in {'release', 'plain'})):
- args += ['-DNDEBUG']
+ args += compiler.get_disable_assert_args()
except KeyError:
pass
# This does not need a try...except
@@ -1204,6 +1204,9 @@ class Compiler:
def get_coverage_link_args(self) -> T.List[str]:
return self.linker.get_coverage_args()
+ def get_disable_assert_args(self) -> T.List[str]:
+ return []
+
def get_largefile_args(compiler):
'''
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index e7b0cd2..01c984d 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -1137,3 +1137,6 @@ class CLikeCompiler:
return self.compiles(self.attribute_check_func(name), env,
extra_args=self.get_has_func_attribute_extra_args(name))
+
+ def get_disable_assert_args(self) -> T.List[str]:
+ return ['-DNDEBUG']