diff --git a/Jamfile b/Jamfile index 6f6adeebe..8075f0d0b 100755 --- a/Jamfile +++ b/Jamfile @@ -245,9 +245,10 @@ 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 : composite propagated ; +feature asserts : on off production system : composite propagated ; feature.compose production : TORRENT_PRODUCTION_ASSERTS=1 ; feature.compose off : TORRENT_NO_ASSERTS=1 ; +feature.compose system : TORRENT_USE_SYSTEM_ASSERTS=1 ; feature windows-version : 2k xp vista win7 : composite propagated link-incompatible ; feature.compose 2k : _WIN32_WINNT=0x0500 ; diff --git a/docs/building.rst b/docs/building.rst index 1bfc10cad..04747eddb 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -363,6 +363,15 @@ Build features: | | * ``off`` - force not using iconv (disables locale | | | awareness except on windows). | +--------------------------+----------------------------------------------------+ +| ``asserts`` | * ``off`` - disable all asserts | +| | * ``peoduction`` - enable asserts in release | +| | builds, but don't abort, just log them to | +| | ``extern char const* libtorrent_assert_log``. | +| | * ``on`` - enable asserts in debug builds (this is | +| | the default). On GNU systems, print a stack | +| | trace of the assert and some more information. | +| | * ``system`` use the libc assert macro | ++--------------------------+----------------------------------------------------+ .. _MaxMind: http://www.maxmind.com/app/api @@ -626,6 +635,14 @@ defines you can use to control the build. | ``TORRENT_NO_DEPRECATE`` | This will exclude all deprecated functions from | | | the header files and cpp files. | +----------------------------------------+-------------------------------------------------+ +| ``TORRENT_PRODUCTION_ASSERTS`` | Define to either 0 or 1. Enables assert logging | +| | in release builds. | ++----------------------------------------+-------------------------------------------------+ +| ``TORRENT_NO_ASSERTS`` | Disables all asserts. | ++----------------------------------------+-------------------------------------------------+ +| ``TORRENT_USE_SYSTEM_ASSERTS`` | Uses the libc assert macro rather then the | +| | custom one. | ++----------------------------------------+-------------------------------------------------+ If you experience that libtorrent uses unreasonable amounts of cpu, it will diff --git a/include/libtorrent/assert.hpp b/include/libtorrent/assert.hpp index f5997bcf4..604f9d250 100644 --- a/include/libtorrent/assert.hpp +++ b/include/libtorrent/assert.hpp @@ -49,7 +49,7 @@ extern char const* libtorrent_assert_log; std::string demangle(char const* name); #endif -#if (defined __linux__ || defined __MACH__) && defined __GNUC__ +#if (defined __linux__ || defined __MACH__) && defined __GNUC__ && !TORRENT_USE_SYSTEM_ASSERT #if TORRENT_USE_IOSTREAM #include