Skip to content

Commit

Permalink
Undefine NDEBUG in test builds
Browse files Browse the repository at this point in the history
To avoid having to rely on a debug interpreter that doesn't define
`NDEBUG`, ensure we undefine it if we are in a test build. This allows
us to trigger asserts in test builds reliably.
  • Loading branch information
pablogsal committed Apr 12, 2022
1 parent 5ca2980 commit 8cd4ec0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def build_js_files(self):
"c_string_encoding": "utf8",
}
EXTRA_COMPILE_ARGS = []
UNDEF_MACROS = []

if TEST_BUILD:
COMPILER_DIRECTIVES = {
Expand All @@ -149,6 +150,7 @@ def build_js_files(self):
"c_string_encoding": "utf8",
}
EXTRA_COMPILE_ARGS = ["-D_GLIBCXX_DEBUG", "-D_LIBCPP_DEBUG"]
UNDEF_MACROS = ["NDEBUG"]

DEFINE_MACROS = []

Expand Down Expand Up @@ -199,6 +201,7 @@ def build_js_files(self):
extra_compile_args=["-std=c++17", "-Wall", *EXTRA_COMPILE_ARGS],
extra_link_args=["-std=c++17", "-l:libbacktrace.a"],
define_macros=DEFINE_MACROS,
undef_macros=UNDEF_MACROS,
)

PENSIEVE_EXTENSION.libraries.append("dl")
Expand Down

0 comments on commit 8cd4ec0

Please sign in to comment.