Fixed -Wshadow warnings
authorkhizmax <khizmax@gmail.com>
Thu, 14 Sep 2017 14:58:19 +0000 (17:58 +0300)
committerkhizmax <khizmax@gmail.com>
Thu, 14 Sep 2017 14:58:19 +0000 (17:58 +0300)
cds/container/ellen_bintree_set_rcu.h
cds/container/impl/bronson_avltree_map_rcu.h
cds/container/impl/ellen_bintree_set.h
test/stress/queue/pop.cpp
test/stress/queue/push_pop.cpp
test/unit/intrusive-set/test_intrusive_skiplist_rcu.h
test/unit/tree/test_bronson_avltree_map_ptr.h

index 8d0da8506b851a1e74e5780b8325ea78090391d4..dd5c41918c351f1ca76e655e062d4ee6e0967e47 100644 (file)
@@ -232,7 +232,7 @@ namespace cds { namespace container {
         bool insert( Q const& val, Func f )
         {
             scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
-            if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { f( val.m_Value ); } )) {
+            if ( base_class::insert( *sp.get(), [&f]( leaf_node& v ) { f( v.m_Value ); } )) {
                 sp.release();
                 return true;
             }
index a855ff24b00d851d57ef5b9ff38ded62dd060aa4..458cbdb77009d6b648ba8eceb2e39919806d7d80 100644 (file)
@@ -1410,10 +1410,10 @@ namespace cds { namespace container {
         {
             node_type * pNew;
 
-            auto fnCreateNode = [&funcUpdate]( node_type * pNode ) {
-                mapped_type pVal = funcUpdate( pNode );
+            auto fnCreateNode = [&funcUpdate]( node_type * node ) {
+                mapped_type pVal = funcUpdate( node );
                 assert( pVal != nullptr );
-                pNode->m_pValue.store( pVal, memory_model::memory_order_release );
+                node->m_pValue.store( pVal, memory_model::memory_order_release );
             };
 
             static_if ( c_bRelaxedInsert ) {
index 365e7a6a4fe00179609d185022e31719ad4582da..5f93f4647771a7d6e605b85afc1de8cc29a2de9a 100644 (file)
@@ -227,7 +227,7 @@ namespace cds { namespace container {
         bool insert( Q const& val, Func f )
         {
             scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
-            if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { f( val.m_Value ); } )) {
+            if ( base_class::insert( *sp.get(), [&f]( leaf_node& v ) { f( v.m_Value ); } )) {
                 sp.release();
                 return true;
             }
index 21c0610511a57923ac90b369a0f3e686a70310f5..cd5ab8a555410cc5bd77262eee635acd03e752c9 100644 (file)
@@ -131,8 +131,8 @@ namespace {
             size_t nTotalPops = 0;
             for ( size_t i = 0; i < pool.size(); ++i ) {
                 Consumer<Queue>& thread = static_cast<Consumer<Queue>&>(pool.get( i ));
-                for ( size_t i = 0; i < s_nQueueSize; ++i )
-                    arr[i] += thread.m_arr[i];
+                for ( size_t j = 0; j < s_nQueueSize; ++j )
+                    arr[j] += thread.m_arr[j];
                 nTotalPops += thread.m_nPopCount;
             }
             EXPECT_EQ( nTotalPops, s_nQueueSize );
index 47a4097dc689a4007bd660f21335e7e237589d13..148fde4136b354c5e81f15bfe89cd3416eb1f16f 100644 (file)
@@ -200,8 +200,8 @@ namespace {
         {
             cds_test::thread_pool& pool = get_pool();
 
-            typedef Consumer<Queue> Consumer;
-            typedef Producer<Queue> Producer;
+            typedef Consumer<Queue> consumer_type;
+            typedef Producer<Queue> producer_type;
 
             size_t nPostTestPops = 0;
             {
@@ -215,12 +215,12 @@ namespace {
             size_t nPoppedItems = 0;
             size_t nPushFailed = 0;
 
-            std::vector< Consumer * > arrConsumer;
+            std::vector< consumer_type * > arrConsumer;
 
             for ( size_t i = 0; i < pool.size(); ++i ) {
                 cds_test::thread& thr = pool.get(i);
                 if ( thr.type() == consumer_thread ) {
-                    Consumer& consumer = static_cast<Consumer&>( thr );
+                    consumer_type& consumer = static_cast<consumer_type&>( thr );
                     nTotalPops += consumer.m_nPopped;
                     nPopFalse += consumer.m_nPopEmpty;
                     arrConsumer.push_back( &consumer );
@@ -235,7 +235,7 @@ namespace {
                 else {
                     assert( thr.type() == producer_thread );
 
-                    Producer& producer = static_cast<Producer&>( thr );
+                    producer_type& producer = static_cast<producer_type&>( thr );
                     nPushFailed += producer.m_nPushFailed;
                     EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer_thread_no " << i;
                 }
index 63347a8b8743d4f607a0f60ee36548d04c3d9874..cbfdfba4bb13de8a0b13ed50ef30e05a17353bec 100644 (file)
@@ -213,13 +213,13 @@ TYPED_TEST_P( IntrusiveSkipListSet, base_turbo24 )
     typedef typename TestFixture::rcu_type rcu_type;
     typedef typename TestFixture::base_item_type base_item_type;
     typedef typename TestFixture::mock_disposer mock_disposer;
-    typedef typename TestFixture::template cmp<base_item_type> cmp;
+    typedef typename TestFixture::template cmp<base_item_type> item_cmp;
 
     struct traits: public ci::skip_list::traits
     {
         typedef ci::skip_list::base_hook< ci::opt::gc< rcu_type >> hook;
         typedef mock_disposer disposer;
-        typedef cmp compare;
+        typedef item_cmp compare;
         typedef ci::skip_list::turbo24 random_level_generator;
     };
 
index 4ec6ea32c6007cfd9fecf0ce96566419564fd307..091a173f3319b163eba35d5a3a50d9ec44e17030 100644 (file)
@@ -113,25 +113,25 @@ namespace {
                 case 0:
                     ASSERT_TRUE( m.insert( i, &val ));
                     ASSERT_FALSE( m.insert( i, &val ));
-                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
-                        val.nVal = key.nKey;
-                        val.strVal = std::to_string( key.nKey );
+                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+                        v.nVal = k.nKey;
+                        v.strVal = std::to_string( k.nKey );
                     } ));
                     break;
                 case 1:
                     ASSERT_TRUE( m.insert( i.nKey, &val ));
                     ASSERT_FALSE( m.insert( i.nKey, &val ));
-                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
-                        val.nVal = key.nKey;
-                        val.strVal = std::to_string( key.nKey );
+                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+                        v.nVal = k.nKey;
+                        v.strVal = std::to_string( k.nKey );
                     } ));
                     break;
                 case 2:
                     ASSERT_TRUE( m.insert( std::to_string( i.nKey ), &val ));
                     ASSERT_FALSE( m.insert( std::to_string( i.nKey ), &val ));
-                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
-                        val.nVal = key.nKey;
-                        val.strVal = std::to_string( key.nKey );
+                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+                        v.nVal = k.nKey;
+                        v.strVal = std::to_string( k.nKey );
                     } ));
                     break;
                 case 3:
@@ -178,17 +178,17 @@ namespace {
                 ASSERT_TRUE( m.contains( i.nKey ));
                 ASSERT_TRUE( m.contains( i ));
                 ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
-                ASSERT_TRUE( m.find( i, []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
-                ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
-                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
             }
             ASSERT_FALSE( m.empty());
@@ -206,17 +206,17 @@ namespace {
                 ASSERT_TRUE( m.contains( val.strVal ));
                 ASSERT_TRUE( m.contains( i ));
                 ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
-                ASSERT_TRUE( m.find( i, []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
-                ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
-                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& key, mapped_type& val ) {
-                    EXPECT_EQ( key.nKey, val.nVal );
-                    EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
+                    EXPECT_EQ( k.nKey, v.nVal );
+                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                 } ));
 
 
@@ -238,9 +238,9 @@ namespace {
                     ASSERT_FALSE( m.erase_with( other_item( i.nKey ), other_less()));
                     break;
                 case 4:
-                    ASSERT_TRUE( m.erase( i, []( key_type const& key, mapped_type& val ) {
-                        EXPECT_EQ( key.nKey, val.nVal );
-                        EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+                    ASSERT_TRUE( m.erase( i, []( key_type const& k, mapped_type& v ) {
+                        EXPECT_EQ( k.nKey, v.nVal );
+                        EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                     }));
                     ASSERT_FALSE( m.erase( i, []( key_type const& /*key*/, mapped_type& /*val*/ ) {
                         EXPECT_TRUE( false );