From: Simon Marchi Date: Thu, 21 Mar 2024 18:21:36 +0000 (-0400) Subject: cpp-common/bt2s: control span-lite's contract check based on BT_DEBUG_MODE X-Git-Url: https://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=81d7553f350a4f9b6c3b245dfc7cd912c48067a9 cpp-common/bt2s: control span-lite's contract check based on BT_DEBUG_MODE Enable or disable span-lite's contract checking feature based on BT_DEBUG_MODE. When contract checking is enabled and a contract assertion fails, span-lite calls `std::terminate()`. Change-Id: Ieba9a08712823daf4b77f135155cd15ec97900f5 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12119 Reviewed-by: Philippe Proulx Tested-by: jenkins --- diff --git a/src/cpp-common/bt2s/span.hpp b/src/cpp-common/bt2s/span.hpp index 94dd8011..4a7fc329 100644 --- a/src/cpp-common/bt2s/span.hpp +++ b/src/cpp-common/bt2s/span.hpp @@ -9,6 +9,12 @@ #define span_FEATURE_MAKE_SPAN 1 +#ifdef BT_DEBUG_MODE +# define span_CONFIG_CONTRACT_LEVEL_ON 1 +#else +# define span_CONFIG_CONTRACT_LEVEL_OFF 1 +#endif + #include "cpp-common/vendor/span-lite/span.hpp" /* IWYU pragma: export */ namespace bt2s {