use standard __func__ identifier instead of extensions

This commit is contained in:
arvidn 2019-02-26 15:00:40 +01:00 committed by Arvid Norberg
parent f5cf102e3c
commit 9bd5f424d3
4 changed files with 8 additions and 15 deletions

View File

@ -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("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } TORRENT_WHILE_0
libtorrent::assert_fail("<unconditional>", __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("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0)
libtorrent::assert_fail("<unconditional>", __LINE__, __FILE__, __func__, nullptr, 0)
#else
#include <cassert>

View File

@ -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.

View File

@ -285,7 +285,7 @@ static_assert(int(job_action_name.size()) == static_cast<int>(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

View File

@ -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("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr); } TORRENT_WHILE_0
do { assert_print_piece(piece); assert_fail("<unconditional>", __LINE__, __FILE__, __func__, nullptr); } TORRENT_WHILE_0
#else
#define TORRENT_PIECE_ASSERT(cond, piece) do {} TORRENT_WHILE_0