From 106fd08b2d1f429fb02137202e7edae106bda92e Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 3 Mar 2025 19:49:56 -0500 Subject: [PATCH] Enable stack tracing in the case of debug builds. --- include/bitcoin/system/have.hpp | 3 --- include/bitcoin/system/preprocessor.hpp | 17 ++++++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/bitcoin/system/have.hpp b/include/bitcoin/system/have.hpp index 714e6fd6ac..0042a84fd0 100644 --- a/include/bitcoin/system/have.hpp +++ b/include/bitcoin/system/have.hpp @@ -213,9 +213,6 @@ /// Disable to unsuppress warnings. #define HAVE_SUPPRESSION -/// Disable noexcept to capture stack trace. -////#define HAVE_NOEXCEPT - /// Disable to emit all suppressed warnings. #define HAVE_WARNINGS diff --git a/include/bitcoin/system/preprocessor.hpp b/include/bitcoin/system/preprocessor.hpp index 206c0d57ee..23fa904998 100644 --- a/include/bitcoin/system/preprocessor.hpp +++ b/include/bitcoin/system/preprocessor.hpp @@ -60,6 +60,14 @@ #define BC_DEBUG_ONLY(expression) expression #endif +#if defined(NDEBUG) + #define NOEXCEPT + #define THROWS +#else + #define NOEXCEPT noexcept + #define THROWS noexcept(false) +#endif + /// Messages. /// --------------------------------------------------------------------------- @@ -189,15 +197,6 @@ /// Workarounds for C++ noncompliance. /// --------------------------------------------------------------------------- -/// C++11 (full) -#if defined(HAVE_NOEXCEPT) - #define NOEXCEPT noexcept - #define THROWS noexcept(false) -#else - #define NOEXCEPT - #define THROWS -#endif - /// C++14 (full) #if defined(HAVE_DEPRECATED) #define DEPRECATED [[deprecated]]