From 647e6ff06ae367c38571f721bcd7266123d39b91 Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Thu, 29 Sep 2011 19:56:39 +0000 Subject: [PATCH] remove some GCC warnings and update Makefile git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1117 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/LevelMutex.h | 2 +- include/loki/SmallObj.h | 2 +- include/loki/StrongPtr.h | 2 +- src/LevelMutex.cpp | 11 ++++++----- src/SmallObj.cpp | 2 +- src/StrongPtr.cpp | 2 +- test/SmartPtr/Makefile | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/loki/LevelMutex.h b/include/loki/LevelMutex.h index 93100b9..1c33af9 100644 --- a/include/loki/LevelMutex.h +++ b/include/loki/LevelMutex.h @@ -254,7 +254,7 @@ public: /** Returns true if this mutex was locked within the last count mutexes. @param count How many recent mutexes to look through to find this mutex. */ - bool IsRecentLock( unsigned int count ) const volatile; + bool IsRecentLock( std::size_t count ) const volatile; /// Returns true if this was locked by current thread. bool IsLockedByCurrentThread( void ) const volatile; diff --git a/include/loki/SmallObj.h b/include/loki/SmallObj.h index 32f888a..6b43791 100644 --- a/include/loki/SmallObj.h +++ b/include/loki/SmallObj.h @@ -88,7 +88,7 @@ namespace Loki namespace Private { class FixedAllocator; - }; // end namespace Private + } // end namespace Private /** @class SmallObjAllocator @ingroup SmallObjectGroupInternal diff --git a/include/loki/StrongPtr.h b/include/loki/StrongPtr.h index 9e922df..9dc1ad0 100644 --- a/include/loki/StrongPtr.h +++ b/include/loki/StrongPtr.h @@ -1468,9 +1468,9 @@ protected: inline explicit TwoRefLinks( bool strong ) : m_pointer( 0 ) - , m_strong( strong ) , m_prev( this ) , m_next( this ) + , m_strong( strong ) { } diff --git a/src/LevelMutex.cpp b/src/LevelMutex.cpp index 5a4c769..ff8f760 100644 --- a/src/LevelMutex.cpp +++ b/src/LevelMutex.cpp @@ -200,7 +200,7 @@ unsigned int CountMutexesAtCurrentLevel( void ) MutexErrors::Type DoMutexesMatchContainer( const LevelMutexInfo::MutexContainer & mutexes ) { - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( 0 == count ) return MutexErrors::EmptyContainer; unsigned int currentLevel = GetCurrentThreadsLevel(); @@ -334,7 +334,7 @@ MutexErrors::Type LevelMutexInfo::MultiLock( MutexContainer & mutexes ) { assert( IsValidList() ); - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( count == 0 ) return MutexErrors::EmptyContainer; @@ -417,7 +417,8 @@ MutexErrors::Type LevelMutexInfo::MultiLock( MutexContainer & mutexes, if ( 0 == milliSeconds ) return MultiLock( mutexes ); - const unsigned int count = mutexes.size(); + + const std::size_t count = mutexes.size(); if ( 0 == count ) return MutexErrors::EmptyContainer; @@ -507,7 +508,7 @@ MutexErrors::Type LevelMutexInfo::MultiUnlock( MutexContainer & mutexes ) LevelMutexInfo::UnlockedLevel, result ); } - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( 1 < count ) { ::std::sort( mutexes.begin(), mutexes.end() ); @@ -628,7 +629,7 @@ bool LevelMutexInfo::IsRecentLock( void ) const volatile // ---------------------------------------------------------------------------- -bool LevelMutexInfo::IsRecentLock( unsigned int count ) const volatile +bool LevelMutexInfo::IsRecentLock( std::size_t count ) const volatile { LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) diff --git a/src/SmallObj.cpp b/src/SmallObj.cpp index 55426f4..714dbe4 100644 --- a/src/SmallObj.cpp +++ b/src/SmallObj.cpp @@ -1119,7 +1119,7 @@ void DefaultDeallocator( void * p ) // ---------------------------------------------------------------------------- -}; // end namespace Private +} // end namespace Private using namespace ::Loki::Private; diff --git a/src/StrongPtr.cpp b/src/StrongPtr.cpp index a480e37..52daa5c 100644 --- a/src/StrongPtr.cpp +++ b/src/StrongPtr.cpp @@ -344,9 +344,9 @@ void SingleOwnerRefCount::SetPointer( void * p ) TwoRefLinks::TwoRefLinks( const void * p, bool strong ) : m_pointer( const_cast< void * >( p ) ) - , m_strong( strong ) , m_prev( this ) , m_next( this ) + , m_strong( strong ) { assert( IsValid() ); } diff --git a/test/SmartPtr/Makefile b/test/SmartPtr/Makefile index ee1351a..ed749ac 100644 --- a/test/SmartPtr/Makefile +++ b/test/SmartPtr/Makefile @@ -1,7 +1,7 @@ include ../Makefile.common BIN := main$(BIN_SUFFIX) -SRC := main.cpp strong.cpp LockTest.cpp +SRC := main.cpp strong.cpp LockTest.cpp colvin_gibbons_trick.cpp OBJ := $(SRC:.cpp=.o) LDLIBS += -lpthread