From e8686a4170e408b27a6a6325885588bdf1ebb12e Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 20 Dec 2019 01:31:17 +0300 Subject: [PATCH] mdbx-cmake: add MDBX_FORCE_ASSERTIONS. --- CMakeLists.txt | 1 + src/elements/config.h.in | 1 + src/elements/core.c | 3 +++ src/elements/internals.h | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46f827eb..3fb33d3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,7 @@ mark_as_advanced(MDBX_LOCKING) add_mdbx_option(MDBX_TRUST_RTC "Does a system have battery-backed Real-Time Clock or just a fake." AUTO) mark_as_advanced(MDBX_TRUST_RTC) option(MDBX_ENABLE_TESTS "Build MDBX tests." ${BUILD_TESTING}) +option(MDBX_FORCE_ASSERTIONS "Force enable assertion checking." OFF) ################################################################################ ################################################################################ diff --git a/src/elements/config.h.in b/src/elements/config.h.in index 1079899d..b8776d98 100644 --- a/src/elements/config.h.in +++ b/src/elements/config.h.in @@ -12,6 +12,7 @@ #cmakedefine ENABLE_GPROF #cmakedefine ENABLE_GCOV #cmakedefine ENABLE_ASAN +#cmakedefine MDBX_FORCE_ASSERTIONS /* Common */ #cmakedefine01 MDBX_TXN_CHECKOWNER diff --git a/src/elements/core.c b/src/elements/core.c index 7e5fbd67..7482fda5 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -17070,6 +17070,9 @@ __dll_export #ifdef MDBX_USE_VALGRIND " MDBX_USE_VALGRIND=YES" #endif /* MDBX_USE_VALGRIND */ +#ifdef MDBX_FORCE_ASSERTIONS + " MDBX_FORCE_ASSERTIONS=YES" +#endif /* MDBX_FORCE_ASSERTIONS */ #ifdef _GNU_SOURCE " _GNU_SOURCE=YES" #else diff --git a/src/elements/internals.h b/src/elements/internals.h index 4bb1b3f5..d460b9ef 100644 --- a/src/elements/internals.h +++ b/src/elements/internals.h @@ -1010,7 +1010,7 @@ MDBX_INTERNAL_FUNC void mdbx_panic(const char *fmt, ...) __printf_args(1, 2); #define mdbx_audit_enabled() (0) -#if !defined(NDEBUG) || defined(MDBX_FORCE_ASSERT) +#if !defined(NDEBUG) || defined(MDBX_FORCE_ASSERTIONS) #define mdbx_assert_enabled() (1) #else #define mdbx_assert_enabled() (0)