From 7f6556c85d3ea1f24d7f25521163b4c2242ab1f6 Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 27 Sep 2016 20:58:05 +0300 Subject: [PATCH] Fixed minor gcc warnings --- test/stress/queue/intrusive_push_pop.cpp | 4 +- test/stress/queue/push_pop.cpp | 2 +- test/stress/set/insdel_func/set_insdel_func.h | 8 ++-- test/stress/stack/intrusive_stack_push_pop.h | 2 +- test/stress/stack/push_pop.cpp | 2 +- test/unit/tree/test_intrusive_tree.h | 46 +++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/stress/queue/intrusive_push_pop.cpp b/test/stress/queue/intrusive_push_pop.cpp index 389f70d7..e93a0de7 100644 --- a/test/stress/queue/intrusive_push_pop.cpp +++ b/test/stress/queue/intrusive_push_pop.cpp @@ -243,7 +243,7 @@ namespace { nTotalPops += consumer.m_nPopped; nPopFalse += consumer.m_nPopEmpty; arrReaders.push_back( &consumer ); - EXPECT_EQ( consumer.m_nBadWriter, 0 ) << "consumer " << (i - s_nWriterThreadCount); + EXPECT_EQ( consumer.m_nBadWriter, 0u ) << "consumer " << (i - s_nWriterThreadCount); size_t nPopped = 0; for ( size_t n = 0; n < s_nWriterThreadCount; ++n ) @@ -260,7 +260,7 @@ namespace { Producer& producer = static_cast&>( thr ); nPushFailed += producer.m_nPushFailed; if ( !std::is_base_of::value ) { - EXPECT_EQ( producer.m_nPushFailed, 0 ) << "producer " << i; + EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer " << i; } } } diff --git a/test/stress/queue/push_pop.cpp b/test/stress/queue/push_pop.cpp index 7c3ff6f4..52ac53da 100644 --- a/test/stress/queue/push_pop.cpp +++ b/test/stress/queue/push_pop.cpp @@ -232,7 +232,7 @@ namespace { Producer& producer = static_cast( thr ); nPushFailed += producer.m_nPushFailed; - EXPECT_EQ( producer.m_nPushFailed, 0 ) << "producer_thread_no " << i; + EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer_thread_no " << i; } } EXPECT_EQ( nTotalPops, nPoppedItems ); diff --git a/test/stress/set/insdel_func/set_insdel_func.h b/test/stress/set/insdel_func/set_insdel_func.h index 836c34bf..dce5d148 100644 --- a/test/stress/set/insdel_func/set_insdel_func.h +++ b/test/stress/set/insdel_func/set_insdel_func.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "set_type.h" @@ -499,10 +499,10 @@ namespace set { << std::make_pair( "final_set_size", testSet.size() ); - EXPECT_EQ( nDelValueFailed, 0 ); + EXPECT_EQ( nDelValueFailed, 0u ); EXPECT_EQ( nDelValueSuccess, nDeleteSuccess ); - EXPECT_EQ( nUpdateFailed, 0 ); + EXPECT_EQ( nUpdateFailed, 0u ); EXPECT_EQ( nUpdateCreated, nEnsFuncCreated ); EXPECT_EQ( nUpdateModified, nEnsFuncModified ); diff --git a/test/stress/stack/intrusive_stack_push_pop.h b/test/stress/stack/intrusive_stack_push_pop.h index 28adf8a7..9bc7db01 100644 --- a/test/stress/stack/intrusive_stack_push_pop.h +++ b/test/stress/stack/intrusive_stack_push_pop.h @@ -234,7 +234,7 @@ namespace cds_test { EXPECT_EQ( nPushError, 0u ); for ( size_t i = 0; i < sizeof( arrVal ) / sizeof( arrVal[0] ); ++i ) { - EXPECT_EQ( arrVal[i], 0 ) << "i=" << i; + EXPECT_EQ( arrVal[i], 0u ) << "i=" << i; } propout() << std::make_pair( "push_count", s_nStackSize ) diff --git a/test/stress/stack/push_pop.cpp b/test/stress/stack/push_pop.cpp index ad3dd676..970d0fe5 100644 --- a/test/stress/stack/push_pop.cpp +++ b/test/stress/stack/push_pop.cpp @@ -266,7 +266,7 @@ namespace { EXPECT_EQ( nDirtyPop, 0u ); for ( size_t i = 0; i < sizeof( arrVal ) / sizeof( arrVal[0] ); ++i ) { - EXPECT_EQ( arrVal[i], 0 ); + EXPECT_EQ( arrVal[i], 0u ); } propout() << std::make_pair( "push_count", s_nStackSize ) diff --git a/test/unit/tree/test_intrusive_tree.h b/test/unit/tree/test_intrusive_tree.h index 4d568ef8..3fe1fdb6 100644 --- a/test/unit/tree/test_intrusive_tree.h +++ b/test/unit/tree/test_intrusive_tree.h @@ -329,11 +329,11 @@ namespace cds_test { EXPECT_FALSE( updResult.second ); break; case 1: - EXPECT_EQ( i.nUpdateNewCount, 0 ); + EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( t.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); - EXPECT_EQ( i.nUpdateNewCount, 1 ); + EXPECT_EQ( i.nUpdateNewCount, 1u ); ASSERT_FALSE( t.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); - EXPECT_EQ( i.nUpdateNewCount, 1 ); + EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; case 2: @@ -344,7 +344,7 @@ namespace cds_test { EXPECT_FALSE( updResult.first ); EXPECT_FALSE( updResult.second ); - EXPECT_EQ( i.nUpdateNewCount, 0 ); + EXPECT_EQ( i.nUpdateNewCount, 0u ); updResult = t.update( i, []( bool bNew, value_type& val, value_type& arg ) { EXPECT_TRUE( bNew ); @@ -353,10 +353,10 @@ namespace cds_test { }); EXPECT_TRUE( updResult.first ); EXPECT_TRUE( updResult.second ); - EXPECT_EQ( i.nUpdateNewCount, 1 ); + EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; - EXPECT_EQ( i.nUpdateCount, 0 ); + EXPECT_EQ( i.nUpdateCount, 0u ); updResult = t.update( i, []( bool bNew, value_type& val, value_type& arg ) { EXPECT_FALSE( bNew ); @@ -365,7 +365,7 @@ namespace cds_test { }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); - EXPECT_EQ( i.nUpdateCount, 1 ); + EXPECT_EQ( i.nUpdateCount, 1u ); i.nUpdateCount = 0; break; @@ -374,13 +374,13 @@ namespace cds_test { ASSERT_TRUE( t.contains( i.nKey ) ); ASSERT_TRUE( t.contains( i ) ); ASSERT_TRUE( t.contains( other_item( i.key() ), other_less())); - EXPECT_EQ( i.nFindCount, 0 ); + EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( t.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); - EXPECT_EQ( i.nFindCount, 1 ); + EXPECT_EQ( i.nFindCount, 1u ); ASSERT_TRUE( t.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); - EXPECT_EQ( i.nFindCount, 2 ); + EXPECT_EQ( i.nFindCount, 2u ); ASSERT_TRUE( t.find( i, []( value_type& v, value_type& ) { ++v.nFindCount; } ) ); - EXPECT_EQ( i.nFindCount, 3 ); + EXPECT_EQ( i.nFindCount, 3u ); } ASSERT_FALSE( t.empty() ); ASSERT_CONTAINER_SIZE( t, nTreeSize ); @@ -395,11 +395,11 @@ namespace cds_test { ASSERT_TRUE( t.contains( i.nKey ) ); ASSERT_TRUE( t.contains( i ) ); ASSERT_TRUE( t.contains( other_item( i.key() ), other_less() ) ); - EXPECT_EQ( i.nFindCount, 0 ); + EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( t.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); - EXPECT_EQ( i.nFindCount, 1 ); + EXPECT_EQ( i.nFindCount, 1u ); ASSERT_TRUE( t.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); - EXPECT_EQ( i.nFindCount, 2 ); + EXPECT_EQ( i.nFindCount, 2u ); value_type v( i ); switch ( i.key() % 6 ) { @@ -421,18 +421,18 @@ namespace cds_test { ASSERT_FALSE( t.erase_with( other_item( i.key() ), other_less() ) ); break; case 4: - EXPECT_EQ( i.nEraseCount, 0 ); + EXPECT_EQ( i.nEraseCount, 0u ); ASSERT_TRUE( t.erase( v, []( value_type& val ) { ++val.nEraseCount; } )); - EXPECT_EQ( i.nEraseCount, 1 ); + EXPECT_EQ( i.nEraseCount, 1u ); ASSERT_FALSE( t.erase( v, []( value_type& val ) { ++val.nEraseCount; } )); - EXPECT_EQ( i.nEraseCount, 1 ); + EXPECT_EQ( i.nEraseCount, 1u ); break; case 5: - EXPECT_EQ( i.nEraseCount, 0 ); + EXPECT_EQ( i.nEraseCount, 0u ); ASSERT_TRUE( t.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); - EXPECT_EQ( i.nEraseCount, 1 ); + EXPECT_EQ( i.nEraseCount, 1u ); ASSERT_FALSE( t.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); - EXPECT_EQ( i.nEraseCount, 1 ); + EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -449,7 +449,7 @@ namespace cds_test { // Force retiring cycle Tree::gc::force_dispose(); for ( auto& i : data ) { - EXPECT_EQ( i.nDisposeCount, 1 ); + EXPECT_EQ( i.nDisposeCount, 1u ); } // clear @@ -465,12 +465,12 @@ namespace cds_test { t.clear(); ASSERT_TRUE( t.empty()); - ASSERT_CONTAINER_SIZE( t, 0 ); + ASSERT_CONTAINER_SIZE( t, 0u ); // Force retiring cycle Tree::gc::force_dispose(); for ( auto& i : data ) { - EXPECT_EQ( i.nDisposeCount, 1 ); + EXPECT_EQ( i.nDisposeCount, 1u ); } } }; -- 2.34.1