GCC 4.2 fixes

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@895 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2008-08-08 22:06:26 +00:00
parent 1cc348d6e2
commit 0c4789ee11
3 changed files with 2364 additions and 2355 deletions

View file

@ -582,6 +582,8 @@ public:
*/
explicit SleepLevelMutex( unsigned int level );
SleepLevelMutex( unsigned int level, unsigned int sleepTime );
/// Destructs the mutex.
virtual ~SleepLevelMutex( void );
@ -742,9 +744,9 @@ class LevelMutex : public LevelMutexInfo
{
public:
typedef typename ErrorPolicy EP;
typedef typename WaitPolicy WP;
typedef typename MutexPolicy MP;
typedef ErrorPolicy EP;
typedef WaitPolicy WP;
typedef MutexPolicy MP;
/** This constructor allows callers to replace the default level with another
value. It also acts as the default constructor for existing code which uses
@ -1022,10 +1024,10 @@ public:
MutexException & operator = ( const MutexException & that ) throw ();
/// Destroys the exception.
virtual ~MutexException( void );
virtual ~MutexException( void ) throw();
/// Returns a simple message about which operation failed.
virtual const char * what( void ) const;
virtual const char * what( void ) const throw();
/// Returns level of mutex(es) used when problem occurred.
unsigned int GetLevel( void ) const { return m_level; }
@ -1201,6 +1203,6 @@ private:
// ----------------------------------------------------------------------------
}; // end namespace Loki
} // end namespace Loki
#endif // end file guardian

View file

@ -23,6 +23,7 @@
#include <loki/LevelMutex.h>
#include <algorithm>
#include <cerrno>
using namespace ::std;
@ -32,7 +33,7 @@ using namespace ::std;
#define nullptr 0
volatile ::Loki::LevelMutexInfo * ::Loki::LevelMutexInfo::s_currentMutex = nullptr;
LOKI_THREAD_LOCAL volatile ::Loki::LevelMutexInfo * ::Loki::LevelMutexInfo::s_currentMutex = nullptr;
unsigned int ::Loki::MutexSleepWaits::sleepTime = 1;
@ -116,7 +117,7 @@ unsigned int GetLevel( const ::Loki::LevelMutexInfo::MutexContainer & mutexes )
// ----------------------------------------------------------------------------
}; // end anonymous namespace
} // end anonymous namespace
namespace Loki
{
@ -991,8 +992,8 @@ const char * MutexException::what( void ) const throw ()
// ----------------------------------------------------------------------------
MutexLocker::MutexLocker( volatile LevelMutexInfo & mutex, bool lock ) :
m_mutex( mutex ),
m_locked( false )
m_locked( false ),
m_mutex( mutex )
{
assert( nullptr != this );
if ( !lock )
@ -1007,8 +1008,8 @@ MutexLocker::MutexLocker( volatile LevelMutexInfo & mutex, bool lock ) :
MutexLocker::MutexLocker( volatile LevelMutexInfo & mutex, unsigned int milliSeconds,
bool lock ) :
m_mutex( mutex ),
m_locked( false )
m_locked( false ),
m_mutex( mutex )
{
assert( nullptr != this );
if ( !lock )
@ -1068,8 +1069,8 @@ bool MutexLocker::Unlock( void )
MultiMutexLocker::MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes,
bool lock ) :
m_mutexes( mutexes ),
m_locked( false )
m_locked( false ),
m_mutexes( mutexes )
{
assert( nullptr != this );
if ( !lock )
@ -1085,8 +1086,8 @@ MultiMutexLocker::MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes,
MultiMutexLocker::MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes,
unsigned int milliSeconds, bool lock ) :
m_mutexes( mutexes ),
m_locked( false )
m_locked( false ),
m_mutexes( mutexes )
{
assert( nullptr != this );
if ( !lock )
@ -1145,4 +1146,4 @@ bool MultiMutexLocker::Unlock( void )
// ----------------------------------------------------------------------------
}; // end namespace Loki
} // end namespace Loki

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// The Loki Library
// Copyright (c) 2006 Peter Kümmel
// Copyright (c) 2006 Peter K<EFBFBD>mmel
// Permission to use, copy, modify, distribute and sell this software for any
// purpose is hereby granted without fee, provided that the above copyright
// notice appear in all copies and that both that copyright notice and this
@ -200,7 +200,13 @@ void User::AddFriendGuardedMacros(User&)
&User::CheckIfValid, __FUNCTION__, __LINE__ );
(void)invariantGuard;
LOKI_ON_BLOCK_EXIT_OBJ(friends_, &UserCont::pop_back); (void) LOKI_ANONYMOUS_VARIABLE(scopeGuard);
// GCC 4.2 Bug
#if defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10 + __GNUC_MINOR__ * 1)
#endif
#if !defined(__GNUC__) || (GCC_VERSION < 42) || (GCC_VERSION > 42)
LOKI_ON_BLOCK_EXIT(Decrement, Loki::ByRef(fCount)); (void) LOKI_ANONYMOUS_VARIABLE(scopeGuard);
#endif
}
void DoStandaloneFunctionTests()