Fixed Cppcheck warnings
authorkhizmax <khizmax@gmail.com>
Fri, 11 Dec 2015 14:38:22 +0000 (17:38 +0300)
committerkhizmax <khizmax@gmail.com>
Fri, 11 Dec 2015 14:38:22 +0000 (17:38 +0300)
cds/algo/atomic.h
cds/algo/backoff_strategy.h
cds/sync/spinlock.h

index 51d26f83f57ff8a5e3a98fa6a0a561f1e2a09f29..11e9bab8cc5960bcc5708d18dcae5cbc504260a9 100644 (file)
@@ -310,7 +310,7 @@ namespace cds {
             }
 
             /// Dummy function
-            void reset(atomics::memory_order /*order*/ = atomics::memory_order_relaxed)
+            static void reset(atomics::memory_order /*order*/ = atomics::memory_order_relaxed)
             {}
         };
     }   // namespace atomicity
index 7a0872929efa659325c68889a589408a01761e10..f021fbae03b107de400ed9c1ed9bcfdaee51729c 100644 (file)
@@ -60,7 +60,7 @@ namespace cds {
             {}
 
             template <typename Predicate>
-            bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
+            bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
             {
                 return pr();
             }
@@ -73,13 +73,13 @@ namespace cds {
         /// Switch to another thread (yield). Good for thread preemption architecture.
         struct yield {
             //@cond
-            void operator ()() CDS_NOEXCEPT
+            void operator ()() const CDS_NOEXCEPT
             {
                 std::this_thread::yield();
             }
 
             template <typename Predicate>
-            bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
+            bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
             {
                 if ( pr() )
                     return true;
@@ -99,7 +99,7 @@ namespace cds {
         */
         struct pause {
             //@cond
-            void operator ()() CDS_NOEXCEPT
+            void operator ()() const CDS_NOEXCEPT
             {
 #            ifdef CDS_backoff_pause_defined
                 platform::backoff_pause();
@@ -107,7 +107,7 @@ namespace cds {
             }
 
             template <typename Predicate>
-            bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
+            bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
             {
                 if ( pr() )
                     return true;
@@ -128,7 +128,7 @@ namespace cds {
         struct hint
         {
         //@cond
-            void operator ()() CDS_NOEXCEPT
+            void operator ()() const CDS_NOEXCEPT
             {
 #           if defined(CDS_backoff_hint_defined)
                 platform::backoff_hint();
@@ -138,7 +138,7 @@ namespace cds {
             }
 
             template <typename Predicate>
-            bool operator()(Predicate pr) CDS_NOEXCEPT_(noexcept(std::declval<Predicate>()() ))
+            bool operator()(Predicate pr) const CDS_NOEXCEPT_(noexcept(std::declval<Predicate>()() ))
             {
                 if ( pr() )
                     return true;
@@ -361,7 +361,7 @@ namespace cds {
             {}
 
             /// Initializes timeout from \p nTimeout
-            CDS_CONSTEXPR delay( unsigned int nTimeout ) CDS_NOEXCEPT
+            CDS_CONSTEXPR explicit delay( unsigned int nTimeout ) CDS_NOEXCEPT
                 : m_nTimeout( nTimeout )
             {}
 
@@ -382,7 +382,7 @@ namespace cds {
                 return false;
             }
 
-            void reset() const CDS_NOEXCEPT
+            static void reset() CDS_NOEXCEPT
             {}
             //@endcond
         };
index b1dfe82810e9168ccb1e102a797e65ee0075c518..42f842421a3520c388f189474cece86d9a29237c 100644 (file)
@@ -59,7 +59,7 @@ namespace cds {
             /**
                 In debug mode: if \p bLocked = true then spin-lock is made owned by current thread
             */
-            spin_lock( bool bLocked ) CDS_NOEXCEPT
+            explicit spin_lock( bool bLocked ) CDS_NOEXCEPT
 #    ifdef CDS_DEBUG
                 : m_dbgOwnerId( bLocked ? cds::OS::get_current_thread_id() : cds::OS::c_NullThreadId )
 #    endif