From 4d9f3b957e592708529153c38576747b4f4a5330 Mon Sep 17 00:00:00 2001 From: khizmax Date: Fri, 11 Dec 2015 17:38:22 +0300 Subject: [PATCH] Fixed Cppcheck warnings --- cds/algo/atomic.h | 2 +- cds/algo/backoff_strategy.h | 18 +++++++++--------- cds/sync/spinlock.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cds/algo/atomic.h b/cds/algo/atomic.h index 51d26f83..11e9bab8 100644 --- a/cds/algo/atomic.h +++ b/cds/algo/atomic.h @@ -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 diff --git a/cds/algo/backoff_strategy.h b/cds/algo/backoff_strategy.h index 7a087292..f021fbae 100644 --- a/cds/algo/backoff_strategy.h +++ b/cds/algo/backoff_strategy.h @@ -60,7 +60,7 @@ namespace cds { {} template - bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) { 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 - bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) { 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 - bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) { 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 - bool operator()(Predicate pr) CDS_NOEXCEPT_(noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_(noexcept(std::declval()() )) { 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 }; diff --git a/cds/sync/spinlock.h b/cds/sync/spinlock.h index b1dfe828..42f84242 100644 --- a/cds/sync/spinlock.h +++ b/cds/sync/spinlock.h @@ -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 -- 2.34.1