Fixed -Wshadow warnings
[libcds.git] / cds / intrusive / msqueue.h
index 9bd71f5d1bd06578059473bc00dd54a3c4d3a68b..0313390559b6f524aa60874e939227b133ab7ea7 100644 (file)
@@ -1,4 +1,32 @@
-//$$CDS-header$$
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
 
 #ifndef CDSLIB_INTRUSIVE_MSQUEUE_H
 #define CDSLIB_INTRUSIVE_MSQUEUE_H
@@ -337,7 +365,7 @@ namespace cds { namespace intrusive {
             typedef MSQueue< GC2, T2, Traits2 > other;   ///< Rebinding result
         };
 
-        static CDS_CONSTEXPR const size_t m_nHazardPtrCount = 2; ///< Count of hazard pointer required for the algorithm
+        static CDS_CONSTEXPR const size_t c_nHazardPtrCount = 2; ///< Count of hazard pointer required for the algorithm
 
     protected:
         //@cond
@@ -428,13 +456,13 @@ namespace cds { namespace intrusive {
                 void operator()( value_type * p ) const
                 {
                     assert( p != nullptr );
-                    MSQueue::clear_links( node_traits::to_node_ptr( p ) );
+                    MSQueue::clear_links( node_traits::to_node_ptr( p ));
                     disposer()(p);
                 }
             };
 
             if ( p != &m_Dummy )
-                gc::template retire<disposer_thunk>( node_traits::to_value_ptr( p ) );
+                gc::template retire<disposer_thunk>( node_traits::to_value_ptr( p ));
         }
         //@endcond
 
@@ -457,7 +485,7 @@ namespace cds { namespace intrusive {
             node_type * pHead = m_pHead.load(memory_model::memory_order_relaxed);
 
             assert( pHead != nullptr );
-            assert( pHead == m_pTail.load(memory_model::memory_order_relaxed) );
+            assert( pHead == m_pTail.load(memory_model::memory_order_relaxed));
 
             m_pHead.store( nullptr, memory_model::memory_order_relaxed );
             m_pTail.store( nullptr, memory_model::memory_order_relaxed );
@@ -556,7 +584,7 @@ namespace cds { namespace intrusive {
         bool empty() const
         {
             typename gc::Guard guard;
-            node_type * p = guard.protect( m_pHead, []( node_type * p ) -> value_type * { return node_traits::to_value_ptr( p );});
+            node_type * p = guard.protect( m_pHead, []( node_type * pNode ) -> value_type * { return node_traits::to_value_ptr( pNode );});
             return p->m_pNext.load( memory_model::memory_order_relaxed ) == nullptr;
         }
 
@@ -568,7 +596,7 @@ namespace cds { namespace intrusive {
         */
         void clear()
         {
-            while ( dequeue() );
+            while ( dequeue());
         }
 
         /// Returns queue's item count