some cleanup of TORRENT_DEBUG defines (#863)
some cleanup of TORRENT_DEBUG defines
This commit is contained in:
parent
f7515edc8b
commit
a675682b6c
14
Jamfile
14
Jamfile
|
@ -113,7 +113,8 @@ rule linking ( properties * )
|
|||
}
|
||||
|
||||
if <target-os>windows in $(properties)
|
||||
&& ( <asserts>on in $(properties)
|
||||
&& ( <define>TORRENT_DEBUG
|
||||
|| <asserts>on in $(properties)
|
||||
|| <asserts>production in $(properties)
|
||||
|| <pool-allocators>debug in $(properties)
|
||||
|| <allocator>debug in $(properties)
|
||||
|
@ -338,7 +339,7 @@ rule building ( properties * )
|
|||
result += <cflags>-ftrapv ;
|
||||
}
|
||||
|
||||
if ( <variant>debug in $(properties)
|
||||
if ( <asserts>production in $(properties)
|
||||
|| <asserts>on in $(properties) )
|
||||
{
|
||||
result += <source>src/assert.cpp ;
|
||||
|
@ -422,10 +423,10 @@ feature memory-optimization : off on : composite propagated link-incompatible ;
|
|||
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;
|
||||
|
||||
feature asserts : auto on off production system : composite propagated ;
|
||||
feature.compose <asserts>on : <define>TORRENT_RELEASE_ASSERTS=1 ;
|
||||
feature.compose <asserts>production : <define>TORRENT_PRODUCTION_ASSERTS=1 <define>TORRENT_RELEASE_ASSERTS=1 ;
|
||||
feature.compose <asserts>on : <define>TORRENT_USE_ASSERTS=1 ;
|
||||
feature.compose <asserts>production : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_PRODUCTION_ASSERTS=1 ;
|
||||
feature.compose <asserts>system : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_USE_SYSTEM_ASSERTS=1 ;
|
||||
feature.compose <asserts>off : <define>TORRENT_USE_ASSERTS=0 ;
|
||||
feature.compose <asserts>system : <define>TORRENT_USE_SYSTEM_ASSERTS=1 ;
|
||||
|
||||
feature windows-version : vista win7 xp : composite propagated link-incompatible ;
|
||||
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
|
||||
|
@ -528,19 +529,16 @@ variant test_debug : debug
|
|||
<allocator>debug
|
||||
<invariant-checks>full <boost-link>shared
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
<define>TORRENT_DEBUG
|
||||
;
|
||||
variant test_barebones : debug
|
||||
: <ipv6>off <dht>off <extensions>off <logging>off <boost-link>shared
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
<define>TORRENT_DEBUG
|
||||
;
|
||||
variant test_arm : debug
|
||||
: <ipv6>off <dht>off <extensions>off <logging>off
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <asserts>on
|
||||
<define>TORRENT_DEBUG
|
||||
;
|
||||
|
||||
# required for openssl on windows
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace libtorrent { namespace aux
|
|||
template <std::size_t Size>
|
||||
struct handler_storage
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
handler_storage()
|
||||
: used(false)
|
||||
{}
|
||||
|
@ -96,7 +96,7 @@ namespace libtorrent { namespace aux
|
|||
{
|
||||
TORRENT_UNUSED(size);
|
||||
TORRENT_ASSERT(size <= Size);
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
TORRENT_ASSERT(!ctx->storage.used);
|
||||
ctx->storage.used = true;
|
||||
#endif
|
||||
|
@ -112,7 +112,7 @@ namespace libtorrent { namespace aux
|
|||
|
||||
TORRENT_ASSERT(size <= Size);
|
||||
TORRENT_ASSERT(ptr == &ctx->storage.bytes);
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ctx->storage.used = false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace libtorrent
|
|||
if (in == end)
|
||||
{
|
||||
err = true;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -242,7 +242,7 @@ namespace libtorrent
|
|||
ret = entry(entry::int_t);
|
||||
char* end_pointer;
|
||||
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
if (end_pointer == val.c_str())
|
||||
|
@ -265,7 +265,7 @@ namespace libtorrent
|
|||
bdecode_recursive(in, end, e, err, depth + 1);
|
||||
if (err)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -273,13 +273,13 @@ namespace libtorrent
|
|||
if (in == end)
|
||||
{
|
||||
err = true;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
TORRENT_ASSERT(*in == 'e');
|
||||
|
@ -298,7 +298,7 @@ namespace libtorrent
|
|||
bdecode_recursive(in, end, key, err, depth + 1);
|
||||
if (err || key.type() != entry::string_t)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -307,7 +307,7 @@ namespace libtorrent
|
|||
bdecode_recursive(in, end, e, err, depth + 1);
|
||||
if (err)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -315,13 +315,13 @@ namespace libtorrent
|
|||
if (in == end)
|
||||
{
|
||||
err = true;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
TORRENT_ASSERT(*in == 'e');
|
||||
|
@ -336,7 +336,7 @@ namespace libtorrent
|
|||
std::string len_s = read_until(in, end, ':', err);
|
||||
if (err)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -348,7 +348,7 @@ namespace libtorrent
|
|||
read_string(in, end, len, ret.string(), err);
|
||||
if (err)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
|
@ -357,12 +357,12 @@ namespace libtorrent
|
|||
else
|
||||
{
|
||||
err = true;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
}
|
||||
|
@ -421,9 +421,7 @@ namespace libtorrent
|
|||
entry e;
|
||||
bool err = false;
|
||||
detail::bdecode_recursive(start, end, e, err, 0);
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(e.m_type_queried == false);
|
||||
#endif
|
||||
if (err) return entry();
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
// builds have asserts if they are explicitly enabled by
|
||||
// the release_asserts macro.
|
||||
#ifndef TORRENT_USE_ASSERTS
|
||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
||||
#if defined TORRENT_DEBUG
|
||||
#define TORRENT_USE_ASSERTS 1
|
||||
#else
|
||||
#define TORRENT_USE_ASSERTS 0
|
||||
|
|
|
@ -678,7 +678,7 @@ namespace libtorrent
|
|||
void max_out_request_queue(int s);
|
||||
int max_out_request_queue() const;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
bool piece_failed;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ namespace libtorrent
|
|||
|
||||
storage_interface* get_storage_impl() { return m_storage.get(); }
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
void assert_torrent_refcount() const;
|
||||
#endif
|
||||
private:
|
||||
|
|
|
@ -45,10 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/performance_counters.hpp"
|
||||
#include "libtorrent/aux_/time.hpp"
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#include "libtorrent/random.hpp"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
The disk cache mimics ARC (adaptive replacement cache).
|
||||
|
@ -562,7 +558,7 @@ void block_cache::try_evict_one_volatile()
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -605,7 +601,7 @@ void block_cache::try_evict_one_volatile()
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1079,7 +1075,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1119,7 +1115,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1152,7 +1148,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1198,7 +1194,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
|
|
@ -1484,7 +1484,7 @@ namespace libtorrent
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1604,7 +1604,7 @@ namespace libtorrent
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1711,7 +1711,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_hash(piece_manager* storage, int piece, int flags
|
||||
, boost::function<void(disk_io_job const*)> handler, void* requester)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1756,7 +1756,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_move_storage(piece_manager* storage, std::string const& p, int flags
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1785,7 +1785,7 @@ namespace libtorrent
|
|||
, int const options
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1838,7 +1838,7 @@ namespace libtorrent
|
|||
, std::vector<std::string>& links
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1860,7 +1860,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_rename_file(piece_manager* storage, int index, std::string const& name
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1913,7 +1913,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_cache_piece(piece_manager* storage, int piece
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1930,7 +1930,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_finalize_file(piece_manager* storage, int file
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1948,7 +1948,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_flush_piece(piece_manager* storage, int piece
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -1974,7 +1974,7 @@ namespace libtorrent
|
|||
, std::vector<std::uint8_t> const& prios
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
@ -2030,7 +2030,7 @@ namespace libtorrent
|
|||
void disk_io_thread::async_clear_piece(piece_manager* storage, int index
|
||||
, boost::function<void(disk_io_job const*)> handler)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// the caller must increment the torrent refcount before
|
||||
// issuing an async disk request
|
||||
storage->assert_torrent_refcount();
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <functional>
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
#include <set>
|
||||
#endif
|
||||
|
||||
|
@ -226,7 +226,7 @@ namespace libtorrent
|
|||
, static_cast<void*>(m_peer_info)
|
||||
, print_endpoint(local_ep).c_str());
|
||||
#endif
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
piece_failed = false;
|
||||
#endif
|
||||
std::fill(m_peer_id.begin(), m_peer_id.end(), 0);
|
||||
|
@ -5444,7 +5444,7 @@ namespace libtorrent
|
|||
, channels + c, max_channels - c);
|
||||
}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
// make sure we don't have duplicates
|
||||
std::set<bandwidth_channel*> unique_classes;
|
||||
for (int i = 0; i < c; ++i)
|
||||
|
|
|
@ -1488,7 +1488,7 @@ namespace libtorrent
|
|||
piece_manager::~piece_manager()
|
||||
{}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
void piece_manager::assert_torrent_refcount() const
|
||||
{
|
||||
if (!m_torrent) return;
|
||||
|
|
Loading…
Reference in New Issue