From 9bd5f424d357a7073dbeb5d56b3ce3da8f76f8c9 Mon Sep 17 00:00:00 2001 From: arvidn Date: Tue, 26 Feb 2019 15:00:40 +0100 Subject: [PATCH] use standard __func__ identifier instead of extensions --- include/libtorrent/assert.hpp | 10 +++++----- include/libtorrent/config.hpp | 7 ------- src/block_cache.cpp | 2 +- src/disk_io_thread.cpp | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/libtorrent/assert.hpp b/include/libtorrent/assert.hpp index a4f6fe8f1..ebfff56ad 100644 --- a/include/libtorrent/assert.hpp +++ b/include/libtorrent/assert.hpp @@ -86,19 +86,19 @@ extern TORRENT_EXPORT char const* libtorrent_assert_log; #ifndef TORRENT_USE_SYSTEM_ASSERTS #define TORRENT_ASSERT_PRECOND(x) \ - do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 1); } TORRENT_WHILE_0 + do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, __func__, nullptr, 1); } TORRENT_WHILE_0 #define TORRENT_ASSERT(x) \ - do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0); } TORRENT_WHILE_0 + do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, __func__, nullptr, 0); } TORRENT_WHILE_0 #if TORRENT_USE_IOSTREAM #define TORRENT_ASSERT_VAL(x, y) \ do { if (x) {} else { std::stringstream __s__; __s__ << #y ": " << y; \ - libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } } TORRENT_WHILE_0 + libtorrent::assert_fail(#x, __LINE__, __FILE__, __func__, __s__.str().c_str(), 0); } } TORRENT_WHILE_0 #define TORRENT_ASSERT_FAIL_VAL(y) \ do { std::stringstream __s__; __s__ << #y ": " << y; \ - libtorrent::assert_fail("", __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } TORRENT_WHILE_0 + libtorrent::assert_fail("", __LINE__, __FILE__, __func__, __s__.str().c_str(), 0); } TORRENT_WHILE_0 #else #define TORRENT_ASSERT_VAL(x, y) TORRENT_ASSERT(x) @@ -106,7 +106,7 @@ extern TORRENT_EXPORT char const* libtorrent_assert_log; #endif #define TORRENT_ASSERT_FAIL() \ - libtorrent::assert_fail("", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0) + libtorrent::assert_fail("", __LINE__, __FILE__, __func__, nullptr, 0) #else #include diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index e6034e1e1..ccdccc192 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -515,13 +515,6 @@ constexpr std::size_t TORRENT_WRITE_HANDLER_MAX_SIZE = 342; # endif #endif -#if defined __GNUC__ -#define TORRENT_FUNCTION __PRETTY_FUNCTION__ -#else -#define TORRENT_FUNCTION __FUNCTION__ -#endif - - // debug builds have asserts enabled by default, release // builds have asserts if they are explicitly enabled by // the release_asserts macro. diff --git a/src/block_cache.cpp b/src/block_cache.cpp index 28110239f..de69d49ea 100644 --- a/src/block_cache.cpp +++ b/src/block_cache.cpp @@ -285,7 +285,7 @@ static_assert(int(job_action_name.size()) == static_cast(job_action_t::num_ #define TORRENT_PIECE_ASSERT(cond, piece) \ - do { if (!(cond)) { assert_print_piece(piece); assert_fail(#cond, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr); } } TORRENT_WHILE_0 + do { if (!(cond)) { assert_print_piece(piece); assert_fail(#cond, __LINE__, __FILE__, __func__, nullptr); } } TORRENT_WHILE_0 #else #define TORRENT_PIECE_ASSERT(cond, piece) do {} TORRENT_WHILE_0 diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 2a5d42a82..5880b293f 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -76,10 +76,10 @@ namespace libtorrent { #if TORRENT_USE_ASSERTS #define TORRENT_PIECE_ASSERT(cond, piece) \ - do { if (!(cond)) { assert_print_piece(piece); assert_fail(#cond, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr); } } TORRENT_WHILE_0 + do { if (!(cond)) { assert_print_piece(piece); assert_fail(#cond, __LINE__, __FILE__, __func__, nullptr); } } TORRENT_WHILE_0 #define TORRENT_PIECE_ASSERT_FAIL(piece) \ - do { assert_print_piece(piece); assert_fail("", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr); } TORRENT_WHILE_0 + do { assert_print_piece(piece); assert_fail("", __LINE__, __FILE__, __func__, nullptr); } TORRENT_WHILE_0 #else #define TORRENT_PIECE_ASSERT(cond, piece) do {} TORRENT_WHILE_0