mirror of https://github.com/PCSX2/pcsx2.git
common: various warning fix
* Use c++11 static assert * Properly cast to parameter template to u32 (help clang) * Remove lots of useless ASM. Memset it only used with a size of 4096. * check pthread_mutex_init status
This commit is contained in:
parent
c73ce3d02d
commit
79f6aacc85
|
@ -77,7 +77,11 @@ extern "C" unsigned __int64 __xgetbv(int);
|
|||
// restaints must be enforced).
|
||||
//
|
||||
#ifndef C_ASSERT
|
||||
# define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
|
||||
#ifdef __LINUX__
|
||||
# define C_ASSERT(e) static_assert(e, "this is a nice message to explain the failure ;)")
|
||||
#else
|
||||
# define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -51,8 +51,10 @@ static __fi void memset8( T& obj )
|
|||
// Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset.
|
||||
if( (sizeof(T) & 0x3) != 0 )
|
||||
memset( &obj, data, sizeof( T ) );
|
||||
else
|
||||
memset32<data + (data<<8) + (data<<16) + (data<<24)>( obj );
|
||||
else {
|
||||
const u32 data32 = data + (data<<8) + (data<<16) + (data<<24);
|
||||
memset32<data32>( obj );
|
||||
}
|
||||
}
|
||||
|
||||
template< u16 data, typename T >
|
||||
|
@ -60,8 +62,10 @@ static __fi void memset16( T& obj )
|
|||
{
|
||||
if( (sizeof(T) & 0x3) != 0 )
|
||||
_memset16_unaligned( &obj, data, sizeof( T ) );
|
||||
else
|
||||
memset32<data + (data<<16)>( obj );
|
||||
else {
|
||||
const u32 data32 = data + (data<<16);
|
||||
memset32<data32>( obj );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,6 +96,7 @@ static __fi void memset_8( void *dest )
|
|||
// macro to execute the x86/32 "stosd" copies.
|
||||
switch( remdat )
|
||||
{
|
||||
#if 0
|
||||
case 1:
|
||||
*(u32*)dest = data32;
|
||||
return;
|
||||
|
@ -157,6 +162,7 @@ static __fi void memset_8( void *dest )
|
|||
|
||||
);
|
||||
return;
|
||||
#endif
|
||||
|
||||
default:
|
||||
__asm__ volatile
|
||||
|
|
|
@ -77,8 +77,8 @@ Threading::MutexRecursive::MutexRecursive() : Mutex( false )
|
|||
pthread_mutexattr_settype( &_attr_recursive, PTHREAD_MUTEX_RECURSIVE );
|
||||
}
|
||||
|
||||
int err = 0;
|
||||
err = pthread_mutex_init( &m_mutex, &_attr_recursive );
|
||||
if (pthread_mutex_init( &m_mutex, &_attr_recursive ));
|
||||
Console.Error( "(Thread Log) Failed to initialize mutex.");
|
||||
}
|
||||
|
||||
Threading::MutexRecursive::~MutexRecursive() throw()
|
||||
|
|
Loading…
Reference in New Issue