Changes for Linux.

This commit is contained in:
LuisAntonRebollo 2015-01-18 21:35:11 +01:00
parent aa35157eef
commit 3336bffad2
30 changed files with 99 additions and 173 deletions

View file

@ -78,6 +78,14 @@ public:
{ if ((x)==0) \
::PlatformAssert::processAssert(::PlatformAssert::Warning, __FILE__, __LINE__, y); }
/*!
Helper macro called when AssertFatal failed.
Used for help static code analyzers.
*/
#ifndef ON_FAIL_ASSERTFATAL
#define ON_FAIL_ASSERTFATAL
#endif
/*!
Assert that the statement x is true, otherwise halt.

View file

@ -21,6 +21,12 @@
// must ensure BIOS settings is not configured to restrict CPUID functionalities.
//-------------------------------------------------------------------------------------------------
#if defined(TORQUE_OS_LINUX) || defined(LINUX)
// TODO GCC code don't compile on Release with optimizations, mover code to platform layer
#else
#include "platform/platform.h"
#include "platform/platformCPUCount.h"
@ -666,3 +672,5 @@ next:
#endif
#endif
#endif

View file

@ -68,7 +68,7 @@ inline bool dCompareAndSwap( volatile U32& ref, U32 oldVal, U32 newVal )
#if defined(TORQUE_OS_PS3)
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
#elif !defined(TORQUE_OS_MAC)
return ( __sync_val_compare_and_swap( ( volatile long* ) &ref, oldVal, newVal ) == oldVal );
return ( __sync_val_compare_and_swap( &ref, oldVal, newVal ) == oldVal );
#else
return OSAtomicCompareAndSwap32(oldVal, newVal, (int32_t *) &ref);
#endif
@ -79,7 +79,7 @@ inline bool dCompareAndSwap( volatile U64& ref, U64 oldVal, U64 newVal )
#if defined(TORQUE_OS_PS3)
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
#elif !defined(TORQUE_OS_MAC)
return ( __sync_val_compare_and_swap( ( volatile long long* ) &ref, oldVal, newVal ) == oldVal );
return ( __sync_val_compare_and_swap( &ref, oldVal, newVal ) == oldVal );
#else
return OSAtomicCompareAndSwap64(oldVal, newVal, (int64_t *) &ref);
#endif

View file

@ -30,8 +30,13 @@
//--------------------------------------
// Types
#if TORQUE_X86
typedef signed long long S64;
typedef unsigned long long U64;
#else
typedef signed long S64;
typedef unsigned long U64;
#endif
//--------------------------------------
@ -73,11 +78,11 @@ typedef unsigned long long U64;
# define TORQUE_OS_PS3
# include "platform/types.posix.h"
#elif defined(linux)
#elif defined(linux) || defined(LINUX)
# define TORQUE_OS_STRING "Linux"
# define TORQUE_OS_LINUX
# define TORQUE_SUPPORTS_NASM
# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
//# define TORQUE_SUPPORTS_NASM
//# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
# include "platform/types.posix.h"
#elif defined(__OpenBSD__)
@ -115,6 +120,11 @@ typedef unsigned long long U64;
# define TORQUE_CPU_X86
# define TORQUE_LITTLE_ENDIAN
#elif defined(__x86_64__)
# define TORQUE_CPU_STRING "Intel x64"
# define TORQUE_CPU_X64
# define TORQUE_LITTLE_ENDIAN
#elif defined(__ppc__)
# define TORQUE_CPU_STRING "PowerPC"
# define TORQUE_CPU_PPC

View file

@ -29,7 +29,8 @@
// size_t is needed to overload new
// size_t tends to be OS and compiler specific and may need to
// be if/def'ed in the future
typedef unsigned int dsize_t;
#include <stddef.h>
typedef size_t dsize_t;
/** Platform dependent file date-time structure. The defination of this structure