1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-22 09:38:56 +08:00

Merge pull request #57 from maximsmol/fix_mac_debug_werror

sdk2013: Mac: debug: fix compilation with -Werror
This commit is contained in:
David Anderson 2019-03-26 12:04:39 +09:00 committed by GitHub
commit 46713a22a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -566,8 +566,16 @@ public:
// We're using an ancient version of GCC that can't quite handle some
// of our complicated templates properly. Use some preprocessor trickery
// to workaround this
#ifdef __GNUC__
#define COMPILE_TIME_ASSERT( pred ) typedef int UNIQUE_ID[ (pred) ? 1 : -1 ]
#ifndef __has_feature
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#if __has_feature(cxx_static_assert)
// If available use static_assert instead of weird language tricks. This
// leads to much more readable messages when compile time assert constraints
// are violated.
#define COMPILE_TIME_ASSERT( pred ) static_assert( pred, "Compile time assert constraint is not true: " #pred )
#elif defined __GNUC__
#define COMPILE_TIME_ASSERT( pred ) typedef int UNIQUE_ID[ (pred) ? 1 : -1 ] __attribute__((unused))
#else
#if _MSC_VER >= 1600
// If available use static_assert instead of weird language tricks. This

View File

@ -427,7 +427,7 @@ typedef void * HINSTANCE;
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
// So if being debugged, use INT3 which is precise.
#ifdef OSX
#define DebuggerBreak() if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); }
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while (0)
#else
#define DebuggerBreak() raise(SIGTRAP)
#endif

View File

@ -337,7 +337,6 @@ void CUtlBlockMemory<T,I>::Purge( int numElements )
}
int nBlockSize = NumElementsInBlock();
int nBlocksOld = m_nBlocks;
int nBlocks = ( numElements + nBlockSize - 1 ) / nBlockSize;
// If the number of blocks is the same as the allocated number of blocks, we are done.