From a329a11b57df7867ca6d17618f27b68773bf1140 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 7 May 2011 19:58:38 +0000 Subject: [PATCH] add build option to always enable asserts (i.e. allow asserts in release builds) --- Jamfile | 3 ++- docs/building.rst | 3 ++- include/libtorrent/assert.hpp | 3 ++- src/assert.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Jamfile b/Jamfile index a4db961dc..74292191f 100755 --- a/Jamfile +++ b/Jamfile @@ -247,7 +247,8 @@ feature.compose off : TORRENT_USE_ICONV=0 ; feature full-stats : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_FULL_STATS ; -feature asserts : on off production system : composite propagated ; +feature asserts : auto on off production system : composite propagated ; +feature.compose on : TORRENT_RELEASE_ASSERTS=1 ; feature.compose production : TORRENT_PRODUCTION_ASSERTS=1 ; feature.compose off : TORRENT_NO_ASSERTS=1 ; feature.compose system : TORRENT_USE_SYSTEM_ASSERTS=1 ; diff --git a/docs/building.rst b/docs/building.rst index 04747eddb..639e69f3a 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -266,7 +266,8 @@ Build features: | | requires you to link against librt.a. This is | | | typically the case on x86 64 bit systems. | +--------------------------+----------------------------------------------------+ -| ``asserts`` | * ``on`` - asserts are on if in debug mode | +| ``asserts`` | * ``auto`` - asserts are on if in debug mode | +| | * ``on`` - asserts are on, even in release mode | | | * ``off`` - asserts are disabled | | | * ``production`` - assertion failures are logged | | | to ``asserts.log`` in the current working | diff --git a/include/libtorrent/assert.hpp b/include/libtorrent/assert.hpp index 604f9d250..3caeb2d3a 100644 --- a/include/libtorrent/assert.hpp +++ b/include/libtorrent/assert.hpp @@ -34,7 +34,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" -#if (!defined TORRENT_DEBUG && !TORRENT_PRODUCTION_ASSERTS) || TORRENT_NO_ASSERTS +#if (!defined TORRENT_DEBUG && !TORRENT_PRODUCTION_ASSERTS && TORRENT_RELEASE_ASSERTS) \ + || TORRENT_NO_ASSERTS #define TORRENT_ASSERT(a) do {} while(false) #define TORRENT_ASSERT_VAL(a, b) do {} while(false) #else diff --git a/src/assert.cpp b/src/assert.cpp index 80a491247..995933495 100644 --- a/src/assert.cpp +++ b/src/assert.cpp @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ -#if defined TORRENT_DEBUG || defined TORRENT_ASIO_DEBUGGING +#if defined TORRENT_DEBUG || defined TORRENT_ASIO_DEBUGGING || TORRENT_RELEASE_ASSERTS #ifdef __APPLE__ #include