From 8abed38e557d344d68892b9ea16b0bde63ba5ccb Mon Sep 17 00:00:00 2001 From: khizmax Date: Wed, 24 Sep 2014 14:29:30 +0400 Subject: [PATCH] Replace CDS_DEBUG_DO with CDS_DEBUG_ONLY --- cds/details/defs.h | 4 ++-- cds/gc/hrc/details/hrc_inline.h | 6 +++--- cds/gc/hrc/details/hrc_retired.h | 2 +- cds/intrusive/optimistic_queue.h | 4 ++-- cds/intrusive/segmented_queue.h | 8 ++++---- cds/lock/spinlock.h | 4 ++-- cds/urcu/details/base.h | 4 ++-- src/hzp_gc.cpp | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cds/details/defs.h b/cds/details/defs.h index 6f6baebc..a69848ea 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -320,10 +320,10 @@ namespace cds {} // CDS_VERIFY: Debug - assert(_expr); Release - _expr #ifdef CDS_DEBUG # define CDS_VERIFY( _expr ) assert( _expr ) -# define CDS_DEBUG_DO( _expr ) _expr +# define CDS_DEBUG_ONLY( _expr ) _expr #else # define CDS_VERIFY( _expr ) _expr -# define CDS_DEBUG_DO( _expr ) +# define CDS_DEBUG_ONLY( _expr ) #endif #ifdef CDS_STRICT diff --git a/cds/gc/hrc/details/hrc_inline.h b/cds/gc/hrc/details/hrc_inline.h index a116582b..32df5258 100644 --- a/cds/gc/hrc/details/hrc_inline.h +++ b/cds/gc/hrc/details/hrc_inline.h @@ -31,18 +31,18 @@ namespace cds { namespace gc { namespace hrc { : m_bTrace( false ) , m_bDeleted( false ) { - CDS_DEBUG_DO( GarbageCollector::instance().dbgNodeConstructed() ; ) + CDS_DEBUG_ONLY( GarbageCollector::instance().dbgNodeConstructed() ; ) } inline ContainerNode::~ContainerNode() { assert( m_RC == 0 ); - CDS_DEBUG_DO( GarbageCollector::instance().dbgNodeDestructed() ; ) + CDS_DEBUG_ONLY( GarbageCollector::instance().dbgNodeDestructed() ; ) } inline void GarbageCollector::try_retire( ThreadGC * pThreadGC ) { - CDS_DEBUG_DO( unsigned int nAttempt = 0 ); + CDS_DEBUG_ONLY( unsigned int nAttempt = 0 ); do { pThreadGC->cleanUpLocal(); diff --git a/cds/gc/hrc/details/hrc_retired.h b/cds/gc/hrc/details/hrc_retired.h index aa2adcd4..90a3df6b 100644 --- a/cds/gc/hrc/details/hrc_retired.h +++ b/cds/gc/hrc/details/hrc_retired.h @@ -130,7 +130,7 @@ namespace cds { namespace gc { namespace hrc { size_t n = m_nFreeList; assert( m_arr[n].m_pNode.load( atomics::memory_order_relaxed ) == nullptr ); m_nFreeList = m_arr[n].m_nNextFree; - CDS_DEBUG_DO( m_arr[n].m_nNextFree = m_nEndFreeList ; ) + CDS_DEBUG_ONLY( m_arr[n].m_nNextFree = m_nEndFreeList ; ) m_arr[n].set( p, pFunc ); } diff --git a/cds/intrusive/optimistic_queue.h b/cds/intrusive/optimistic_queue.h index 30e22254..e1d57948 100644 --- a/cds/intrusive/optimistic_queue.h +++ b/cds/intrusive/optimistic_queue.h @@ -490,8 +490,8 @@ namespace cds { namespace intrusive { { clear(); node_type * pHead = m_pHead.load(memory_model::memory_order_relaxed); - CDS_DEBUG_DO( node_type * pTail = m_pTail.load(memory_model::memory_order_relaxed); ) - CDS_DEBUG_DO( assert( pHead == pTail ); ) + CDS_DEBUG_ONLY( node_type * pTail = m_pTail.load(memory_model::memory_order_relaxed); ) + CDS_DEBUG_ONLY( assert( pHead == pTail ); ) assert( pHead != nullptr ); m_pHead.store( nullptr, memory_model::memory_order_relaxed ); diff --git a/cds/intrusive/segmented_queue.h b/cds/intrusive/segmented_queue.h index f4182c78..2376e489 100644 --- a/cds/intrusive/segmented_queue.h +++ b/cds/intrusive/segmented_queue.h @@ -462,10 +462,10 @@ namespace cds { namespace intrusive { ++m_ItemCounter; while ( true ) { - CDS_DEBUG_DO( size_t nLoopCount = 0); + CDS_DEBUG_ONLY( size_t nLoopCount = 0); do { typename permutation_generator::integer_type i = gen; - CDS_DEBUG_DO( ++nLoopCount ); + CDS_DEBUG_ONLY( ++nLoopCount ); if ( pTailSegment->cells[i].load(memory_model::memory_order_relaxed).all() ) { // Cell is not empty, go next m_Stat.onPushPopulated(); @@ -621,10 +621,10 @@ namespace cds { namespace intrusive { bool bHadNullValue = false; cell item; - CDS_DEBUG_DO( size_t nLoopCount = 0 ); + CDS_DEBUG_ONLY( size_t nLoopCount = 0 ); do { typename permutation_generator::integer_type i = gen; - CDS_DEBUG_DO( ++nLoopCount ); + CDS_DEBUG_ONLY( ++nLoopCount ); // Guard the item // In segmented queue the cell cannot be reused diff --git a/cds/lock/spinlock.h b/cds/lock/spinlock.h index 0e5f457f..1b657fc6 100644 --- a/cds/lock/spinlock.h +++ b/cds/lock/spinlock.h @@ -122,7 +122,7 @@ namespace cds { bool bCurrent = false; m_spin.compare_exchange_strong( bCurrent, true, atomics::memory_order_acquire, atomics::memory_order_relaxed ); - CDS_DEBUG_DO( + CDS_DEBUG_ONLY( if ( !bCurrent ) { m_dbgOwnerId = OS::getCurrentThreadId(); } @@ -175,7 +175,7 @@ namespace cds { assert( m_spin.load( atomics::memory_order_relaxed ) ); assert( m_dbgOwnerId == OS::getCurrentThreadId() ); - CDS_DEBUG_DO( m_dbgOwnerId = OS::c_NullThreadId; ) + CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; ) m_spin.store( false, atomics::memory_order_release ); } diff --git a/cds/urcu/details/base.h b/cds/urcu/details/base.h index e45a862a..bcb7c53a 100644 --- a/cds/urcu/details/base.h +++ b/cds/urcu/details/base.h @@ -383,8 +383,8 @@ namespace cds { void destroy() { allocator_type al; - CDS_DEBUG_DO( cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId; ) - CDS_DEBUG_DO( cds::OS::ThreadId const mainThreadId = cds::OS::getCurrentThreadId() ;) + CDS_DEBUG_ONLY( cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId; ) + CDS_DEBUG_ONLY( cds::OS::ThreadId const mainThreadId = cds::OS::getCurrentThreadId() ;) thread_record * p = m_pHead.exchange( nullptr, atomics::memory_order_seq_cst ); while ( p ) { diff --git a/src/hzp_gc.cpp b/src/hzp_gc.cpp index c6131564..e171fbcc 100644 --- a/src/hzp_gc.cpp +++ b/src/hzp_gc.cpp @@ -58,8 +58,8 @@ namespace cds { namespace gc { GarbageCollector::~GarbageCollector() { - CDS_DEBUG_DO( const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; ) - CDS_DEBUG_DO( const cds::OS::ThreadId mainThreadId = cds::OS::getCurrentThreadId() ;) + CDS_DEBUG_ONLY( const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; ) + CDS_DEBUG_ONLY( const cds::OS::ThreadId mainThreadId = cds::OS::getCurrentThreadId() ;) hplist_node * pHead = m_pListHead.load( atomics::memory_order_relaxed ); m_pListHead.store( nullptr, atomics::memory_order_relaxed ); -- 2.34.1