From 512d2216f4843bb853811931fed6c234234a89ad Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 31 Jul 2017 10:46:43 +0300 Subject: [PATCH] Removed trailing spaces --- cds/algo/backoff_strategy.h | 4 +- cds/algo/bit_reversal.h | 70 ++++----- cds/algo/flat_combining/wait_strategy.h | 6 +- cds/algo/split_bitstring.h | 20 +-- cds/compiler/gcc/compiler_macro.h | 2 +- cds/compiler/gcc/defs.h | 2 +- cds/container/details/skip_list_base.h | 2 +- cds/container/impl/bronson_avltree_map_rcu.h | 8 +- cds/container/michael_map.h | 2 +- cds/container/michael_set.h | 2 +- cds/container/weak_ringbuffer.h | 70 ++++----- cds/details/throw_exception.h | 6 +- cds/gc/details/hp_common.h | 10 +- cds/gc/dhp.h | 40 ++--- cds/gc/hp.h | 18 +-- cds/intrusive/details/feldman_hashset_base.h | 4 +- cds/intrusive/details/skip_list_base.h | 4 +- cds/intrusive/details/split_list_base.h | 14 +- cds/intrusive/ellen_bintree_rcu.h | 2 +- cds/intrusive/impl/feldman_hashset.h | 4 +- cds/intrusive/impl/iterable_list.h | 8 +- cds/intrusive/michael_set.h | 2 +- cds/intrusive/split_list.h | 6 +- cds/intrusive/striped_set.h | 18 +-- cds/memory/vyukov_queue_pool.h | 2 +- cds/os/alloc_aligned.h | 2 +- cds/sync/spinlock.h | 4 +- cds/threading/details/pthread_manager.h | 8 +- cds/threading/details/wintls_manager.h | 4 +- cds/urcu/details/gp.h | 2 +- src/dhp.cpp | 44 +++--- src/hp.cpp | 20 +-- src/thread_data.cpp | 24 +-- test/include/cds_test/ext_byteswap.h | 2 +- test/include/cds_test/fc_hevy_value.h | 6 +- test/stress/main.cpp | 2 +- test/stress/map/del3/map_del3.cpp | 4 +- test/stress/map/delodd/map_delodd.cpp | 4 +- .../map/find_string/map_find_string.cpp | 4 +- .../map/insdel_func/map_insdel_func.cpp | 4 +- .../insdel_item_int/map_insdel_item_int.cpp | 4 +- .../map/insdel_string/map_insdel_string.cpp | 4 +- test/stress/map/insdelfind/map_insdelfind.cpp | 4 +- test/stress/map/iter_erase/map_iter_erase.cpp | 4 +- test/stress/map/iter_erase/map_iter_erase.h | 2 +- test/stress/map/minmax/map_minmax.h | 6 +- test/stress/queue/intrusive_push_pop.cpp | 4 +- test/stress/queue/pop.cpp | 4 +- test/stress/queue/push.cpp | 4 +- test/stress/queue/push_pop.cpp | 4 +- test/stress/queue/random.cpp | 2 +- test/stress/queue/spsc_buffer.cpp | 4 +- test/stress/queue/spsc_queue.cpp | 2 +- test/stress/queue/std_queue.h | 4 +- test/stress/set/del3/set_del3.cpp | 4 +- test/stress/set/delodd/set_delodd.cpp | 4 +- .../stress/set/insdel_find/set_insdelfind.cpp | 4 +- .../set/insdel_func/set_insdel_func.cpp | 4 +- .../set/insdel_string/set_insdel_string.cpp | 6 +- test/stress/set/iter_erase/set_iter_erase.cpp | 4 +- test/stress/set/iteration/set_iteration.cpp | 4 +- test/stress/set/set_type_feldman_hashset.h | 2 +- .../test_intrusive_iterable_list.h | 6 +- .../test_intrusive_michael_iterable_hp.h | 4 +- test/unit/map/test_michael_iterable_hp.h | 6 +- test/unit/misc/bit_reversal.cpp | 2 +- test/unit/misc/cxx11_atomic_class.cpp | 2 +- test/unit/misc/split_bitstring.cpp | 140 +++++++++--------- test/unit/queue/fcqueue.cpp | 26 ++-- test/unit/queue/test_bounded_queue.h | 36 ++--- test/unit/queue/vyukov_mpmc_queue.cpp | 16 +- test/unit/queue/weak_ringbuffer.cpp | 80 +++++----- test/unit/set/test_michael_iterable_hp.h | 6 +- test/unit/set/test_split_iterable_hp.h | 6 +- 74 files changed, 437 insertions(+), 437 deletions(-) diff --git a/cds/algo/backoff_strategy.h b/cds/algo/backoff_strategy.h index cc676cf8..237f63ca 100644 --- a/cds/algo/backoff_strategy.h +++ b/cds/algo/backoff_strategy.h @@ -351,9 +351,9 @@ namespace cds { Choosing the best value for th timeout is platform and application specific task. The default values for timeout is provided by \p Traits class that should \p timeout data member. There are two predefined \p Traits implementation: - - \p delay_const_traits - defines \p timeout as a constant (enum). + - \p delay_const_traits - defines \p timeout as a constant (enum). To change timeout you should recompile your application. - - \p delay_runtime_traits - specifies timeout as static data member that can be changed + - \p delay_runtime_traits - specifies timeout as static data member that can be changed at runtime to tune the back-off strategy. You may use \p Traits template parameter to separate back-off implementations. diff --git a/cds/algo/bit_reversal.h b/cds/algo/bit_reversal.h index ca9bcf7d..b102bfea 100644 --- a/cds/algo/bit_reversal.h +++ b/cds/algo/bit_reversal.h @@ -44,18 +44,18 @@ namespace cds { namespace algo { /// 32bit uint32_t operator()( uint32_t x ) const { - x = ( ( ( x & 0xaaaaaaaa ) >> 1 ) | ( ( x & 0x55555555 ) << 1 ) ); - x = ( ( ( x & 0xcccccccc ) >> 2 ) | ( ( x & 0x33333333 ) << 2 ) ); - x = ( ( ( x & 0xf0f0f0f0 ) >> 4 ) | ( ( x & 0x0f0f0f0f ) << 4 ) ); - x = ( ( ( x & 0xff00ff00 ) >> 8 ) | ( ( x & 0x00ff00ff ) << 8 ) ); - return( ( x >> 16 ) | ( x << 16 ) ); + x = ( ( ( x & 0xaaaaaaaa ) >> 1 ) | ( ( x & 0x55555555 ) << 1 )); + x = ( ( ( x & 0xcccccccc ) >> 2 ) | ( ( x & 0x33333333 ) << 2 )); + x = ( ( ( x & 0xf0f0f0f0 ) >> 4 ) | ( ( x & 0x0f0f0f0f ) << 4 )); + x = ( ( ( x & 0xff00ff00 ) >> 8 ) | ( ( x & 0x00ff00ff ) << 8 )); + return( ( x >> 16 ) | ( x << 16 )); } /// 64bit uint64_t operator()( uint64_t x ) const { - return ( static_cast( operator()( static_cast( x ) ) ) << 32 ) // low 32bit - | ( static_cast( operator()( static_cast( x >> 32 ) ) ) ); // high 32bit + return ( static_cast( operator()( static_cast( x )) ) << 32 ) // low 32bit + | ( static_cast( operator()( static_cast( x >> 32 )) )); // high 32bit } }; @@ -87,14 +87,14 @@ namespace cds { namespace algo { return ( static_cast( table[x & 0xff] ) << 24 ) | ( static_cast( table[( x >> 8 ) & 0xff] ) << 16 ) | ( static_cast( table[( x >> 16 ) & 0xff] ) << 8 ) | - ( static_cast( table[( x >> 24 ) & 0xff] ) ); + ( static_cast( table[( x >> 24 ) & 0xff] )); } /// 64bit uint64_t operator()( uint64_t x ) const { - return ( static_cast( operator()( static_cast( x ) ) ) << 32 ) | - static_cast( operator()( static_cast( x >> 32 ) ) ); + return ( static_cast( operator()( static_cast( x )) ) << 32 ) | + static_cast( operator()( static_cast( x >> 32 )) ); } }; @@ -106,7 +106,7 @@ namespace cds { namespace algo { //@cond static uint8_t muldiv32_byte( uint8_t b ) { - return static_cast( ( ( b * 0x0802LU & 0x22110LU ) | ( b * 0x8020LU & 0x88440LU ) ) * 0x10101LU >> 16 ); + return static_cast( ( ( b * 0x0802LU & 0x22110LU ) | ( b * 0x8020LU & 0x88440LU )) * 0x10101LU >> 16 ); } static uint8_t muldiv64_byte( uint8_t b ) @@ -117,43 +117,43 @@ namespace cds { namespace algo { // for 32bit architecture static uint32_t muldiv32( uint32_t x ) { - return static_cast( muldiv32_byte( static_cast( x >> 24 ) ) ) - | ( static_cast( muldiv32_byte( static_cast( x >> 16 ) ) ) << 8 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 8 ) ) ) << 16 ) - | ( static_cast( muldiv32_byte( static_cast( x ) ) ) << 24 ); + return static_cast( muldiv32_byte( static_cast( x >> 24 )) ) + | ( static_cast( muldiv32_byte( static_cast( x >> 16 )) ) << 8 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 8 )) ) << 16 ) + | ( static_cast( muldiv32_byte( static_cast( x )) ) << 24 ); } static uint64_t muldiv32( uint64_t x ) { - return static_cast( muldiv32_byte( static_cast( x >> 56 ) ) ) - | ( static_cast( muldiv32_byte( static_cast( x >> 48 ) ) ) << 8 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 40 ) ) ) << 16 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 32 ) ) ) << 24 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 24 ) ) ) << 32 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 16 ) ) ) << 40 ) - | ( static_cast( muldiv32_byte( static_cast( x >> 8 ) ) ) << 48 ) - | ( static_cast( muldiv32_byte( static_cast( x ) ) ) << 56 ); + return static_cast( muldiv32_byte( static_cast( x >> 56 )) ) + | ( static_cast( muldiv32_byte( static_cast( x >> 48 )) ) << 8 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 40 )) ) << 16 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 32 )) ) << 24 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 24 )) ) << 32 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 16 )) ) << 40 ) + | ( static_cast( muldiv32_byte( static_cast( x >> 8 )) ) << 48 ) + | ( static_cast( muldiv32_byte( static_cast( x )) ) << 56 ); } /// for 64bit architectire static uint32_t muldiv64( uint32_t x ) { - return static_cast( muldiv64_byte( static_cast( x >> 24 ) ) ) - | ( static_cast( muldiv64_byte( static_cast( x >> 16 ) ) ) << 8 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 8 ) ) ) << 16 ) - | ( static_cast( muldiv64_byte( static_cast( x ) ) ) << 24 ); + return static_cast( muldiv64_byte( static_cast( x >> 24 )) ) + | ( static_cast( muldiv64_byte( static_cast( x >> 16 )) ) << 8 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 8 )) ) << 16 ) + | ( static_cast( muldiv64_byte( static_cast( x )) ) << 24 ); } static uint64_t muldiv64( uint64_t x ) { - return static_cast( muldiv64_byte( static_cast( x >> 56 ) ) ) - | ( static_cast( muldiv64_byte( static_cast( x >> 48 ) ) ) << 8 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 40 ) ) ) << 16 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 32 ) ) ) << 24 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 24 ) ) ) << 32 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 16 ) ) ) << 40 ) - | ( static_cast( muldiv64_byte( static_cast( x >> 8 ) ) ) << 48 ) - | ( static_cast( muldiv64_byte( static_cast( x ) ) ) << 56 ); + return static_cast( muldiv64_byte( static_cast( x >> 56 )) ) + | ( static_cast( muldiv64_byte( static_cast( x >> 48 )) ) << 8 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 40 )) ) << 16 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 32 )) ) << 24 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 24 )) ) << 32 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 16 )) ) << 40 ) + | ( static_cast( muldiv64_byte( static_cast( x >> 8 )) ) << 48 ) + | ( static_cast( muldiv64_byte( static_cast( x )) ) << 56 ); } //@endcond diff --git a/cds/algo/flat_combining/wait_strategy.h b/cds/algo/flat_combining/wait_strategy.h index 8a4a567b..680a2154 100644 --- a/cds/algo/flat_combining/wait_strategy.h +++ b/cds/algo/flat_combining/wait_strategy.h @@ -252,7 +252,7 @@ namespace cds { namespace algo { namespace flat_combining { return true; } - bool ret = m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds ) ) == std::cv_status::no_timeout; + bool ret = m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds )) == std::cv_status::no_timeout; m_wakeup = false; return ret; } @@ -334,7 +334,7 @@ namespace cds { namespace algo { namespace flat_combining { return true; } - bool ret = rec.m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds ) ) == std::cv_status::no_timeout; + bool ret = rec.m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds )) == std::cv_status::no_timeout; m_wakeup = false; return ret; } @@ -411,7 +411,7 @@ namespace cds { namespace algo { namespace flat_combining { return true; } - bool ret = rec.m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds ) ) == std::cv_status::no_timeout; + bool ret = rec.m_condvar.wait_for( lock, std::chrono::milliseconds( c_nWaitMilliseconds )) == std::cv_status::no_timeout; rec.m_wakeup = false; return ret; } diff --git a/cds/algo/split_bitstring.h b/cds/algo/split_bitstring.h index bdcc1589..ef4909e1 100644 --- a/cds/algo/split_bitstring.h +++ b/cds/algo/split_bitstring.h @@ -71,7 +71,7 @@ namespace cds { namespace algo { public: /// Initializises the splitter with reference to \p h and zero start bit offset explicit split_bitstring( bitstring const& h ) - : cur_( reinterpret_cast( &h ) ) + : cur_( reinterpret_cast( &h )) , offset_( 0 ) , first_( cur_ ) , last_( cur_ + c_bitstring_size ) @@ -81,7 +81,7 @@ namespace cds { namespace algo { split_bitstring( bitstring const& h, size_t nBitOffset ) : cur_( reinterpret_cast( &h ) + nBitOffset / c_nBitPerByte ) , offset_( nBitOffset % c_nBitPerByte ) - , first_( reinterpret_cast( &h ) ) + , first_( reinterpret_cast( &h )) , last_( first_ + c_bitstring_size ) {} @@ -104,7 +104,7 @@ namespace cds { namespace algo { */ uint_type cut( unsigned count ) { - assert( !eos() ); + assert( !eos()); uint_type result = 0; # if defined( CDS_ARCH_LITTLE_ENDIAN ) @@ -218,7 +218,7 @@ namespace cds { namespace algo { public: /// Initializises the splitter with reference to \p h and zero start bit offset explicit byte_splitter( bitstring const& h ) - : cur_( reinterpret_cast( &h ) ) + : cur_( reinterpret_cast( &h )) , first_( cur_ ) , last_( cur_ + c_bitstring_size ) {} @@ -226,7 +226,7 @@ namespace cds { namespace algo { /// Initializises the splitter with reference to \p h and start bit offset \p nBitOffset byte_splitter( bitstring const& h, size_t nBitOffset ) : cur_( reinterpret_cast( &h ) + nBitOffset / c_nBitPerByte ) - , first_( reinterpret_cast( &h ) ) + , first_( reinterpret_cast( &h )) , last_( first_ + c_bitstring_size ) { assert( is_correct( static_cast( nBitOffset ))); @@ -252,8 +252,8 @@ namespace cds { namespace algo { */ uint_type cut( unsigned count ) { - assert( !eos() ); - assert( is_correct( count ) ); + assert( !eos()); + assert( is_correct( count )); uint_type result = 0; @@ -379,7 +379,7 @@ namespace cds { namespace algo { */ int_type cut( unsigned count ) { - assert( !eos() ); + assert( !eos()); assert( is_correct( count )); int_type result = ( number_ >> shift_ ) & (( 1 << count ) - 1 ); @@ -396,10 +396,10 @@ namespace cds { namespace algo { */ int_type safe_cut( unsigned count ) { - if ( eos() ) + if ( eos()) return 0; - unsigned rest = static_cast( rest_count() ); + unsigned rest = static_cast( rest_count()); if ( rest < count ) count = rest; return count ? cut( count ) : 0; diff --git a/cds/compiler/gcc/compiler_macro.h b/cds/compiler/gcc/compiler_macro.h index 3d419f48..18178c86 100644 --- a/cds/compiler/gcc/compiler_macro.h +++ b/cds/compiler/gcc/compiler_macro.h @@ -177,7 +177,7 @@ // Sanitizer attributes // Example: CDS_DISABLE_SANITIZE( "function" ) #ifdef CDS_ADDRESS_SANITIZER_ENABLED -# define CDS_SUPPRESS_SANITIZE( ... ) __attribute__(( no_sanitize( __VA_ARGS__ ) )) +# define CDS_SUPPRESS_SANITIZE( ... ) __attribute__(( no_sanitize( __VA_ARGS__ ))) #else # define CDS_SUPPRESS_SANITIZE( ... ) #endif diff --git a/cds/compiler/gcc/defs.h b/cds/compiler/gcc/defs.h index 35aa7de0..c8aaf832 100644 --- a/cds/compiler/gcc/defs.h +++ b/cds/compiler/gcc/defs.h @@ -116,7 +116,7 @@ // double-width CAS support // note: gcc-4.8 does not support double-word atomics // gcc-4.9: a lot of crashes when use DCAS -// gcc-7: 128-bit atomic is not lock-free, see https://gcc.gnu.org/ml/gcc/2017-01/msg00167.html +// gcc-7: 128-bit atomic is not lock-free, see https://gcc.gnu.org/ml/gcc/2017-01/msg00167.html // You can manually suppress wide-atomic support by defining in compiler command line: // for 64bit platform: -DCDS_DISABLE_128BIT_ATOMIC // for 32bit platform: -DCDS_DISABLE_64BIT_ATOMIC diff --git a/cds/container/details/skip_list_base.h b/cds/container/details/skip_list_base.h index c622234a..be4e3a50 100644 --- a/cds/container/details/skip_list_base.h +++ b/cds/container/details/skip_list_base.h @@ -214,7 +214,7 @@ namespace cds { namespace container { return pMem; } else - pMem = reinterpret_cast( node_allocator_type().allocate( 1 ) ); + pMem = reinterpret_cast( node_allocator_type().allocate( 1 )); return pMem; } diff --git a/cds/container/impl/bronson_avltree_map_rcu.h b/cds/container/impl/bronson_avltree_map_rcu.h index ff1f087f..d1e2d9fa 100644 --- a/cds/container/impl/bronson_avltree_map_rcu.h +++ b/cds/container/impl/bronson_avltree_map_rcu.h @@ -1349,7 +1349,7 @@ namespace cds { namespace container { if ( !pChild ) { // Found min/max - if ( pNode->is_valued( memory_model::memory_order_acquire ) ) { + if ( pNode->is_valued( memory_model::memory_order_acquire )) { int result = try_remove_node( pParent, pNode, nVersion, func, disp ); if ( result == update_flags::result_removed ) @@ -1785,7 +1785,7 @@ namespace cds { namespace container { int hLRL = height_null( child( pLRight, left_child, memory_model::memory_order_relaxed ), memory_model::memory_order_acquire ); int balance = hLL - hLRL; - if ( balance >= -1 && balance <= 1 && !( ( hLL == 0 || hLRL == 0 ) && !pLeft->is_valued( memory_model::memory_order_relaxed ) ) ) { + if ( balance >= -1 && balance <= 1 && !( ( hLL == 0 || hLRL == 0 ) && !pLeft->is_valued( memory_model::memory_order_relaxed )) ) { // nParent.child.left won't be damaged after a double rotation return rotate_right_over_left_locked( pParent, pNode, pLeft, hR, hLL, pLRight, hLRL ); } @@ -1798,7 +1798,7 @@ namespace cds { namespace container { // rotate right return rotate_right_locked( pParent, pNode, pLeft, hR, hLL, pLRight, hLR ); } - + return pNode; // retry } @@ -1840,7 +1840,7 @@ namespace cds { namespace container { node_type * pRLRight = child( pRLeft, right_child, memory_model::memory_order_relaxed ); int hRLR = height_null( pRLRight, memory_model::memory_order_acquire ); int balance = hRR - hRLR; - if ( balance >= -1 && balance <= 1 && !( ( hRR == 0 || hRLR == 0 ) && !pRight->is_valued( memory_model::memory_order_relaxed ) ) ) + if ( balance >= -1 && balance <= 1 && !( ( hRR == 0 || hRLR == 0 ) && !pRight->is_valued( memory_model::memory_order_relaxed )) ) return rotate_left_over_right_locked( pParent, pNode, hL, pRight, pRLeft, hRR, hRLR ); } diff --git a/cds/container/michael_map.h b/cds/container/michael_map.h index 9f851f69..912ae81d 100644 --- a/cds/container/michael_map.h +++ b/cds/container/michael_map.h @@ -688,7 +688,7 @@ namespace cds { namespace container { erase_at( Iterator const& iter ) #endif { - assert( iter != end() ); + assert( iter != end()); assert( iter.bucket() != nullptr ); if ( iter.bucket()->erase_at( iter.underlying_iterator())) { diff --git a/cds/container/michael_set.h b/cds/container/michael_set.h index fb23c442..32fddca4 100644 --- a/cds/container/michael_set.h +++ b/cds/container/michael_set.h @@ -584,7 +584,7 @@ namespace cds { namespace container { erase_at( Iterator const& iter ) #endif { - assert( iter != end() ); + assert( iter != end()); assert( iter.bucket() != nullptr ); if ( iter.bucket()->erase_at( iter.underlying_iterator())) { diff --git a/cds/container/weak_ringbuffer.h b/cds/container/weak_ringbuffer.h index cf021320..0198c032 100644 --- a/cds/container/weak_ringbuffer.h +++ b/cds/container/weak_ringbuffer.h @@ -127,8 +127,8 @@ namespace cds { namespace container { Ring buffer is a bounded queue. Additionally, \p %WeakRingBuffer supports batch operations - you can push/pop an array of elements. - There are a specialization \ref cds_nonintrusive_WeakRingBuffer_void "WeakRingBuffer" - that is not a queue but a "memory pool" between producer and consumer threads. + There are a specialization \ref cds_nonintrusive_WeakRingBuffer_void "WeakRingBuffer" + that is not a queue but a "memory pool" between producer and consumer threads. \p WeakRingBuffer supports variable-sized data. @warning: \p %WeakRingBuffer is developed for 64-bit architecture. @@ -201,7 +201,7 @@ namespace cds { namespace container { \code cds::container::WeakRingBuffer ringbuf; char const* arr[10]; - ringbuf.push( arr, 10, + ringbuf.push( arr, 10, []( std::string& element, char const* src ) { new( &element ) std::string( src ); }); @@ -221,10 +221,10 @@ namespace cds { namespace container { template bool push( Q* arr, size_t count, CopyFunc copy ) { - assert( count < capacity() ); + assert( count < capacity()); counter_type back = back_.load( memory_model::memory_order_relaxed ); - assert( static_cast( back - pfront_ ) <= capacity() ); + assert( static_cast( back - pfront_ ) <= capacity()); if ( static_cast( pfront_ + capacity() - back ) < count ) { pfront_ = front_.load( memory_model::memory_order_acquire ); @@ -276,7 +276,7 @@ namespace cds { namespace container { { counter_type back = back_.load( memory_model::memory_order_relaxed ); - assert( static_cast( back - pfront_ ) <= capacity() ); + assert( static_cast( back - pfront_ ) <= capacity()); if ( pfront_ + capacity() - back < 1 ) { pfront_ = front_.load( memory_model::memory_order_acquire ); @@ -309,7 +309,7 @@ namespace cds { namespace container { { counter_type back = back_.load( memory_model::memory_order_relaxed ); - assert( static_cast( back - pfront_ ) <= capacity() ); + assert( static_cast( back - pfront_ ) <= capacity()); if ( pfront_ + capacity() - back < 1 ) { pfront_ = front_.load( memory_model::memory_order_acquire ); @@ -377,10 +377,10 @@ namespace cds { namespace container { template bool pop( Q* arr, size_t count, CopyFunc copy ) { - assert( count < capacity() ); + assert( count < capacity()); counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) < capacity() ); + assert( static_cast( cback_ - front ) < capacity()); if ( static_cast( cback_ - front ) < count ) { cback_ = back_.load( memory_model::memory_order_acquire ); @@ -458,7 +458,7 @@ namespace cds { namespace container { bool dequeue_with( Func f ) { counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) < capacity() ); + assert( static_cast( cback_ - front ) < capacity()); if ( cback_ - front < 1 ) { cback_ = back_.load( memory_model::memory_order_acquire ); @@ -491,7 +491,7 @@ namespace cds { namespace container { value_type* front() { counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) < capacity() ); + assert( static_cast( cback_ - front ) < capacity()); if ( cback_ - front < 1 ) { cback_ = back_.load( memory_model::memory_order_acquire ); @@ -510,7 +510,7 @@ namespace cds { namespace container { bool pop_front() { counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) <= capacity() ); + assert( static_cast( cback_ - front ) <= capacity()); if ( cback_ - front < 1 ) { cback_ = back_.load( memory_model::memory_order_acquire ); @@ -529,7 +529,7 @@ namespace cds { namespace container { void clear() { value_type v; - while ( pop( v ) ); + while ( pop( v )); } /// Checks if the ring-buffer is empty @@ -668,7 +668,7 @@ namespace cds { namespace container { /// [producer] Reserve \p size bytes /** - The function returns a pointer to reserved buffer of \p size bytes. + The function returns a pointer to reserved buffer of \p size bytes. If no enough space in the ring buffer the function returns \p nullptr. After successful \p %back() you should fill the buffer provided and call \p push_back(): @@ -712,10 +712,10 @@ namespace cds { namespace container { size_t real_size = calc_real_size( size ); // check if we can reserve read_size bytes - assert( real_size < capacity() ); + assert( real_size < capacity()); counter_type back = back_.load( memory_model::memory_order_relaxed ); - assert( static_cast( back - pfront_ ) <= capacity() ); + assert( static_cast( back - pfront_ ) <= capacity()); if ( static_cast( pfront_ + capacity() - back ) < real_size ) { pfront_ = front_.load( memory_model::memory_order_acquire ); @@ -732,8 +732,8 @@ namespace cds { namespace container { size_t tail_size = capacity() - static_cast( buffer_.mod( back )); if ( tail_size < real_size ) { // make unused tail - assert( tail_size >= sizeof( size_t ) ); - assert( !is_tail( tail_size ) ); + assert( tail_size >= sizeof( size_t )); + assert( !is_tail( tail_size )); *reinterpret_cast( reserved ) = make_tail( tail_size - sizeof(size_t)); back += tail_size; @@ -757,7 +757,7 @@ namespace cds { namespace container { // reserve and store size *reinterpret_cast( reserved ) = size; - return reinterpret_cast( reserved + sizeof( size_t ) ); + return reinterpret_cast( reserved + sizeof( size_t )); } /// [producer] Push reserved bytes into ring @@ -801,8 +801,8 @@ namespace cds { namespace container { counter_type back = back_.load( memory_model::memory_order_relaxed ); uint8_t* reserved = buffer_.buffer() + buffer_.mod( back ); - size_t real_size = calc_real_size( *reinterpret_cast( reserved ) ); - assert( real_size < capacity() ); + size_t real_size = calc_real_size( *reinterpret_cast( reserved )); + assert( real_size < capacity()); back_.store( back + real_size, memory_model::memory_order_release ); } @@ -830,30 +830,30 @@ namespace cds { namespace container { std::pair front() { counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) < capacity() ); + assert( static_cast( cback_ - front ) < capacity()); if ( cback_ - front < sizeof( size_t )) { cback_ = back_.load( memory_model::memory_order_acquire ); - if ( cback_ - front < sizeof( size_t ) ) + if ( cback_ - front < sizeof( size_t )) return std::make_pair( nullptr, 0u ); } uint8_t * buf = buffer_.buffer() + buffer_.mod( front ); // check alignment - assert( ( reinterpret_cast( buf ) & ( sizeof( uintptr_t ) - 1 ) ) == 0 ); + assert( ( reinterpret_cast( buf ) & ( sizeof( uintptr_t ) - 1 )) == 0 ); size_t size = *reinterpret_cast( buf ); - if ( is_tail( size ) ) { + if ( is_tail( size )) { // unused tail, skip - CDS_VERIFY( pop_front() ); + CDS_VERIFY( pop_front()); front = front_.load( memory_model::memory_order_relaxed ); buf = buffer_.buffer() + buffer_.mod( front ); size = *reinterpret_cast( buf ); - assert( !is_tail( size ) ); - assert( buf == buffer_.buffer() ); + assert( !is_tail( size )); + assert( buf == buffer_.buffer()); } #ifdef _DEBUG @@ -896,18 +896,18 @@ namespace cds { namespace container { bool pop_front() { counter_type front = front_.load( memory_model::memory_order_relaxed ); - assert( static_cast( cback_ - front ) <= capacity() ); + assert( static_cast( cback_ - front ) <= capacity()); - if ( cback_ - front < sizeof(size_t) ) { + if ( cback_ - front < sizeof(size_t)) { cback_ = back_.load( memory_model::memory_order_acquire ); - if ( cback_ - front < sizeof( size_t ) ) + if ( cback_ - front < sizeof( size_t )) return false; } uint8_t * buf = buffer_.buffer() + buffer_.mod( front ); // check alignment - assert( ( reinterpret_cast( buf ) & ( sizeof( uintptr_t ) - 1 ) ) == 0 ); + assert( ( reinterpret_cast( buf ) & ( sizeof( uintptr_t ) - 1 )) == 0 ); size_t size = *reinterpret_cast( buf ); size_t real_size = calc_real_size( untail( size )); @@ -927,7 +927,7 @@ namespace cds { namespace container { /// [consumer] Clears the ring buffer void clear() { - for ( auto el = front(); el.first; el = front() ) + for ( auto el = front(); el.first; el = front()) pop_front(); } @@ -962,7 +962,7 @@ namespace cds { namespace container { size_t real_size = (( size + sizeof( uintptr_t ) - 1 ) & ~( sizeof( uintptr_t ) - 1 )) + sizeof( size_t ); assert( real_size > size ); - assert( real_size - size >= sizeof( size_t ) ); + assert( real_size - size >= sizeof( size_t )); return real_size; } @@ -979,7 +979,7 @@ namespace cds { namespace container { static size_t untail( size_t size ) { - return size & (( size_t( 1 ) << ( sizeof( size_t ) * 8 - 1 ) ) - 1); + return size & (( size_t( 1 ) << ( sizeof( size_t ) * 8 - 1 )) - 1); } //@endcond diff --git a/cds/details/throw_exception.h b/cds/details/throw_exception.h index 187c4ffb..047e00f8 100644 --- a/cds/details/throw_exception.h +++ b/cds/details/throw_exception.h @@ -46,11 +46,11 @@ namespace cds { throws the \p exception. If exception is disabled, \p %throw_exception() prints an exception message to - standard output and call \p abort(). + standard output and call \p abort(). You can supply your own \p %cds::throw_exception() function; for that you should specify \p -DCDS_USER_DEFINED_THROW_EXCEPTION - in compiler command line. + in compiler command line. @note \p %throw_exception() never returns. If the user-defined \p %throw_exception() returns, the behavior is undefined. @@ -71,7 +71,7 @@ namespace cds { template CDS_NORETURN static inline void throw_exception( E&& exception, char const* file, int line ) { - printf( "file %s, line %d: %s\n", file, line, exception.what() ); + printf( "file %s, line %d: %s\n", file, line, exception.what()); abort(); } #endif diff --git a/cds/gc/details/hp_common.h b/cds/gc/details/hp_common.h index be180677..3beea932 100644 --- a/cds/gc/details/hp_common.h +++ b/cds/gc/details/hp_common.h @@ -85,7 +85,7 @@ namespace cds { namespace gc { namespace hp { namespace common { template T* get_as() const noexcept { - return reinterpret_cast( get() ); + return reinterpret_cast( get()); } template @@ -130,7 +130,7 @@ namespace cds { namespace gc { namespace hp { namespace common { guard* operator[]( size_t idx ) const noexcept { - assert( idx < capacity() ); + assert( idx < capacity()); return arr_[idx]; } @@ -145,7 +145,7 @@ namespace cds { namespace gc { namespace hp { namespace common { void clear( size_t idx ) noexcept { - assert( idx < capacity() ); + assert( idx < capacity()); assert( arr_[idx] != nullptr ); arr_[idx]->clear(); @@ -153,7 +153,7 @@ namespace cds { namespace gc { namespace hp { namespace common { guard* release( size_t idx ) noexcept { - assert( idx < capacity() ); + assert( idx < capacity()); guard* g = arr_[idx]; arr_[idx] = nullptr; @@ -162,7 +162,7 @@ namespace cds { namespace gc { namespace hp { namespace common { void reset( size_t idx, guard* g ) noexcept { - assert( idx < capacity() ); + assert( idx < capacity()); assert( arr_[idx] == nullptr ); arr_[idx] = g; diff --git a/cds/gc/dhp.h b/cds/gc/dhp.h index d9dbf11f..5772cc97 100644 --- a/cds/gc/dhp.h +++ b/cds/gc/dhp.h @@ -107,7 +107,7 @@ namespace cds { namespace gc { //@cond /// Per-thread hazard pointer storage - class thread_hp_storage + class thread_hp_storage { friend class smr; public: @@ -326,13 +326,13 @@ namespace cds { namespace gc { { assert( current_block_ != nullptr ); assert( current_block_->first() <= current_cell_ ); - assert( current_cell_ < current_block_->last() ); + assert( current_cell_ < current_block_->last()); //assert( &p != current_cell_ ); *current_cell_ = p; CDS_HPSTAT( ++retire_call_count_ ); - if ( ++current_cell_ == current_block_->last() ) { + if ( ++current_cell_ == current_block_->last()) { // goto next block if exists if ( current_block_->next_ ) { current_block_ = current_block_->next_; @@ -349,7 +349,7 @@ namespace cds { namespace gc { } bool repush( retired_ptr* p ) CDS_NOEXCEPT - { + { bool ret = push( *p ); CDS_HPSTAT( --retire_call_count_ ); assert( ret ); @@ -393,7 +393,7 @@ namespace cds { namespace gc { { assert( list_head_ != nullptr ); assert( current_block_ == list_tail_ ); - assert( current_cell_ == current_block_->last() ); + assert( current_cell_ == current_block_->last()); retired_block* block = retired_allocator::instance().alloc(); assert( block->next_ == nullptr ); @@ -456,10 +456,10 @@ namespace cds { namespace gc { free_count = scan_count = help_scan_count = - thread_rec_count = - hp_block_count = - retired_block_count = - hp_extend_count = + thread_rec_count = + hp_block_count = + retired_block_count = + hp_extend_count = retired_extend_count = 0; } }; @@ -517,7 +517,7 @@ namespace cds { namespace gc { assert( instance_ != nullptr ); # else if ( !instance_ ) - CDS_THROW_EXCEPTION( not_initialized() ); + CDS_THROW_EXCEPTION( not_initialized()); # endif return *instance_; } @@ -729,7 +729,7 @@ namespace cds { namespace gc { public: /// Default ctor allocates a guard (hazard pointer) from thread-private storage Guard() CDS_NOEXCEPT - : guard_( dhp::smr::tls()->hazards_.alloc() ) + : guard_( dhp::smr::tls()->hazards_.alloc()) {} /// Initilalizes an unlinked guard i.e. the guard contains no hazard pointer. Used for move semantics support @@ -984,7 +984,7 @@ namespace cds { namespace gc { template T protect( size_t nIndex, atomics::atomic const& toGuard ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); T pRet; do { @@ -1014,7 +1014,7 @@ namespace cds { namespace gc { template T protect( size_t nIndex, atomics::atomic const& toGuard, Func f ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); T pRet; do { @@ -1031,7 +1031,7 @@ namespace cds { namespace gc { template T * assign( size_t nIndex, T * p ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); guards_.set( nIndex, p ); dhp::smr::tls()->sync(); @@ -1072,14 +1072,14 @@ namespace cds { namespace gc { template T * get( size_t nIndex ) const { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); return guards_[nIndex]->template get_as(); } /// Get native guarded pointer stored guarded_pointer get_native( size_t nIndex ) const { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); return guards_[nIndex]->get(); } @@ -1238,14 +1238,14 @@ namespace cds { namespace gc { value_type * operator ->() const CDS_NOEXCEPT { assert( !empty()); - return value_cast()( guard_->get_as() ); + return value_cast()( guard_->get_as()); } /// Returns a reference to guarded value value_type& operator *() CDS_NOEXCEPT { assert( !empty()); - return *value_cast()( guard_->get_as() ); + return *value_cast()( guard_->get_as()); } /// Returns const reference to guarded value @@ -1384,7 +1384,7 @@ namespace cds { namespace gc { static void retire( T * p, void (* func)(void *)) { dhp::thread_data* rec = dhp::smr::tls(); - if ( !rec->retired_.push( dhp::retired_ptr( p, func ) ) ) + if ( !rec->retired_.push( dhp::retired_ptr( p, func )) ) dhp::smr::instance().scan( rec ); } @@ -1456,7 +1456,7 @@ namespace cds { namespace gc { */ static void scan() { - dhp::smr::instance().scan( dhp::smr::tls() ); + dhp::smr::instance().scan( dhp::smr::tls()); } /// Synonym for \p scan() diff --git a/cds/gc/hp.h b/cds/gc/hp.h index ba57dca6..75e8953a 100644 --- a/cds/gc/hp.h +++ b/cds/gc/hp.h @@ -153,7 +153,7 @@ namespace cds { namespace gc { # ifdef CDS_DISABLE_SMR_EXCEPTION assert( !full()); # else - if ( full() ) + if ( full()) CDS_THROW_EXCEPTION( not_enought_hazard_ptr()); # endif guard* g = free_head_; @@ -164,7 +164,7 @@ namespace cds { namespace gc { void free( guard* g ) CDS_NOEXCEPT { - assert( g >= array_ && g < array_ + capacity() ); + assert( g >= array_ && g < array_ + capacity()); if ( g ) { g->clear(); @@ -220,7 +220,7 @@ namespace cds { namespace gc { guard& operator[]( size_t idx ) { - assert( idx < capacity() ); + assert( idx < capacity()); return array_[idx]; } @@ -393,8 +393,8 @@ namespace cds { namespace gc { /// \p smr::scan() strategy enum scan_type { - classic, ///< classic scan as described in Michael's works (see smr::classic_scan() ) - inplace ///< inplace scan without allocation (see smr::inplace_scan() ) + classic, ///< classic scan as described in Michael's works (see smr::classic_scan()) + inplace ///< inplace scan without allocation (see smr::inplace_scan()) }; //@cond @@ -521,7 +521,7 @@ namespace cds { namespace gc { # ifdef CDS_DISABLE_SMR_EXCEPTION assert( false ); // not enough hazard ptr # else - CDS_THROW_EXCEPTION( not_enought_hazard_ptr() ); + CDS_THROW_EXCEPTION( not_enought_hazard_ptr()); # endif } } @@ -698,7 +698,7 @@ namespace cds { namespace gc { @warning Can throw \p too_many_hazard_ptr_exception if internal hazard pointer objects are exhausted. */ Guard() - : guard_( hp::smr::tls()->hazards_.alloc() ) + : guard_( hp::smr::tls()->hazards_.alloc()) {} /// Initilalizes an unlinked guard i.e. the guard contains no hazard pointer. Used for move semantics support @@ -1006,7 +1006,7 @@ namespace cds { namespace gc { template T * assign( size_t nIndex, T * p ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); guards_.set( nIndex, p ); hp::smr::tls()->sync(); @@ -1046,7 +1046,7 @@ namespace cds { namespace gc { template T * get( size_t nIndex ) const { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); return guards_[nIndex]->template get_as(); } diff --git a/cds/intrusive/details/feldman_hashset_base.h b/cds/intrusive/details/feldman_hashset_base.h index 60b00a62..5cf7bcfd 100644 --- a/cds/intrusive/details/feldman_hashset_base.h +++ b/cds/intrusive/details/feldman_hashset_base.h @@ -650,7 +650,7 @@ namespace cds { namespace intrusive { bool expand_slot( traverse_data& pos, node_ptr current) { - assert( !pos.splitter.eos() ); + assert( !pos.splitter.eos()); return expand_slot( pos.pArr, pos.nSlot, current, pos.splitter.bit_offset()); } @@ -671,7 +671,7 @@ namespace cds { namespace intrusive { return false; } - typename hash_splitter::uint_type idx = hash_splitter( hash_accessor()(*current.ptr()), nOffset ).cut( + typename hash_splitter::uint_type idx = hash_splitter( hash_accessor()(*current.ptr()), nOffset ).cut( static_cast( m_Metrics.array_node_size_log )); pArr->nodes[idx].store(current, memory_model::memory_order_release); diff --git a/cds/intrusive/details/skip_list_base.h b/cds/intrusive/details/skip_list_base.h index e2f4d52d..89371d53 100644 --- a/cds/intrusive/details/skip_list_base.h +++ b/cds/intrusive/details/skip_list_base.h @@ -276,7 +276,7 @@ namespace cds { namespace intrusive { \p c_nUpperBound must be no more than 32. - random_generator() - the constructor of generator object initialises the generator instance (its internal state). - unsigned int operator()() - the main generating function. Returns random level from range [0 .. c_nUpperBound - 1] - + Stateful generators are supported. @@ -684,7 +684,7 @@ namespace cds { namespace intrusive { - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default) or \p opt::v::sequential_consistent (sequentially consisnent memory model). - \p skip_list::random_level_generator - random level generator. Can be \p skip_list::xor_shift, - \p skip_list::turbo32 (the default) or user-provided one. + \p skip_list::turbo32 (the default) or user-provided one. See \p skip_list::random_level_generator option description for explanation. - \p opt::allocator - although the skip-list is an intrusive container, an allocator should be provided to maintain variable randomly-calculated height of the node diff --git a/cds/intrusive/details/split_list_base.h b/cds/intrusive/details/split_list_base.h index ce7c299e..8f2f0ed3 100644 --- a/cds/intrusive/details/split_list_base.h +++ b/cds/intrusive/details/split_list_base.h @@ -492,8 +492,8 @@ namespace cds { namespace intrusive { if ( m_nAuxNodeAllocated.load( memory_model::memory_order_relaxed ) < capacity()) { // alloc next free node from m_auxNode size_t const idx = m_nAuxNodeAllocated.fetch_add( 1, memory_model::memory_order_relaxed ); - if ( idx < capacity() ) { - CDS_TSAN_ANNOTATE_NEW_MEMORY( &m_auxNode[idx], sizeof( aux_node_type ) ); + if ( idx < capacity()) { + CDS_TSAN_ANNOTATE_NEW_MEMORY( &m_auxNode[idx], sizeof( aux_node_type )); return new( &m_auxNode[idx] ) aux_node_type(); } } @@ -710,7 +710,7 @@ namespace cds { namespace intrusive { if ( aux_segment->aux_node_count.load( memory_model::memory_order_acquire ) < m_metrics.nSegmentSize ) { size_t idx = aux_segment->aux_node_count.fetch_add( 1, memory_model::memory_order_relaxed ); if ( idx < m_metrics.nSegmentSize ) { - CDS_TSAN_ANNOTATE_NEW_MEMORY( aux_segment->segment() + idx, sizeof( aux_node_type ) ); + CDS_TSAN_ANNOTATE_NEW_MEMORY( aux_segment->segment() + idx, sizeof( aux_node_type )); return new( aux_segment->segment() + idx ) aux_node_type(); } } @@ -727,9 +727,9 @@ namespace cds { namespace intrusive { new_aux_segment->next_segment = aux_segment; new_aux_segment->aux_node_count.fetch_add( 1, memory_model::memory_order_relaxed ); - if ( m_auxNodeList.compare_exchange_strong( aux_segment, new_aux_segment, memory_model::memory_order_release, atomics::memory_order_acquire ) ) { - CDS_TSAN_ANNOTATE_NEW_MEMORY( new_aux_segment->segment(), sizeof( aux_node_type ) ); - return new( new_aux_segment->segment() ) aux_node_type(); + if ( m_auxNodeList.compare_exchange_strong( aux_segment, new_aux_segment, memory_model::memory_order_release, atomics::memory_order_acquire )) { + CDS_TSAN_ANNOTATE_NEW_MEMORY( new_aux_segment->segment(), sizeof( aux_node_type )); + return new( new_aux_segment->segment()) aux_node_type(); } free_aux_segment( new_aux_segment ); @@ -810,7 +810,7 @@ namespace cds { namespace intrusive { aux_node_segment* allocate_aux_segment() { char* p = raw_allocator().allocate( sizeof( aux_node_segment ) + sizeof( aux_node_type ) * m_metrics.nSegmentSize ); - CDS_TSAN_ANNOTATE_NEW_MEMORY( p, sizeof( aux_node_segment ) ); + CDS_TSAN_ANNOTATE_NEW_MEMORY( p, sizeof( aux_node_segment )); return new(p) aux_node_segment(); } diff --git a/cds/intrusive/ellen_bintree_rcu.h b/cds/intrusive/ellen_bintree_rcu.h index 97ffde6c..2919d961 100644 --- a/cds/intrusive/ellen_bintree_rcu.h +++ b/cds/intrusive/ellen_bintree_rcu.h @@ -599,7 +599,7 @@ namespace cds { namespace intrusive { } static void free_update_desc_void( void* pDesc ) { - free_update_desc( reinterpret_cast( pDesc ) ); + free_update_desc( reinterpret_cast( pDesc )); } class retired_list diff --git a/cds/intrusive/impl/feldman_hashset.h b/cds/intrusive/impl/feldman_hashset.h index 68f4c66e..95f1888a 100644 --- a/cds/intrusive/impl/feldman_hashset.h +++ b/cds/intrusive/impl/feldman_hashset.h @@ -640,7 +640,7 @@ namespace cds { namespace intrusive { return false; } - if ( !pos.splitter.eos() ) { + if ( !pos.splitter.eos()) { // the slot must be expanded base_class::expand_slot( pos, slot ); } @@ -1219,7 +1219,7 @@ namespace cds { namespace intrusive { } if ( bInsert ) { - if ( !pos.splitter.eos() ) { + if ( !pos.splitter.eos()) { // the slot must be expanded base_class::expand_slot( pos, slot ); } diff --git a/cds/intrusive/impl/iterable_list.h b/cds/intrusive/impl/iterable_list.h index f9f5b2a3..baa1bcbd 100644 --- a/cds/intrusive/impl/iterable_list.h +++ b/cds/intrusive/impl/iterable_list.h @@ -597,12 +597,12 @@ namespace cds { namespace intrusive { */ bool erase_at( iterator const& iter ) { - assert( iter != end() ); + assert( iter != end()); - marked_data_ptr val( iter.data() ); - if ( iter.m_pNode->data.compare_exchange_strong( val, marked_data_ptr(), memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + marked_data_ptr val( iter.data()); + if ( iter.m_pNode->data.compare_exchange_strong( val, marked_data_ptr(), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { --m_ItemCounter; - retire_data( val.ptr() ); + retire_data( val.ptr()); m_Stat.onEraseSuccess(); return true; } diff --git a/cds/intrusive/michael_set.h b/cds/intrusive/michael_set.h index c1daccfc..fe2c2f95 100644 --- a/cds/intrusive/michael_set.h +++ b/cds/intrusive/michael_set.h @@ -640,7 +640,7 @@ namespace cds { namespace intrusive { erase_at( Iterator const& iter ) #endif { - assert( iter != end() ); + assert( iter != end()); assert( iter.bucket() != nullptr ); if ( iter.bucket()->erase_at( iter.underlying_iterator())) { diff --git a/cds/intrusive/split_list.h b/cds/intrusive/split_list.h index 1eadcfe3..691a089d 100644 --- a/cds/intrusive/split_list.h +++ b/cds/intrusive/split_list.h @@ -862,7 +862,7 @@ namespace cds { namespace intrusive { erase_at( Iterator const& iter ) #endif { - assert( iter != end() ); + assert( iter != end()); if ( m_List.erase_at( iter.underlying_iterator())) { --m_ItemCounter; @@ -1170,7 +1170,7 @@ namespace cds { namespace intrusive { p->m_nHash = nHash; CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; # ifdef CDS_DEBUG - cds_assert( !p->m_busy.load( atomics::memory_order_acquire ) ); + cds_assert( !p->m_busy.load( atomics::memory_order_acquire )); p->m_busy.store( true, atomics::memory_order_release ); # endif } @@ -1180,7 +1180,7 @@ namespace cds { namespace intrusive { void free_aux_node( aux_node_type * p ) { # ifdef CDS_DEBUG - cds_assert( p->m_busy.load( atomics::memory_order_acquire ) ); + cds_assert( p->m_busy.load( atomics::memory_order_acquire )); p->m_busy.store( false, atomics::memory_order_release ); # endif diff --git a/cds/intrusive/striped_set.h b/cds/intrusive/striped_set.h index 00ab8674..30d41fcd 100644 --- a/cds/intrusive/striped_set.h +++ b/cds/intrusive/striped_set.h @@ -425,7 +425,7 @@ namespace cds { namespace intrusive { scoped_resize_lock al( m_MutexPolicy ); if ( al.success()) { - if ( nOldCapacity != bucket_count( atomics::memory_order_acquire ) ) { + if ( nOldCapacity != bucket_count( atomics::memory_order_acquire )) { // someone resized already return; } @@ -443,7 +443,7 @@ namespace cds { namespace intrusive { , m_nBucketMask( c_nMinimalCapacity - 1 ) , m_MutexPolicy( c_nMinimalCapacity ) { - alloc_bucket_table( bucket_count() ); + alloc_bucket_table( bucket_count()); } /// Ctor with initial capacity specified @@ -452,9 +452,9 @@ namespace cds { namespace intrusive { ) : m_Buckets( nullptr ) , m_nBucketMask( calc_init_capacity(nCapacity) - 1 ) - , m_MutexPolicy( bucket_count() ) + , m_MutexPolicy( bucket_count()) { - alloc_bucket_table( bucket_count() ); + alloc_bucket_table( bucket_count()); } /// Ctor with resizing policy (copy semantics) @@ -467,10 +467,10 @@ namespace cds { namespace intrusive { ) : m_Buckets( nullptr ) , m_nBucketMask( ( nCapacity ? calc_init_capacity(nCapacity) : c_nMinimalCapacity ) - 1 ) - , m_MutexPolicy( bucket_count() ) + , m_MutexPolicy( bucket_count()) , m_ResizingPolicy( resizingPolicy ) { - alloc_bucket_table( bucket_count() ); + alloc_bucket_table( bucket_count()); } /// Ctor with resizing policy (move semantics) @@ -484,16 +484,16 @@ namespace cds { namespace intrusive { ) : m_Buckets( nullptr ) , m_nBucketMask( ( nCapacity ? calc_init_capacity(nCapacity) : c_nMinimalCapacity ) - 1 ) - , m_MutexPolicy( bucket_count() ) + , m_MutexPolicy( bucket_count()) , m_ResizingPolicy( std::forward( resizingPolicy )) { - alloc_bucket_table( bucket_count() ); + alloc_bucket_table( bucket_count()); } /// Destructor destroys internal data ~StripedSet() { - free_bucket_table( m_Buckets, bucket_count() ); + free_bucket_table( m_Buckets, bucket_count()); } public: diff --git a/cds/memory/vyukov_queue_pool.h b/cds/memory/vyukov_queue_pool.h index 8f9ce5d5..432a7f02 100644 --- a/cds/memory/vyukov_queue_pool.h +++ b/cds/memory/vyukov_queue_pool.h @@ -511,7 +511,7 @@ namespace cds { namespace memory { } // The pool is empty - CDS_THROW_EXCEPTION( std::bad_alloc() ); + CDS_THROW_EXCEPTION( std::bad_alloc()); } ok: diff --git a/cds/os/alloc_aligned.h b/cds/os/alloc_aligned.h index 1dd06d76..0be7b722 100644 --- a/cds/os/alloc_aligned.h +++ b/cds/os/alloc_aligned.h @@ -178,7 +178,7 @@ namespace cds { assert( cds::beans::is_power2( nAlign )); pointer p = reinterpret_cast( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign )); if ( !p ) - CDS_THROW_EXCEPTION( std::bad_alloc() ); + CDS_THROW_EXCEPTION( std::bad_alloc()); assert( cds::details::is_aligned( p, nAlign )); return p; } diff --git a/cds/sync/spinlock.h b/cds/sync/spinlock.h index f42d5eb4..f3a91584 100644 --- a/cds/sync/spinlock.h +++ b/cds/sync/spinlock.h @@ -371,7 +371,7 @@ namespace cds { /// Unlock the spin-lock void unlock() CDS_NOEXCEPT { - assert( is_taken( OS::get_current_thread_id() )); + assert( is_taken( OS::get_current_thread_id())); integral_type n = m_spin.load( atomics::memory_order_relaxed ); if ( n > 1 ) @@ -386,7 +386,7 @@ namespace cds { /// Change the owner of locked spin-lock. May be called by thread that owns spin-lock void change_owner( OS::ThreadId newOwnerId ) CDS_NOEXCEPT { - assert( is_taken( OS::get_current_thread_id() )); + assert( is_taken( OS::get_current_thread_id())); assert( newOwnerId != OS::c_NullThreadId ); m_OwnerId = newOwnerId; diff --git a/cds/threading/details/pthread_manager.h b/cds/threading/details/pthread_manager.h index a00dda89..be5f5d19 100644 --- a/cds/threading/details/pthread_manager.h +++ b/cds/threading/details/pthread_manager.h @@ -78,14 +78,14 @@ namespace cds { namespace threading { static void init() { pthread_error_code nErr; - if ( ( nErr = pthread_key_create( &m_key, key_destructor ) ) != 0 ) + if ( ( nErr = pthread_key_create( &m_key, key_destructor )) != 0 ) CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_key_create" )); } static void fini() { pthread_error_code nErr; - if ( ( nErr = pthread_key_delete( m_key ) ) != 0 ) + if ( ( nErr = pthread_key_delete( m_key )) != 0 ) CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_key_delete" )); } @@ -98,7 +98,7 @@ namespace cds { namespace threading { { pthread_error_code nErr; ThreadData * pData = new ThreadData; - if ( ( nErr = pthread_setspecific( m_key, pData ) ) != 0 ) + if ( ( nErr = pthread_setspecific( m_key, pData )) != 0 ) CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_setspecific" )); } static void free() @@ -205,7 +205,7 @@ namespace cds { namespace threading { assert( pData ); if ( pData ) { - if ( pData->fini() ) + if ( pData->fini()) _threadData( do_detachThread ); } else diff --git a/cds/threading/details/wintls_manager.h b/cds/threading/details/wintls_manager.h index d41d1b86..a7d6e9da 100644 --- a/cds/threading/details/wintls_manager.h +++ b/cds/threading/details/wintls_manager.h @@ -78,7 +78,7 @@ namespace cds { namespace threading { static void init() { if ( m_key == TLS_OUT_OF_INDEXES ) { - if ( ( m_key = ::TlsAlloc() ) == TLS_OUT_OF_INDEXES ) + if ( ( m_key = ::TlsAlloc()) == TLS_OUT_OF_INDEXES ) CDS_THROW_EXCEPTION( api_exception( ::GetLastError(), "TlsAlloc" )); } } @@ -96,7 +96,7 @@ namespace cds { namespace threading { { api_error_code nErr; void * pData = ::TlsGetValue( m_key ); - if ( pData == nullptr && ( nErr = ::GetLastError() ) != ERROR_SUCCESS ) + if ( pData == nullptr && ( nErr = ::GetLastError()) != ERROR_SUCCESS ) CDS_THROW_EXCEPTION( api_exception( nErr, "TlsGetValue" )); return reinterpret_cast( pData ); } diff --git a/cds/urcu/details/gp.h b/cds/urcu/details/gp.h index fa8cf8a6..b8173c4c 100644 --- a/cds/urcu/details/gp.h +++ b/cds/urcu/details/gp.h @@ -88,7 +88,7 @@ namespace cds { namespace urcu { namespace details { assert( (tmp & rcu_class::c_nNestMask) > 0 ); #if CDS_COMPILER == CDS_COMPILER_CLANG && CDS_COMPILER_VERSION < 30800 - // CLang 3.6-3.7: some tests of intrusive::FeldmanHashSet based on general-purpose RCU + // CLang 3.6-3.7: some tests of intrusive::FeldmanHashSet based on general-purpose RCU // are failed even in single-threaded mode (unit tests) without magic compiler barrier below CDS_COMPILER_RW_BARRIER; #endif diff --git a/src/dhp.cpp b/src/dhp.cpp index ac8ec62f..27014fc8 100644 --- a/src/dhp.cpp +++ b/src/dhp.cpp @@ -99,7 +99,7 @@ namespace cds { namespace gc { namespace dhp { else { // allocate new block gb = new( s_alloc_memory( sizeof( guard_block ) + sizeof( guard ) * defaults::c_extended_guard_block_size )) guard_block; - new ( gb->first() ) guard[defaults::c_extended_guard_block_size]; + new ( gb->first()) guard[defaults::c_extended_guard_block_size]; CDS_HPSTAT( block_allocated_.fetch_add( 1, atomics::memory_order_relaxed )); } @@ -118,7 +118,7 @@ namespace cds { namespace gc { namespace dhp { CDS_EXPORT_API retired_allocator::~retired_allocator() { - while ( retired_block* rb = static_cast( free_list_.get() ) ) { + while ( retired_block* rb = static_cast( free_list_.get()) ) { rb->~retired_block(); s_free_memory( rb ); } @@ -134,7 +134,7 @@ namespace cds { namespace gc { namespace dhp { // allocate new block rb = new( s_alloc_memory( sizeof( retired_block ) + sizeof( retired_ptr ) * retired_block::c_capacity )) retired_block; new ( rb->first()) retired_ptr[retired_block::c_capacity]; - CDS_HPSTAT( block_allocated_.fetch_add( 1, atomics::memory_order_relaxed ) ); + CDS_HPSTAT( block_allocated_.fetch_add( 1, atomics::memory_order_relaxed )); } rb->next_ = nullptr; @@ -204,7 +204,7 @@ namespace cds { namespace gc { namespace dhp { CDS_DEBUG_ONLY( const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; ) CDS_DEBUG_ONLY( const cds::OS::ThreadId mainThreadId = cds::OS::get_current_thread_id(); ) - CDS_HPSTAT( statistics( s_postmortem_stat ) ); + CDS_HPSTAT( statistics( s_postmortem_stat )); thread_record* pHead = thread_list_.load( atomics::memory_order_relaxed ); thread_list_.store( nullptr, atomics::memory_order_release ); @@ -250,7 +250,7 @@ namespace cds { namespace gc { namespace dhp { thread_data* rec = tls_; if ( rec ) { tls_ = nullptr; - instance().free_thread_data( static_cast( rec ) ); + instance().free_thread_data( static_cast( rec )); } } @@ -289,7 +289,7 @@ namespace cds { namespace gc { namespace dhp { char* mem = reinterpret_cast( s_alloc_memory( sizeof( thread_record ) + guard_array_size )); return new( mem ) thread_record( - reinterpret_cast( mem + sizeof( thread_record ) ), initial_hazard_count_ + reinterpret_cast( mem + sizeof( thread_record )), initial_hazard_count_ ); } @@ -307,14 +307,14 @@ namespace cds { namespace gc { namespace dhp { const cds::OS::ThreadId curThreadId = cds::OS::get_current_thread_id(); // First try to reuse a free (non-active) DHP record - for ( hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_acquire ) ) { + for ( hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_acquire )) { cds::OS::ThreadId thId = nullThreadId; - if ( !hprec->m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_relaxed, atomics::memory_order_relaxed ) ) + if ( !hprec->m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_relaxed, atomics::memory_order_relaxed )) continue; hprec->m_bFree.store( false, atomics::memory_order_release ); break; } - + if ( !hprec ) { // No HP records available for reuse // Allocate and push a new HP record @@ -324,7 +324,7 @@ namespace cds { namespace gc { namespace dhp { thread_record* pOldHead = thread_list_.load( atomics::memory_order_acquire ); do { hprec->m_pNextNode.store( pOldHead, atomics::memory_order_release ); - } while ( !thread_list_.compare_exchange_weak( pOldHead, hprec, atomics::memory_order_release, atomics::memory_order_acquire ) ); + } while ( !thread_list_.compare_exchange_weak( pOldHead, hprec, atomics::memory_order_release, atomics::memory_order_acquire )); } hprec->hazards_.init(); @@ -342,7 +342,7 @@ namespace cds { namespace gc { namespace dhp { scan( pRec ); help_scan( pRec ); - if ( pRec->retired_.empty() ) { + if ( pRec->retired_.empty()) { pRec->retired_.fini(); pRec->m_bFree.store( true, std::memory_order_release ); } @@ -411,9 +411,9 @@ namespace cds { namespace gc { namespace dhp { if ( pNode->m_idOwner.load( std::memory_order_relaxed ) != cds::OS::c_NullThreadId ) { copy_hazards( plist, pNode->hazards_.array_, pNode->hazards_.initial_capacity_ ); - for ( guard_block* block = pNode->hazards_.extended_list_.load( atomics::memory_order_acquire ); + for ( guard_block* block = pNode->hazards_.extended_list_.load( atomics::memory_order_acquire ); block; - block = block->next_block_.load( atomics::memory_order_acquire ) ) + block = block->next_block_.load( atomics::memory_order_acquire )) { copy_hazards( plist, block->first(), defaults::c_extended_guard_block_size ); } @@ -427,7 +427,7 @@ namespace cds { namespace gc { namespace dhp { last_plist_size_.compare_exchange_weak( plist_size, plist.size(), std::memory_order_relaxed, std::memory_order_relaxed ); // Sort plist to simplify search in - std::sort( plist.begin(), plist.end() ); + std::sort( plist.begin(), plist.end()); // Stage 2: Search plist size_t free_count = 0; @@ -451,26 +451,26 @@ namespace cds { namespace gc { namespace dhp { CDS_HPSTAT( pRec->free_call_count_ += free_count ); // If the count of freed elements is too small, increase retired array - if ( free_count < retired_count / 4 && last_block == pRec->retired_.list_tail_ && last_block_cell == last_block->last() ) + if ( free_count < retired_count / 4 && last_block == pRec->retired_.list_tail_ && last_block_cell == last_block->last()) pRec->retired_.extend(); } CDS_EXPORT_API void smr::help_scan( thread_data* pThis ) { - assert( static_cast( pThis )->m_idOwner.load( atomics::memory_order_relaxed ) == cds::OS::get_current_thread_id() ); + assert( static_cast( pThis )->m_idOwner.load( atomics::memory_order_relaxed ) == cds::OS::get_current_thread_id()); CDS_HPSTAT( ++pThis->help_scan_call_count_ ); const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; const cds::OS::ThreadId curThreadId = cds::OS::get_current_thread_id(); - for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed ) ) + for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed )) { if ( hprec == static_cast( pThis )) continue; // If m_bFree == true then hprec->retired_ is empty - we don't need to see it - if ( hprec->m_bFree.load( atomics::memory_order_acquire ) ) { + if ( hprec->m_bFree.load( atomics::memory_order_acquire )) { CDS_TSAN_ANNOTATE_IGNORE_READS_BEGIN; - assert( hprec->retired_.empty() ); + assert( hprec->retired_.empty()); CDS_TSAN_ANNOTATE_IGNORE_READS_END; continue; } @@ -480,7 +480,7 @@ namespace cds { namespace gc { namespace dhp { { cds::OS::ThreadId curOwner = hprec->m_idOwner.load( atomics::memory_order_relaxed ); if ( curOwner == nullThreadId ) { - if ( !hprec->m_idOwner.compare_exchange_strong( curOwner, curThreadId, atomics::memory_order_acquire, atomics::memory_order_relaxed ) ) + if ( !hprec->m_idOwner.compare_exchange_strong( curOwner, curThreadId, atomics::memory_order_acquire, atomics::memory_order_relaxed )) continue; } else @@ -495,7 +495,7 @@ namespace cds { namespace gc { namespace dhp { for ( retired_block* block = src.list_head_; block; block = block->next_ ) { retired_ptr* last = block == src.current_block_ ? src.current_cell_ : block->last(); for ( retired_ptr* p = block->first(); p != last; ++p ) { - if ( !dest.push( *p ) ) + if ( !dest.push( *p )) scan( pThis ); } @@ -515,7 +515,7 @@ namespace cds { namespace gc { namespace dhp { { st.clear(); # ifdef CDS_ENABLE_HPSTAT - for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed ) ) + for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed )) { CDS_TSAN_ANNOTATE_IGNORE_READS_BEGIN; ++st.thread_rec_count; diff --git a/src/hp.cpp b/src/hp.cpp index 616ea59b..44ec31b3 100644 --- a/src/hp.cpp +++ b/src/hp.cpp @@ -63,12 +63,12 @@ namespace cds { namespace gc { namespace hp { static T* allocate( size_t nCount ) { - return reinterpret_cast( s_alloc_memory( sizeof( value_type ) * nCount ) ); + return reinterpret_cast( s_alloc_memory( sizeof( value_type ) * nCount )); } static void deallocate( T* p, size_t /*nCount*/ ) { - s_free_memory( reinterpret_cast( p ) ); + s_free_memory( reinterpret_cast( p )); } }; @@ -156,7 +156,7 @@ namespace cds { namespace gc { namespace hp { CDS_DEBUG_ONLY( const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; ) CDS_DEBUG_ONLY( const cds::OS::ThreadId mainThreadId = cds::OS::get_current_thread_id();) - CDS_HPSTAT( statistics( s_postmortem_stat ) ); + CDS_HPSTAT( statistics( s_postmortem_stat )); thread_record* pHead = thread_list_.load( atomics::memory_order_relaxed ); thread_list_.store( nullptr, atomics::memory_order_release ); @@ -250,7 +250,7 @@ namespace cds { namespace gc { namespace hp { thread_record* pOldHead = thread_list_.load( atomics::memory_order_relaxed ); do { hprec->m_pNextNode.store( pOldHead, atomics::memory_order_release ); - } while ( !thread_list_.compare_exchange_weak( pOldHead, hprec, atomics::memory_order_release, atomics::memory_order_acquire ) ); + } while ( !thread_list_.compare_exchange_weak( pOldHead, hprec, atomics::memory_order_release, atomics::memory_order_acquire )); return hprec; } @@ -410,7 +410,7 @@ namespace cds { namespace gc { namespace hp { } // Sort plist to simplify search in - std::sort( plist.begin(), plist.end() ); + std::sort( plist.begin(), plist.end()); // Stage 2: Search plist retired_array& retired = pRec->retired_; @@ -423,7 +423,7 @@ namespace cds { namespace gc { namespace hp { auto itEnd = plist.end(); retired_ptr* insert_pos = first_retired; for ( retired_ptr* it = first_retired; it != last_retired; ++it ) { - if ( std::binary_search( itBegin, itEnd, first_retired->m_p ) ) { + if ( std::binary_search( itBegin, itEnd, first_retired->m_p )) { if ( insert_pos != it ) *insert_pos = *it; ++insert_pos; @@ -440,7 +440,7 @@ namespace cds { namespace gc { namespace hp { CDS_EXPORT_API void smr::help_scan( thread_data* pThis ) { - assert( static_cast( pThis )->m_idOwner.load( atomics::memory_order_relaxed ) == cds::OS::get_current_thread_id() ); + assert( static_cast( pThis )->m_idOwner.load( atomics::memory_order_relaxed ) == cds::OS::get_current_thread_id()); CDS_HPSTAT( ++pThis->help_scan_count_ ); @@ -460,7 +460,7 @@ namespace cds { namespace gc { namespace hp { { cds::OS::ThreadId curOwner = hprec->m_idOwner.load( atomics::memory_order_relaxed ); if ( curOwner == nullThreadId ) { - if ( !hprec->m_idOwner.compare_exchange_strong( curOwner, curThreadId, atomics::memory_order_acquire, atomics::memory_order_relaxed ) ) + if ( !hprec->m_idOwner.compare_exchange_strong( curOwner, curThreadId, atomics::memory_order_acquire, atomics::memory_order_relaxed )) continue; } else @@ -471,7 +471,7 @@ namespace cds { namespace gc { namespace hp { // If it has ones then we move them to pThis that is private for current thread. retired_array& src = hprec->retired_; retired_array& dest = pThis->retired_; - assert( !dest.full() ); + assert( !dest.full()); retired_ptr* src_first = src.first(); retired_ptr* src_last = src.last(); @@ -493,7 +493,7 @@ namespace cds { namespace gc { namespace hp { { st.clear(); # ifdef CDS_ENABLE_HPSTAT - for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed ) ) + for ( thread_record* hprec = thread_list_.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode.load( atomics::memory_order_relaxed )) { CDS_TSAN_ANNOTATE_IGNORE_READS_BEGIN; ++st.thread_rec_count; diff --git a/src/thread_data.cpp b/src/thread_data.cpp index 2824f2c5..5af07140 100644 --- a/src/thread_data.cpp +++ b/src/thread_data.cpp @@ -40,19 +40,19 @@ namespace cds { namespace threading { CDS_EXPORT_API void ThreadData::init() { if ( m_nAttachCount++ == 0 ) { - if ( cds::gc::HP::isUsed() ) + if ( cds::gc::HP::isUsed()) cds::gc::hp::smr::attach_thread(); - if ( cds::gc::DHP::isUsed() ) + if ( cds::gc::DHP::isUsed()) cds::gc::dhp::smr::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPIRCU = cds::urcu::details::singleton::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPBRCU = cds::urcu::details::singleton::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPTRCU = cds::urcu::details::singleton::attach_thread(); #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pSHBRCU = cds::urcu::details::singleton::attach_thread(); #endif } @@ -61,25 +61,25 @@ namespace cds { namespace threading { CDS_EXPORT_API bool ThreadData::fini() { if ( --m_nAttachCount == 0 ) { - if ( cds::gc::DHP::isUsed() ) + if ( cds::gc::DHP::isUsed()) cds::gc::dhp::smr::detach_thread(); - if ( cds::gc::HP::isUsed() ) + if ( cds::gc::HP::isUsed()) cds::gc::hp::smr::detach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPIRCU ); m_pGPIRCU = nullptr; } - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPBRCU ); m_pGPBRCU = nullptr; } - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPTRCU ); m_pGPTRCU = nullptr; } #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pSHBRCU ); m_pSHBRCU = nullptr; } diff --git a/test/include/cds_test/ext_byteswap.h b/test/include/cds_test/ext_byteswap.h index 14628f92..5def35c7 100644 --- a/test/include/cds_test/ext_byteswap.h +++ b/test/include/cds_test/ext_byteswap.h @@ -42,4 +42,4 @@ #define bswap_64(value) (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) << 32) | (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif -#endif // CDSTEST_BYTESWAP_H \ No newline at end of file +#endif // CDSTEST_BYTESWAP_H diff --git a/test/include/cds_test/fc_hevy_value.h b/test/include/cds_test/fc_hevy_value.h index 4159bd7f..6c8baf0e 100644 --- a/test/include/cds_test/fc_hevy_value.h +++ b/test/include/cds_test/fc_hevy_value.h @@ -24,11 +24,11 @@ namespace fc_test { template class selector {}; - template static select_small test( selector* ) ; + template static select_small test( selector* ); template static select_big test(...); public: - static constexpr bool value = sizeof(test(0)) == sizeof(char) ; + static constexpr bool value = sizeof(test(0)) == sizeof(char); }; template @@ -58,7 +58,7 @@ namespace fc_test { pop_buff[i] = static_cast( std::sqrt( std::abs( static_cast( pop_buff[i] ) * rand()))); } - void set_array(size_t new_size) + void set_array(size_t new_size) { set_array_size(new_size); } diff --git a/test/stress/main.cpp b/test/stress/main.cpp index ee8bcf9d..4544d1c0 100644 --- a/test/stress/main.cpp +++ b/test/stress/main.cpp @@ -62,7 +62,7 @@ int main( int argc, char **argv ) cds_test::config const& general_cfg = cds_test::stress_fixture::get_config( "General" ); // Init SMR - cds::gc::HP hzpGC( + cds::gc::HP hzpGC( general_cfg.get_size_t( "hazard_pointer_count", 16 ), general_cfg.get_size_t( "hp_max_thread_count", 0 ), general_cfg.get_size_t( "hp_retired_ptr_count", 0 ), diff --git a/test/stress/map/del3/map_del3.cpp b/test/stress/map/del3/map_del3.cpp index b8fff4e5..01b0d6ee 100644 --- a/test/stress/map/del3/map_del3.cpp +++ b/test/stress/map/del3/map_del3.cpp @@ -123,8 +123,8 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_Del3_LF, ::testing::ValuesIn( Map_Del3_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_Del3_LF, ::testing::ValuesIn( Map_Del3_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_Del3_LF, ::testing::ValuesIn( Map_Del3_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_Del3_LF, ::testing::ValuesIn( Map_Del3_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/delodd/map_delodd.cpp b/test/stress/map/delodd/map_delodd.cpp index 098c54b7..236bb97b 100644 --- a/test/stress/map/delodd/map_delodd.cpp +++ b/test/stress/map/delodd/map_delodd.cpp @@ -123,9 +123,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/find_string/map_find_string.cpp b/test/stress/map/find_string/map_find_string.cpp index 1f47bd9d..b2318860 100644 --- a/test/stress/map/find_string/map_find_string.cpp +++ b/test/stress/map/find_string/map_find_string.cpp @@ -200,9 +200,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors()) ); #endif diff --git a/test/stress/map/insdel_func/map_insdel_func.cpp b/test/stress/map/insdel_func/map_insdel_func.cpp index 15983f58..4bef9eab 100644 --- a/test/stress/map/insdel_func/map_insdel_func.cpp +++ b/test/stress/map/insdel_func/map_insdel_func.cpp @@ -127,9 +127,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_func_LF, ::testing::ValuesIn( Map_InsDel_func_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_func_LF, ::testing::ValuesIn( Map_InsDel_func_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_func_LF, ::testing::ValuesIn( Map_InsDel_func_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_func_LF, ::testing::ValuesIn( Map_InsDel_func_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/insdel_item_int/map_insdel_item_int.cpp b/test/stress/map/insdel_item_int/map_insdel_item_int.cpp index 3c40b57f..2b333b2a 100644 --- a/test/stress/map/insdel_item_int/map_insdel_item_int.cpp +++ b/test/stress/map/insdel_item_int/map_insdel_item_int.cpp @@ -112,9 +112,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_item_int_LF, ::testing::ValuesIn( Map_InsDel_item_int_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_item_int_LF, ::testing::ValuesIn( Map_InsDel_item_int_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_item_int_LF, ::testing::ValuesIn( Map_InsDel_item_int_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_item_int_LF, ::testing::ValuesIn( Map_InsDel_item_int_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/insdel_string/map_insdel_string.cpp b/test/stress/map/insdel_string/map_insdel_string.cpp index a067cb9d..e6a282b9 100644 --- a/test/stress/map/insdel_string/map_insdel_string.cpp +++ b/test/stress/map/insdel_string/map_insdel_string.cpp @@ -183,9 +183,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_string_LF, ::testing::ValuesIn( Map_InsDel_string::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_string_LF, ::testing::ValuesIn( Map_InsDel_string::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_InsDel_string_LF, ::testing::ValuesIn( Map_InsDel_string::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDel_string_LF, ::testing::ValuesIn( Map_InsDel_string::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/insdelfind/map_insdelfind.cpp b/test/stress/map/insdelfind/map_insdelfind.cpp index a846bdf0..d2fe73ff 100644 --- a/test/stress/map/insdelfind/map_insdelfind.cpp +++ b/test/stress/map/insdelfind/map_insdelfind.cpp @@ -135,9 +135,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/iter_erase/map_iter_erase.cpp b/test/stress/map/iter_erase/map_iter_erase.cpp index 1f227e12..ffb6cd54 100644 --- a/test/stress/map/iter_erase/map_iter_erase.cpp +++ b/test/stress/map/iter_erase/map_iter_erase.cpp @@ -109,9 +109,9 @@ namespace map { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Map_Iter_Del3_LF, ::testing::ValuesIn( Map_Iter_Del3_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Map_Iter_Del3_LF, ::testing::ValuesIn( Map_Iter_Del3_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Map_Iter_Del3_LF, ::testing::ValuesIn( Map_Iter_Del3_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_Iter_Del3_LF, ::testing::ValuesIn( Map_Iter_Del3_LF::get_load_factors()) ); #endif } // namespace map diff --git a/test/stress/map/iter_erase/map_iter_erase.h b/test/stress/map/iter_erase/map_iter_erase.h index 89a18573..cceb3585 100644 --- a/test/stress/map/iter_erase/map_iter_erase.h +++ b/test/stress/map/iter_erase/map_iter_erase.h @@ -341,7 +341,7 @@ namespace map { auto itEnd = rMap.template get_end(); for ( auto it = rMap.template get_begin(); it != itEnd; ++it ) { if ( it->first.nKey & 3 ) { - if ( rMap.erase_at( it ) ) + if ( rMap.erase_at( it )) ++m_nDeleteSuccess; else ++m_nDeleteFailed; diff --git a/test/stress/map/minmax/map_minmax.h b/test/stress/map/minmax/map_minmax.h index 61bb8a1d..6958d727 100644 --- a/test/stress/map/minmax/map_minmax.h +++ b/test/stress/map/minmax/map_minmax.h @@ -80,7 +80,7 @@ namespace map { m_arr.push_back( i ); for ( key_type i = keyMax - 10; i <= keyMax; ++i ) m_arr.push_back( i ); - shuffle( m_arr.begin(), m_arr.end() ); + shuffle( m_arr.begin(), m_arr.end()); } public: @@ -118,7 +118,7 @@ namespace map { for ( size_t nPass = 0; nPass < s_nPassCount; ++nPass ) { for ( key_type key : m_arr ) { - if ( m_Map.insert( key, key ) ) { + if ( m_Map.insert( key, key )) { if ( key == keyMin ) ++m_nInsertMinSuccess; else if ( key == keyMax ) @@ -301,7 +301,7 @@ namespace map { arr.resize( s_nMapSize ); for ( int i = 0; i < static_cast( s_nMapSize ); ++i ) arr[i] = i;; - shuffle( arr.begin(), arr.end() ); + shuffle( arr.begin(), arr.end()); for ( key_type key : arr ) testMap.insert( key, key ); diff --git a/test/stress/queue/intrusive_push_pop.cpp b/test/stress/queue/intrusive_push_pop.cpp index b30e398c..777736bf 100644 --- a/test/stress/queue/intrusive_push_pop.cpp +++ b/test/stress/queue/intrusive_push_pop.cpp @@ -518,11 +518,11 @@ namespace { INSTANTIATE_TEST_CASE_P( SQ, intrusive_segmented_queue_push_pop, - ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters() ), get_test_parameter_name ); + ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters()), get_test_parameter_name ); #else INSTANTIATE_TEST_CASE_P( SQ, intrusive_segmented_queue_push_pop, - ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters() ) ); + ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters()) ); #endif diff --git a/test/stress/queue/pop.cpp b/test/stress/queue/pop.cpp index af86b836..499309a4 100644 --- a/test/stress/queue/pop.cpp +++ b/test/stress/queue/pop.cpp @@ -248,11 +248,11 @@ namespace { } INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_pop, - ::testing::ValuesIn( segmented_queue_pop::get_test_parameters() ), get_test_parameter_name ); + ::testing::ValuesIn( segmented_queue_pop::get_test_parameters()), get_test_parameter_name ); #else INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_pop, - ::testing::ValuesIn( segmented_queue_pop::get_test_parameters() ) ); + ::testing::ValuesIn( segmented_queue_pop::get_test_parameters()) ); #endif diff --git a/test/stress/queue/push.cpp b/test/stress/queue/push.cpp index 5840f33b..fb286143 100644 --- a/test/stress/queue/push.cpp +++ b/test/stress/queue/push.cpp @@ -251,11 +251,11 @@ namespace { } INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_push, - ::testing::ValuesIn( segmented_queue_push::get_test_parameters() ), get_test_parameter_name ); + ::testing::ValuesIn( segmented_queue_push::get_test_parameters()), get_test_parameter_name ); #else INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_push, - ::testing::ValuesIn( segmented_queue_push::get_test_parameters() ) ); + ::testing::ValuesIn( segmented_queue_push::get_test_parameters()) ); #endif diff --git a/test/stress/queue/push_pop.cpp b/test/stress/queue/push_pop.cpp index 060629f5..14b02765 100644 --- a/test/stress/queue/push_pop.cpp +++ b/test/stress/queue/push_pop.cpp @@ -430,11 +430,11 @@ namespace { } INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_push_pop, - ::testing::ValuesIn( segmented_queue_push_pop::get_test_parameters() ), get_test_parameter_name ); + ::testing::ValuesIn( segmented_queue_push_pop::get_test_parameters()), get_test_parameter_name ); #else INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_push_pop, - ::testing::ValuesIn( segmented_queue_push_pop::get_test_parameters() ) ); + ::testing::ValuesIn( segmented_queue_push_pop::get_test_parameters()) ); #endif } // namespace diff --git a/test/stress/queue/random.cpp b/test/stress/queue/random.cpp index 75ca671d..7c5dea9b 100644 --- a/test/stress/queue/random.cpp +++ b/test/stress/queue/random.cpp @@ -334,7 +334,7 @@ namespace { #else INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_random, - ::testing::ValuesIn( segmented_queue_random::get_test_parameters() )); + ::testing::ValuesIn( segmented_queue_random::get_test_parameters())); #endif } // namespace diff --git a/test/stress/queue/spsc_buffer.cpp b/test/stress/queue/spsc_buffer.cpp index 32ca2d55..55b9e71c 100644 --- a/test/stress/queue/spsc_buffer.cpp +++ b/test/stress/queue/spsc_buffer.cpp @@ -141,13 +141,13 @@ namespace { } } - if ( !m_Queue.pop_front() ) + if ( !m_Queue.pop_front()) ++m_nPopFrontFailed; } else { ++m_nPopEmpty; if ( s_nProducerDone.load() != 0 ) { - if ( m_Queue.empty() ) + if ( m_Queue.empty()) break; } } diff --git a/test/stress/queue/spsc_queue.cpp b/test/stress/queue/spsc_queue.cpp index 3a0119dd..4fa440a6 100644 --- a/test/stress/queue/spsc_queue.cpp +++ b/test/stress/queue/spsc_queue.cpp @@ -79,7 +79,7 @@ namespace { m_nPushFailed = 0; for ( value_type v = 0; v < nPushCount; ++v ) { - if ( !m_Queue.push( v ) ) { + if ( !m_Queue.push( v )) { ++m_nPushFailed; --v; } diff --git a/test/stress/queue/std_queue.h b/test/stress/queue/std_queue.h index 0c27a313..b2079323 100644 --- a/test/stress/queue/std_queue.h +++ b/test/stress/queue/std_queue.h @@ -54,7 +54,7 @@ namespace queue { } bool push( const T& data ) - { + { return enqueue( data ); } @@ -70,7 +70,7 @@ namespace queue { } bool pop( T& data ) - { + { return dequeue( data ); } diff --git a/test/stress/set/del3/set_del3.cpp b/test/stress/set/del3/set_del3.cpp index 05579093..283f441c 100644 --- a/test/stress/set/del3/set_del3.cpp +++ b/test/stress/set/del3/set_del3.cpp @@ -125,9 +125,9 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_Del3_LF, ::testing::ValuesIn( Set_Del3_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_Del3_LF, ::testing::ValuesIn( Set_Del3_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_Del3_LF, ::testing::ValuesIn( Set_Del3_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_Del3_LF, ::testing::ValuesIn( Set_Del3_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/delodd/set_delodd.cpp b/test/stress/set/delodd/set_delodd.cpp index 7243bab7..0835a472 100644 --- a/test/stress/set/delodd/set_delodd.cpp +++ b/test/stress/set/delodd/set_delodd.cpp @@ -124,8 +124,8 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/insdel_find/set_insdelfind.cpp b/test/stress/set/insdel_find/set_insdelfind.cpp index 1b9296ca..f0b5a7b5 100644 --- a/test/stress/set/insdel_find/set_insdelfind.cpp +++ b/test/stress/set/insdel_find/set_insdelfind.cpp @@ -128,9 +128,9 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_InsDelFind_LF, ::testing::ValuesIn( Set_InsDelFind_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDelFind_LF, ::testing::ValuesIn( Set_InsDelFind_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_InsDelFind_LF, ::testing::ValuesIn( Set_InsDelFind_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDelFind_LF, ::testing::ValuesIn( Set_InsDelFind_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/insdel_func/set_insdel_func.cpp b/test/stress/set/insdel_func/set_insdel_func.cpp index deddcf29..9c120459 100644 --- a/test/stress/set/insdel_func/set_insdel_func.cpp +++ b/test/stress/set/insdel_func/set_insdel_func.cpp @@ -115,8 +115,8 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_InsDel_func_LF, ::testing::ValuesIn( Set_InsDel_func_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDel_func_LF, ::testing::ValuesIn( Set_InsDel_func_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_InsDel_func_LF, ::testing::ValuesIn( Set_InsDel_func_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDel_func_LF, ::testing::ValuesIn( Set_InsDel_func_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/insdel_string/set_insdel_string.cpp b/test/stress/set/insdel_string/set_insdel_string.cpp index 03f61d09..dee00c9f 100644 --- a/test/stress/set/insdel_string/set_insdel_string.cpp +++ b/test/stress/set/insdel_string/set_insdel_string.cpp @@ -119,10 +119,10 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_InsDel_string_LF, ::testing::ValuesIn( Set_InsDel_string_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDel_string_LF, ::testing::ValuesIn( Set_InsDel_string_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_InsDel_string_LF, ::testing::ValuesIn( Set_InsDel_string_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_InsDel_string_LF, ::testing::ValuesIn( Set_InsDel_string_LF::get_load_factors()) ); #endif - + } // namespace set diff --git a/test/stress/set/iter_erase/set_iter_erase.cpp b/test/stress/set/iter_erase/set_iter_erase.cpp index c549af57..d5319675 100644 --- a/test/stress/set/iter_erase/set_iter_erase.cpp +++ b/test/stress/set/iter_erase/set_iter_erase.cpp @@ -109,8 +109,8 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_Iter_Del3_LF, ::testing::ValuesIn( Set_Iter_Del3_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_Iter_Del3_LF, ::testing::ValuesIn( Set_Iter_Del3_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_Iter_Del3_LF, ::testing::ValuesIn( Set_Iter_Del3_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_Iter_Del3_LF, ::testing::ValuesIn( Set_Iter_Del3_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/iteration/set_iteration.cpp b/test/stress/set/iteration/set_iteration.cpp index b41eb7db..5c8fc46b 100644 --- a/test/stress/set/iteration/set_iteration.cpp +++ b/test/stress/set/iteration/set_iteration.cpp @@ -119,8 +119,8 @@ namespace set { { return std::to_string( p.param ); } - INSTANTIATE_TEST_CASE_P( a, Set_Iteration_LF, ::testing::ValuesIn( Set_Iteration_LF::get_load_factors() ), get_test_parameter_name ); + INSTANTIATE_TEST_CASE_P( a, Set_Iteration_LF, ::testing::ValuesIn( Set_Iteration_LF::get_load_factors()), get_test_parameter_name ); #else - INSTANTIATE_TEST_CASE_P( a, Set_Iteration_LF, ::testing::ValuesIn( Set_Iteration_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_Iteration_LF, ::testing::ValuesIn( Set_Iteration_LF::get_load_factors()) ); #endif } // namespace set diff --git a/test/stress/set/set_type_feldman_hashset.h b/test/stress/set/set_type_feldman_hashset.h index d9fcbbd1..22ef14b2 100644 --- a/test/stress/set/set_type_feldman_hashset.h +++ b/test/stress/set/set_type_feldman_hashset.h @@ -47,7 +47,7 @@ namespace set { { typedef cc::FeldmanHashSet< GC, T, Traits > base_class; - + template struct get_extracted_ptr { diff --git a/test/unit/intrusive-list/test_intrusive_iterable_list.h b/test/unit/intrusive-list/test_intrusive_iterable_list.h index 4cf8ab76..6c49b305 100644 --- a/test/unit/intrusive-list/test_intrusive_iterable_list.h +++ b/test/unit/intrusive-list/test_intrusive_iterable_list.h @@ -535,15 +535,15 @@ namespace cds_test { EXPECT_EQ( it->nKey, key ); EXPECT_EQ( ( *it ).nKey, key ); - EXPECT_TRUE( l.erase_at( it ) ); + EXPECT_TRUE( l.erase_at( it )); EXPECT_EQ( it->nKey, key ); EXPECT_EQ( ( *it ).nKey, key ); - EXPECT_FALSE( l.erase_at( it ) ); + EXPECT_FALSE( l.erase_at( it )); ++key; } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); List::gc::force_dispose(); diff --git a/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h b/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h index 0a892cb5..3f5f40a7 100644 --- a/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h +++ b/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h @@ -155,14 +155,14 @@ namespace cds_test { // erase_at() test for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } for ( auto it = s.begin(); it != s.end(); ++it ) { EXPECT_TRUE( s.erase_at( it )); EXPECT_FALSE( s.erase_at( it )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/map/test_michael_iterable_hp.h b/test/unit/map/test_michael_iterable_hp.h index 36b93af0..c5c86037 100644 --- a/test/unit/map/test_michael_iterable_hp.h +++ b/test/unit/map/test_michael_iterable_hp.h @@ -136,15 +136,15 @@ namespace cds_test { // erase_at() for ( auto const& i : arrKeys ) - EXPECT_TRUE( m.insert( i ) ); - EXPECT_FALSE( m.empty() ); + EXPECT_TRUE( m.insert( i )); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); for ( auto it = m.begin(); it != m.end(); ++it ) { EXPECT_TRUE( m.erase_at( it )); EXPECT_FALSE( m.erase_at( it )); } - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0u ); } }; diff --git a/test/unit/misc/bit_reversal.cpp b/test/unit/misc/bit_reversal.cpp index 2c1eb109..191dd03b 100644 --- a/test/unit/misc/bit_reversal.cpp +++ b/test/unit/misc/bit_reversal.cpp @@ -67,7 +67,7 @@ namespace { { Algo f; for ( auto i : arr_ ) { - EXPECT_EQ( cds::algo::bit_reversal::swar()( i ), f( i ) ) << "i=" << i; + EXPECT_EQ( cds::algo::bit_reversal::swar()( i ), f( i )) << "i=" << i; } } }; diff --git a/test/unit/misc/cxx11_atomic_class.cpp b/test/unit/misc/cxx11_atomic_class.cpp index 1f99d513..c17702ad 100644 --- a/test/unit/misc/cxx11_atomic_class.cpp +++ b/test/unit/misc/cxx11_atomic_class.cpp @@ -32,7 +32,7 @@ #include #include "cxx11_convert_memory_order.h" -#define EXPECT_ATOMIC_IS_LOCK_FREE( x ) EXPECT_TRUE( x.is_lock_free() ) +#define EXPECT_ATOMIC_IS_LOCK_FREE( x ) EXPECT_TRUE( x.is_lock_free()) namespace { class cxx11_atomic_class: public ::testing::Test diff --git a/test/unit/misc/split_bitstring.cpp b/test/unit/misc/split_bitstring.cpp index 8702d833..23e97e6d 100644 --- a/test/unit/misc/split_bitstring.cpp +++ b/test/unit/misc/split_bitstring.cpp @@ -55,24 +55,24 @@ namespace { size_t res; // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( sizeof( src ) * 8 ); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( sizeof( src ) * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( sizeof( src ) * 8 ); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( sizeof( src ) * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( *splitter.source(), src ); @@ -154,24 +154,24 @@ namespace { size_t res; // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( sizeof( src ) * 8 ); ASSERT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( sizeof( src ) * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( sizeof( src ) * 8 ); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( sizeof( src ) * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( *splitter.source(), src ); @@ -212,7 +212,7 @@ namespace { ASSERT_FALSE( !splitter ); if ( i % 8 == 0 ) res = res << 8; - res |= ( splitter.cut( 1 ) ) << ( i % 8 ); + res |= ( splitter.cut( 1 )) << ( i % 8 ); } ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); @@ -378,7 +378,7 @@ namespace { ASSERT_FALSE( !splitter ); if ( i % 8 == 0 ) res = res << 8; - res |= ( splitter.cut( 1 ) ) << ( i % 8 ); + res |= ( splitter.cut( 1 )) << ( i % 8 ); } ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); @@ -455,24 +455,24 @@ namespace { split_bitstring splitter( src ); // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( int48_size * 8 ); - EXPECT_EQ( res, src.to64() ); - ASSERT_TRUE( splitter.eos() ); + EXPECT_EQ( res, src.to64()); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( int48_size * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( int48_size * 8 ); - EXPECT_EQ( res, src.to64() ); - ASSERT_TRUE( splitter.eos() ); + EXPECT_EQ( res, src.to64()); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( int48_size * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); } #endif @@ -480,34 +480,34 @@ namespace { typedef cds::algo::split_bitstring< int48, int48_size, size_t > split_bitstring; split_bitstring splitter( src ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < int48_size * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); ASSERT_EQ( splitter.cut( 4 ), i ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_FALSE( splitter ); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); // by one bit { splitter.reset(); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); res = 0; for ( size_t i = 0; i < int48_size * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); #if CDS_BUILD_BITS == 64 res |= splitter.cut( 1 ) << i; @@ -515,11 +515,11 @@ namespace { res |= static_cast( splitter.cut( 1 )) << i; #endif } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); - EXPECT_EQ( res, src.to64() ); + EXPECT_EQ( res, src.to64()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); } @@ -528,14 +528,14 @@ namespace { { for ( size_t k = 0; k < 100; ++k ) { splitter.reset(); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); res = 0; size_t shift = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); int bits = std::rand() % 16; #if CDS_BUILD_BITS == 64 @@ -545,11 +545,11 @@ namespace { #endif shift += bits; } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); - EXPECT_EQ( res, src.to64() ); + EXPECT_EQ( res, src.to64()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); } @@ -570,24 +570,24 @@ namespace { split_bitstring splitter( src ); // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( int48_size * 8 ); - ASSERT_EQ( res, src.to64() ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_EQ( res, src.to64()); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( int48_size * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut( int48_size * 8 ); - EXPECT_EQ( res, src.to64() ); - ASSERT_TRUE( splitter.eos() ); + EXPECT_EQ( res, src.to64()); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( int48_size * 8 ), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); } #endif @@ -595,14 +595,14 @@ namespace { typedef cds::algo::split_bitstring< int48, int48_size, size_t > split_bitstring; split_bitstring splitter( src ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < int48_size * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); if ( i % 2 == 0 ) { EXPECT_EQ( splitter.cut( 4 ), 0x0A - i ); @@ -611,37 +611,37 @@ namespace { EXPECT_EQ( splitter.cut( 4 ), 0x0B - i + 1 ); } } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); // by one bit { splitter.reset(); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); res = 0; for ( size_t i = 0; i < int48_size * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); #if CDS_BUILD_BITS == 64 if ( i % 8 == 0 ) res = res << 8; - res |= ( splitter.cut( 1 ) ) << ( i % 8 ); + res |= ( splitter.cut( 1 )) << ( i % 8 ); #else - res = ( res << 1 ) | static_cast( splitter.cut( 1 ) ); + res = ( res << 1 ) | static_cast( splitter.cut( 1 )); #endif } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); - EXPECT_EQ( res, src.to64() ); + EXPECT_EQ( res, src.to64()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); } @@ -651,13 +651,13 @@ namespace { { for ( size_t k = 0; k < 100; ++k ) { splitter.reset(); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), int48_size * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); res = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); unsigned bits = std::rand() % 16; size_t shift = splitter.rest_count(); @@ -669,11 +669,11 @@ namespace { res = ( res << shift ) | static_cast( splitter.safe_cut( bits )); #endif } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); - EXPECT_EQ( res, src.to64() ); + EXPECT_EQ( res, src.to64()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); - EXPECT_EQ( splitter.source()->to64(), src.to64() ); + EXPECT_EQ( splitter.source()->to64(), src.to64()); EXPECT_EQ( splitter.rest_count(), 0u ); EXPECT_EQ( splitter.bit_offset(), int48_size * 8 ); } @@ -688,12 +688,12 @@ namespace { typedef cds::algo::byte_splitter< size_t > splitter_type; splitter_type splitter( src ); - ASSERT_TRUE( !splitter.eos() ); + ASSERT_TRUE( !splitter.eos()); EXPECT_EQ( *splitter.source(), src ); EXPECT_EQ( splitter.rest_count(), sizeof( src ) * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); - EXPECT_TRUE( splitter.is_correct( 8 ) ); - EXPECT_FALSE( splitter.is_correct( 4 ) ); + EXPECT_TRUE( splitter.is_correct( 8 )); + EXPECT_FALSE( splitter.is_correct( 4 )); unsigned expected = 0x10; for ( unsigned i = 0; i < splitter_type::c_bitstring_size; ++i ) { @@ -702,7 +702,7 @@ namespace { expected += 0x22; } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); EXPECT_EQ( *splitter.source(), src ); EXPECT_EQ( splitter.rest_count(), 0u ); @@ -716,12 +716,12 @@ namespace { typedef cds::algo::byte_splitter< size_t > splitter_type; splitter_type splitter( src ); - ASSERT_TRUE( !splitter.eos() ); + ASSERT_TRUE( !splitter.eos()); EXPECT_EQ( *splitter.source(), src ); EXPECT_EQ( splitter.rest_count(), sizeof( src ) * 8 ); EXPECT_EQ( splitter.bit_offset(), 0u ); - EXPECT_TRUE( splitter.is_correct( 8 ) ); - EXPECT_FALSE( splitter.is_correct( 4 ) ); + EXPECT_TRUE( splitter.is_correct( 8 )); + EXPECT_FALSE( splitter.is_correct( 4 )); unsigned expected = 0xFE; for ( unsigned i = 0; i < splitter_type::c_bitstring_size; ++i ) { @@ -730,7 +730,7 @@ namespace { expected -= 0x22; } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); EXPECT_EQ( splitter.safe_cut( 8 ), 0u ); EXPECT_EQ( *splitter.source(), src ); EXPECT_EQ( splitter.rest_count(), 0u ); @@ -799,7 +799,7 @@ namespace { TEST_F( Split_bitstrig, cut_int48 ) { - if ( is_big_endian() ) + if ( is_big_endian()) cut_int48_be(); else cut_int48_le(); @@ -807,7 +807,7 @@ namespace { TEST_F( Split_bitstrig, cut_byte ) { - if ( is_big_endian() ) + if ( is_big_endian()) cut_byte_be(); else cut_byte_le(); diff --git a/test/unit/queue/fcqueue.cpp b/test/unit/queue/fcqueue.cpp index 1a05b683..a7577492 100644 --- a/test/unit/queue/fcqueue.cpp +++ b/test/unit/queue/fcqueue.cpp @@ -146,7 +146,7 @@ namespace { const int nSize = 100; - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // enqueue/dequeue @@ -154,16 +154,16 @@ namespace { ASSERT_TRUE( q.enqueue( value_type( i ))); ASSERT_EQ( q.size(), static_cast( i + 1 )); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), static_cast( nSize )); for ( int i = 0; i < nSize; ++i ) { it.value = -1; - ASSERT_TRUE( q.dequeue( it ) ); + ASSERT_TRUE( q.dequeue( it )); ASSERT_EQ( it.value, i ); ASSERT_EQ( q.size(), static_cast( nSize - i - 1 )); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // push/pop @@ -171,39 +171,39 @@ namespace { ASSERT_TRUE( q.push( value_type( i ))); ASSERT_EQ( q.size(), static_cast( i + 1 )); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), static_cast( nSize )); for ( int i = 0; i < nSize; ++i ) { it.value = -1; - ASSERT_TRUE( q.pop( it ) ); + ASSERT_TRUE( q.pop( it )); ASSERT_EQ( it.value, i ); ASSERT_EQ( q.size(), static_cast( nSize - i - 1 )); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // clear for ( int i = 0; i < nSize; ++i ) { ASSERT_TRUE( q.push( value_type( i ))); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), static_cast( nSize )); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // pop from empty queue it = value_type( nSize * 2 ); - ASSERT_FALSE( q.pop( it ) ); + ASSERT_FALSE( q.pop( it )); ASSERT_EQ( it.value, nSize * 2 ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); - ASSERT_FALSE( q.dequeue( it ) ); + ASSERT_FALSE( q.dequeue( it )); ASSERT_EQ( it.value, nSize * 2 ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); } diff --git a/test/unit/queue/test_bounded_queue.h b/test/unit/queue/test_bounded_queue.h index 9186771d..698b9574 100644 --- a/test/unit/queue/test_bounded_queue.h +++ b/test/unit/queue/test_bounded_queue.h @@ -53,20 +53,20 @@ namespace cds_test { for ( unsigned pass = 0; pass < 3; ++pass ) { for ( size_t i = 0; i < nSize; ++i ) { it = static_cast( i ); - ASSERT_TRUE( q.enqueue( it ) ); + ASSERT_TRUE( q.enqueue( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); - ASSERT_FALSE( q.enqueue( static_cast( nSize ) * 2 ) ); + ASSERT_FALSE( q.enqueue( static_cast( nSize ) * 2 )); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.dequeue( it ) ); - ASSERT_EQ( it, static_cast( i ) ); + ASSERT_TRUE( q.dequeue( it )); + ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } @@ -74,19 +74,19 @@ namespace cds_test { for ( unsigned pass = 0; pass < 3; ++pass ) { for ( size_t i = 0; i < nSize; ++i ) { it = static_cast( i ); - ASSERT_TRUE( q.push( it ) ); + ASSERT_TRUE( q.push( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.pop( it ) ); - ASSERT_EQ( it, static_cast( i ) ); + ASSERT_TRUE( q.pop( it )); + ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } @@ -97,26 +97,26 @@ namespace cds_test { ASSERT_NE( it, -1 ); auto f = [&it]( value_type& dest ) { dest = it; it = -1; }; if ( i & 1 ) - ASSERT_TRUE( q.enqueue_with( f ) ); + ASSERT_TRUE( q.enqueue_with( f )); else - ASSERT_TRUE( q.push_with( f ) ); + ASSERT_TRUE( q.push_with( f )); ASSERT_EQ( it, -1 ); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; auto f = [&it]( value_type& src ) { it = src; src = -1; }; if ( i & 1 ) - ASSERT_TRUE( q.pop_with( f ) ); + ASSERT_TRUE( q.pop_with( f )); else - ASSERT_TRUE( q.dequeue_with( f ) ); - ASSERT_EQ( it, static_cast( i ) ); + ASSERT_TRUE( q.dequeue_with( f )); + ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0u ); } diff --git a/test/unit/queue/vyukov_mpmc_queue.cpp b/test/unit/queue/vyukov_mpmc_queue.cpp index fb145024..2023d245 100644 --- a/test/unit/queue/vyukov_mpmc_queue.cpp +++ b/test/unit/queue/vyukov_mpmc_queue.cpp @@ -45,31 +45,31 @@ namespace { const size_t nSize = q.capacity(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // enqueue/dequeue for ( unsigned pass = 0; pass < 3; ++pass ) { for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_TRUE( q.enqueue( static_cast( i ) ) ); + ASSERT_TRUE( q.enqueue( static_cast( i )) ); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); - ASSERT_FALSE( q.enqueue( static_cast( nSize ) * 2 ) ); + ASSERT_FALSE( q.enqueue( static_cast( nSize ) * 2 )); for ( size_t i = 0; i < nSize; ++i ) { value_type* fr = q.front(); ASSERT_TRUE( fr != nullptr ); - ASSERT_EQ( *fr, static_cast( i ) ); - ASSERT_TRUE( q.pop_front() ); + ASSERT_EQ( *fr, static_cast( i )); + ASSERT_TRUE( q.pop_front()); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); ASSERT_TRUE( q.front() == nullptr ); - ASSERT_FALSE( q.pop_front() ); + ASSERT_FALSE( q.pop_front()); } } }; diff --git a/test/unit/queue/weak_ringbuffer.cpp b/test/unit/queue/weak_ringbuffer.cpp index 7718dad0..c6eee650 100644 --- a/test/unit/queue/weak_ringbuffer.cpp +++ b/test/unit/queue/weak_ringbuffer.cpp @@ -58,27 +58,27 @@ namespace { el[k] = static_cast( i + k ); if ( i + nArrSize <= nSize ) { - ASSERT_TRUE( q.push( el, nArrSize ) ); + ASSERT_TRUE( q.push( el, nArrSize )); } else { - ASSERT_FALSE( q.push( el, nArrSize ) ); + ASSERT_FALSE( q.push( el, nArrSize )); } } - ASSERT_TRUE( !q.empty() ); + ASSERT_TRUE( !q.empty()); if ( nSize % nArrSize != 0 ) { - ASSERT_FALSE( q.full() ); + ASSERT_FALSE( q.full()); ASSERT_CONTAINER_SIZE( q, nArrCount * nArrSize ); for ( size_t i = nArrCount * nArrSize; i < nSize; ++i ) { - ASSERT_TRUE( q.enqueue( static_cast( i ) ) ); + ASSERT_TRUE( q.enqueue( static_cast( i )) ); } } - ASSERT_TRUE( q.full() ); + ASSERT_TRUE( q.full()); ASSERT_CONTAINER_SIZE( q, nSize ); // batch pop value_type expected = 0; - while ( q.pop( el, nArrSize ) ) { + while ( q.pop( el, nArrSize )) { for ( size_t i = 0; i < nArrSize; ++i ) { ASSERT_EQ( el[i], expected ); ++expected; @@ -86,15 +86,15 @@ namespace { } if ( nSize % nArrSize == 0 ) { - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); } else { - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize % nArrSize ); q.clear(); } - ASSERT_TRUE( q.empty() ); - ASSERT_FALSE( q.full() ); + ASSERT_TRUE( q.empty()); + ASSERT_FALSE( q.full()); ASSERT_CONTAINER_SIZE( q, 0u ); } } @@ -111,28 +111,28 @@ namespace { el[k] = i + k; if ( i + nArrSize <= nSize ) { - ASSERT_TRUE( q.push( el, nArrSize, func_push ) ); + ASSERT_TRUE( q.push( el, nArrSize, func_push )); } else { - ASSERT_FALSE( q.push( el, nArrSize, func_push ) ); + ASSERT_FALSE( q.push( el, nArrSize, func_push )); } } - ASSERT_TRUE( !q.empty() ); + ASSERT_TRUE( !q.empty()); if ( nSize % nArrSize != 0 ) { - ASSERT_FALSE( q.full() ); + ASSERT_FALSE( q.full()); ASSERT_CONTAINER_SIZE( q, nArrCount * nArrSize ); for ( size_t i = nArrCount * nArrSize; i < nSize; ++i ) { - ASSERT_TRUE( q.push( &i, 1, func_push ) ); + ASSERT_TRUE( q.push( &i, 1, func_push )); } } - ASSERT_TRUE( q.full() ); + ASSERT_TRUE( q.full()); ASSERT_CONTAINER_SIZE( q, nSize ); // batch pop with functor auto func_pop = []( size_t& dest, value_type src ) { dest = static_cast( src / 10 ); }; size_t expected = 0; - while ( q.pop( el, nArrSize, func_pop ) ) { + while ( q.pop( el, nArrSize, func_pop )) { for ( size_t i = 0; i < nArrSize; ++i ) { ASSERT_EQ( el[i], expected ); ++expected; @@ -140,19 +140,19 @@ namespace { } if ( nSize % nArrSize == 0 ) { - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); } else { - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize % nArrSize ); size_t v; - while ( q.pop( &v, 1, func_pop ) ) { + while ( q.pop( &v, 1, func_pop )) { ASSERT_EQ( v, expected ); ++expected; } } - ASSERT_TRUE( q.empty() ); - ASSERT_FALSE( q.full() ); + ASSERT_TRUE( q.empty()); + ASSERT_FALSE( q.full()); ASSERT_CONTAINER_SIZE( q, 0u ); } @@ -163,36 +163,36 @@ namespace { el[k] = i + k; if ( i + nArrSize <= nSize ) { - ASSERT_TRUE( q.push( el, nArrSize, func_push ) ); + ASSERT_TRUE( q.push( el, nArrSize, func_push )); } else { - ASSERT_FALSE( q.push( el, nArrSize, func_push ) ); + ASSERT_FALSE( q.push( el, nArrSize, func_push )); } } - ASSERT_TRUE( !q.empty() ); + ASSERT_TRUE( !q.empty()); if ( nSize % nArrSize != 0 ) { - ASSERT_FALSE( q.full() ); + ASSERT_FALSE( q.full()); ASSERT_CONTAINER_SIZE( q, nArrCount * nArrSize ); for ( size_t i = nArrCount * nArrSize; i < nSize; ++i ) { - ASSERT_TRUE( q.push( &i, 1, func_push ) ); + ASSERT_TRUE( q.push( &i, 1, func_push )); } } - ASSERT_TRUE( q.full() ); + ASSERT_TRUE( q.full()); ASSERT_CONTAINER_SIZE( q, nSize ); value_type cur = 0; - while ( !q.empty() ) { + while ( !q.empty()) { value_type* front = q.front(); ASSERT_TRUE( front != nullptr ); ASSERT_EQ( cur, *front ); - ASSERT_TRUE( q.pop_front() ); + ASSERT_TRUE( q.pop_front()); cur += 10; } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_TRUE( q.front() == nullptr ); - ASSERT_FALSE( q.pop_front() ); + ASSERT_FALSE( q.pop_front()); } } } @@ -202,10 +202,10 @@ namespace { { size_t const capacity = q.capacity(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); ASSERT_TRUE( q.front().first == nullptr ); - ASSERT_FALSE( q.pop_front() ); + ASSERT_FALSE( q.pop_front()); size_t total_push = 0; uint8_t chfill = 0; @@ -227,14 +227,14 @@ namespace { for ( size_t i = 0; i < pair.second; ++i ) ASSERT_EQ( *reinterpret_cast( pair.first ), chfill ); - ASSERT_TRUE( q.pop_front() ); - ASSERT_FALSE( q.pop_front() ); + ASSERT_TRUE( q.pop_front()); + ASSERT_FALSE( q.pop_front()); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); ASSERT_TRUE( q.front().first == nullptr ); - ASSERT_FALSE( q.pop_front() ); + ASSERT_FALSE( q.pop_front()); } }; @@ -320,4 +320,4 @@ namespace { test_varsize_buffer( q ); } -} // namespace \ No newline at end of file +} // namespace diff --git a/test/unit/set/test_michael_iterable_hp.h b/test/unit/set/test_michael_iterable_hp.h index 08cfbf5b..20be60ba 100644 --- a/test/unit/set/test_michael_iterable_hp.h +++ b/test/unit/set/test_michael_iterable_hp.h @@ -148,9 +148,9 @@ namespace cds_test { // erase_at() for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); for ( auto it = s.begin(); it != s.end(); ++it ) { @@ -158,7 +158,7 @@ namespace cds_test { EXPECT_FALSE( s.erase_at( it )); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_split_iterable_hp.h b/test/unit/set/test_split_iterable_hp.h index 2b558fcd..96a07802 100644 --- a/test/unit/set/test_split_iterable_hp.h +++ b/test/unit/set/test_split_iterable_hp.h @@ -148,9 +148,9 @@ namespace cds_test { // erase_at() for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); for ( auto it = s.begin(); it != s.end(); ++it ) { @@ -158,7 +158,7 @@ namespace cds_test { EXPECT_FALSE( s.erase_at( it )); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); } -- 2.34.1