From 19f872161e648de2dd59f88b676760d384e92756 Mon Sep 17 00:00:00 2001 From: castano Date: Mon, 20 Sep 2010 06:58:20 +0000 Subject: [PATCH] Use posh typedefs. Enable stacktraces on OS X. --- src/nvcore/Debug.cpp | 5 +++-- src/nvcore/DefsGnucDarwin.h | 7 ++++--- src/nvcore/DefsGnucLinux.h | 6 ++++-- src/nvcore/DefsGnucWin32.h | 6 ++++-- src/nvcore/DefsVcWin32.h | 3 ++- src/nvcore/nvcore.h | 19 ++++++++++++++++++- 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/nvcore/Debug.cpp b/src/nvcore/Debug.cpp index b674778..7bd071c 100644 --- a/src/nvcore/Debug.cpp +++ b/src/nvcore/Debug.cpp @@ -40,7 +40,6 @@ # include # include // sysctl # include -# undef HAVE_EXECINFO_H # if defined(HAVE_EXECINFO_H) // only after OSX 10.5 # include // backtrace # if NV_CC_GNUC // defined(HAVE_CXXABI_H) @@ -267,7 +266,7 @@ namespace #elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_DARWIN -#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX +#if defined(HAVE_EXECINFO_H) static bool hasStackTrace() { #if NV_OS_DARWIN @@ -586,12 +585,14 @@ void NV_CDECL nvDebugPrint(const char *msg, ...) /// Dump debug info. void debug::dumpInfo() { +#if NV_OS_WIN32 || (defined(HAVE_SIGNAL_H) && defined(HAVE_EXECIINFO_H)) if (hasStackTrace()) { void * trace[64]; int size = backtrace(trace, 64); printStackTrace(trace, size, 1); } +#endif } diff --git a/src/nvcore/DefsGnucDarwin.h b/src/nvcore/DefsGnucDarwin.h index 615823f..d055e77 100644 --- a/src/nvcore/DefsGnucDarwin.h +++ b/src/nvcore/DefsGnucDarwin.h @@ -2,8 +2,8 @@ #error "Do not include this file directly." #endif -#include // uint8_t, int8_t, ... -#include // size_t, NULL +//#include // uint8_t, int8_t, ... +//#include // size_t, NULL // Function linkage #define DLL_IMPORT @@ -51,7 +51,7 @@ #define restrict __restrict__ - +/* // Type definitions typedef uint8_t uint8; typedef int8_t int8; @@ -67,3 +67,4 @@ typedef int64_t int64; // Aliases typedef uint32 uint; +*/ \ No newline at end of file diff --git a/src/nvcore/DefsGnucLinux.h b/src/nvcore/DefsGnucLinux.h index 4fb04b0..1451232 100644 --- a/src/nvcore/DefsGnucLinux.h +++ b/src/nvcore/DefsGnucLinux.h @@ -2,7 +2,7 @@ #error "Do not include this file directly." #endif -#include // size_t, NULL +//#include // size_t, NULL // Function linkage #define DLL_IMPORT @@ -51,7 +51,7 @@ #define restrict __restrict__ - +/* // Type definitions typedef unsigned char uint8; typedef signed char int8; @@ -67,3 +67,5 @@ typedef signed long long int64; // Aliases typedef uint32 uint; +*/ + diff --git a/src/nvcore/DefsGnucWin32.h b/src/nvcore/DefsGnucWin32.h index f0d18e2..877545e 100644 --- a/src/nvcore/DefsGnucWin32.h +++ b/src/nvcore/DefsGnucWin32.h @@ -2,7 +2,7 @@ #error "Do not include this file directly." #endif -#include // size_t, NULL +//#include // size_t, NULL // Function linkage #define DLL_IMPORT __declspec(dllimport) @@ -45,7 +45,7 @@ #define restrict __restrict__ - +/* // Type definitions typedef unsigned char uint8; typedef signed char int8; @@ -61,3 +61,5 @@ typedef signed long long int64; // Aliases typedef uint32 uint; +*/ + diff --git a/src/nvcore/DefsVcWin32.h b/src/nvcore/DefsVcWin32.h index be58f39..785922d 100644 --- a/src/nvcore/DefsVcWin32.h +++ b/src/nvcore/DefsVcWin32.h @@ -44,6 +44,7 @@ #define NV_NOINLINE __declspec(noinline) +/* // Type definitions typedef unsigned char uint8; typedef signed char int8; @@ -59,7 +60,7 @@ typedef signed __int64 int64; // Aliases typedef uint32 uint; - +*/ // Unwanted VC++ warnings to disable. /* diff --git a/src/nvcore/nvcore.h b/src/nvcore/nvcore.h index f77a95a..ebbf815 100644 --- a/src/nvcore/nvcore.h +++ b/src/nvcore/nvcore.h @@ -102,6 +102,23 @@ #define NV_ENDIAN_STRING POSH_ENDIAN_STRING +// Type definitions: +typedef posh_u8_t uint8; +typedef posh_i8_t int8; + +typedef posh_u16_t uint16; +typedef posh_i16_t int16; + +typedef posh_u32_t uint32; +typedef posh_i32_t int32; + +typedef posh_u64_t uint64; +typedef posh_i64_t int64; + +// Aliases +typedef uint32 uint; + + // Version string: #define NV_VERSION_STRING \ NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \ @@ -152,7 +169,7 @@ #define NV_UNUSED(a) ((a)=(a)) /// Null index. @@ Move this somewhere else... it's only used by nvmesh. -const unsigned int NIL = unsigned int(~0); +//const unsigned int NIL = unsigned int(~0); /// Null pointer. #ifndef NULL