invariant check macro fixes

This commit is contained in:
Arvid Norberg 2014-01-21 19:26:09 +00:00
parent 3547728a0e
commit e0644ce8f5
30 changed files with 38 additions and 39 deletions

View File

@ -1017,7 +1017,7 @@ namespace libtorrent
// get to download again after the disk has been
// blocked
connection_map::iterator m_next_disk_peer;
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -84,7 +84,7 @@ struct TORRENT_EXTRA_EXPORT bandwidth_manager
, bandwidth_channel* chan4 = 0
, bandwidth_channel* chan5 = 0);
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -249,7 +249,7 @@ namespace libtorrent
void on_connected();
void on_metadata();
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
ptime m_last_choke;
#endif

View File

@ -84,7 +84,7 @@ public:
}
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -321,7 +321,7 @@ namespace libtorrent
void thread_fun();
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -8,6 +8,8 @@
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#if TORRENT_USE_INVARIANT_CHECKS
namespace libtorrent
{
@ -67,7 +69,6 @@ namespace libtorrent
}
}
#if TORRENT_USE_INVARIANT_CHECKS
#define INVARIANT_CHECK \
invariant_checker const& _invariant_check = make_invariant_checker(*this); \
(void)_invariant_check; \

View File

@ -172,7 +172,7 @@ public:
int bucket_limit(int bucket) const;
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -93,7 +93,7 @@ public:
#if TORRENT_USE_ASSERTS
size_t allocation_size() const;
#endif
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -94,7 +94,7 @@ namespace libtorrent
index_type span() const
{ return (m_last - m_first) & 0xffff; }
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -362,13 +362,11 @@ namespace libtorrent
// the number of pieces we want and don't have
int num_want_left() const { return num_pieces() - m_num_have - m_num_filtered; }
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
// used in debug mode
void verify_priority(int start, int end, int prio) const;
void verify_pick(std::vector<piece_block> const& picked
, bitfield const& bits) const;
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant(const torrent* t = 0) const;
#endif
#if defined TORRENT_PICKER_LOG

View File

@ -150,7 +150,7 @@ namespace libtorrent
#if TORRENT_USE_ASSERTS
bool has_connection(const peer_connection* p);
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -697,7 +697,7 @@ namespace libtorrent
int move_storage_impl(std::string const& save_path, int flags);
int allocate_slot_for_piece(int piece_index);
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif
#ifdef TORRENT_STORAGE_DEBUG

View File

@ -756,7 +756,7 @@ namespace libtorrent
#endif
// DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -662,7 +662,7 @@ namespace libtorrent
// if we're logging member offsets, we need access to them
private:
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
friend class invariant_access;
void check_invariant() const;
#endif

View File

@ -126,7 +126,7 @@ namespace libtorrent
void write_allow_fast(int) {}
void write_suggest(int piece) {}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -127,7 +127,7 @@ namespace libtorrent
return 0;
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void bandwidth_manager::check_invariant() const
{
boost::int64_t queued = 0;

View File

@ -3343,7 +3343,7 @@ namespace libtorrent
}
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void bt_peer_connection::check_invariant() const
{
boost::shared_ptr<torrent> t = associated_torrent().lock();

View File

@ -173,7 +173,7 @@ namespace libtorrent
int connection_queue::limit() const
{ return m_half_open_limit; }
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void connection_queue::check_invariant() const
{
int num_connecting = 0;

View File

@ -920,7 +920,7 @@ namespace libtorrent
return ret;
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void disk_io_thread::check_invariant() const
{
int cached_write_blocks = 0;

View File

@ -1080,7 +1080,7 @@ void routing_table::find_node(node_id const& target
TORRENT_ASSERT(int(l.size()) <= count);
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void routing_table::check_invariant() const
{
std::multiset<address_v4::bytes_type> all_ips;

View File

@ -231,7 +231,7 @@ size_t rpc_manager::allocation_size() const
return observer_size;
}
#endif
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
void rpc_manager::check_invariant() const
{
for (transactions_t::const_iterator i = m_transactions.begin()

View File

@ -48,7 +48,7 @@ namespace libtorrent {
, m_last(0)
{}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void packet_buffer::check_invariant() const
{
int count = 0;

View File

@ -84,7 +84,7 @@ namespace libtorrent
#ifdef TORRENT_PICKER_LOG
std::cerr << "new piece_picker" << std::endl;
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
check_invariant();
#endif
}
@ -235,7 +235,7 @@ namespace libtorrent
m_downloads.erase(i);
}
#ifdef TORRENT_DEBUG
#if TORRENT_USE_INVARIANT_CHECKS
void piece_picker::verify_pick(std::vector<piece_block> const& picked
, bitfield const& bits) const
@ -292,9 +292,9 @@ namespace libtorrent
std::cerr << std::endl;
}
#endif // TORRENT_PIECE_PICKER
#endif // TORRENT_DEBUG
#endif // TORRENT_USE_INVARIANT_CHECKS
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void piece_picker::check_invariant(const torrent* t) const
{
#ifndef TORRENT_DEBUG_REFCOUNTS

View File

@ -1722,7 +1722,7 @@ namespace libtorrent
}
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void policy::check_invariant() const
{
TORRENT_ASSERT(m_num_connect_candidates >= 0);

View File

@ -6328,7 +6328,7 @@ retry:
#endif
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void session_impl::check_invariant() const
{
TORRENT_ASSERT(is_network_thread());

View File

@ -2959,7 +2959,7 @@ ret:
return m_slot_to_piece[slot];
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void piece_manager::check_invariant() const
{
TORRENT_ASSERT(m_current_slot <= m_files.num_pieces());

View File

@ -6104,7 +6104,7 @@ namespace libtorrent
}
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
m_policy.check_invariant();
#endif
@ -6586,7 +6586,7 @@ namespace libtorrent
return m_ses.settings();
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void torrent::check_invariant() const
{
for (std::deque<time_critical_piece>::const_iterator i = m_time_critical_pieces.begin()
@ -8398,7 +8398,7 @@ namespace libtorrent
m_storage->async_hash(piece_index, boost::bind(&torrent::on_piece_verified
, shared_from_this(), _1, _2, f));
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
check_invariant();
#endif
}

View File

@ -605,7 +605,7 @@ namespace libtorrent
, m_private(t.m_private)
, m_i2p(t.m_i2p)
{
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
t.check_invariant();
#endif
if (m_info_section_size > 0)
@ -1431,7 +1431,7 @@ namespace libtorrent
// ------- end deprecation -------
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void torrent_info::check_invariant() const
{
for (int i = 0; i < m_files.num_files(); ++i)

View File

@ -334,7 +334,7 @@ struct utp_socket_impl
void check_receive_buffers() const;
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const;
#endif
@ -3448,7 +3448,7 @@ void utp_socket_impl::check_receive_buffers() const
TORRENT_ASSERT(int(size) == m_receive_buffer_size);
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void utp_socket_impl::check_invariant() const
{
for (int i = m_outbuf.cursor();

View File

@ -192,7 +192,7 @@ namespace libtorrent
}
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#if TORRENT_USE_INVARIANT_CHECKS
void web_connection_base::check_invariant() const
{
/*