From b9be2fe94bdea309b619e2f79b2835cae7b6d76e Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 14 Aug 2011 23:55:41 +0000 Subject: [PATCH] fix production assert --- include/libtorrent/assert.hpp | 4 +++- src/assert.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/assert.hpp b/include/libtorrent/assert.hpp index 375f91ee5..8a66fe210 100644 --- a/include/libtorrent/assert.hpp +++ b/include/libtorrent/assert.hpp @@ -56,7 +56,9 @@ std::string demangle(char const* name); #include #endif -TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, char const* function, char const* val); +TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file + , char const* function, char const* val); + #define TORRENT_ASSERT(x) do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, 0); } while (false) #if TORRENT_USE_IOSTREAM #define TORRENT_ASSERT_VAL(x, y) do { if (x) {} else { std::stringstream __s__; __s__ << #y ": " << y; assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, __s__.str().c_str()); } } while (false) diff --git a/src/assert.cpp b/src/assert.cpp index 995933495..67a3060e9 100644 --- a/src/assert.cpp +++ b/src/assert.cpp @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. #if defined TORRENT_DEBUG || defined TORRENT_ASIO_DEBUGGING || TORRENT_RELEASE_ASSERTS +#include "libtorrent/config.hpp" + #ifdef __APPLE__ #include #endif @@ -122,7 +124,8 @@ void print_backtrace(char* out, int len) {} char const* libtorrent_assert_log = "asserts.log"; #endif -void assert_fail(char const* expr, int line, char const* file, char const* function, char const* value) +TORRENT_EXPORT void assert_fail(char const* expr, int line, char const* file + , char const* function, char const* value) { #if TORRENT_PRODUCTION_ASSERTS FILE* out = fopen(libtorrent_assert_log, "a+");