From c8f8d6c459412b039663c9e6cbcd525922f0e096 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 27 Dec 2012 21:36:58 -0500 Subject: [PATCH 1/3] Revert "war on -Werror, part 9: static inline > macros." This reverts commit d080c38196cb8cc9961637287806b5188d518f3d. ...partly. Still have to adjust things. --- src/global.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/global.h b/src/global.h index a28cae9360..24f0c5188f 100644 --- a/src/global.h +++ b/src/global.h @@ -127,22 +127,10 @@ void NORETURN sm_crash( const char *reason = "Internal error" ); * This should probably be used instead of throwing an exception in most * cases we expect never to happen (but not in cases that we do expect, * such as DSound init failure.) */ -static inline void NORETURN _FAIL_M(const char * file, int line, const char * message) -{ - _CHECKPOINT_M(file, line, message); - sm_crash(message); -} +#define FAIL_M(MESSAGE) do { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); } while(0) +#define ASSERT_M(COND, MESSAGE) do { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } while(0) #define FAIL_M(m) (_FAIL_M(__FILE__, __LINE__, m)) - -static inline void _ASSERT_M(const char * file, int line, bool cond, const char * message) -{ - if (unlikely(!(cond))) - { - _FAIL_M(file, line, message); - } -} #define ASSERT_M(c, m) (_ASSERT_M(__FILE__, __LINE__, c, m)) - #if !defined(CO_EXIST_WITH_MFC) #define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed") #endif From f8865e8de3f0c0f315a4c9dece0d66b6a24eab19 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 27 Dec 2012 21:38:42 -0500 Subject: [PATCH 2/3] Revert "fix file/line numbers in ASSERT_M/FAIL_M" This reverts commit 376056a0cf419cfa260efec43214bfed5b140258. Time to test before sending up. --- src/RageThreads.h | 6 ++---- src/global.h | 12 +++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/RageThreads.h b/src/RageThreads.h index fbe99b86b5..1fc7c7f49f 100644 --- a/src/RageThreads.h +++ b/src/RageThreads.h @@ -79,10 +79,8 @@ namespace Checkpoints void GetLogs( char *pBuf, int iSize, const char *delim ); }; -/* Keep this section synchronized with global.h until refactored */ -#define _CHECKPOINT_M(f, l, m) (Checkpoints::SetCheckpoint(f, l, m)) -#define CHECKPOINT_M(m) (_CHECKPOINT_M(__FILE__, __LINE__, m)) -#define CHECKPOINT (_CHECKPOINT_M(__FILE__, __LINE__, NULL)) +#define CHECKPOINT (Checkpoints::SetCheckpoint(__FILE__, __LINE__, NULL)) +#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m)) /* Mutex class that follows the behavior of Windows mutexes: if the same * thread locks the same mutex twice, we just increase a refcount; a mutex diff --git a/src/global.h b/src/global.h index 24f0c5188f..f6f22593c0 100644 --- a/src/global.h +++ b/src/global.h @@ -82,17 +82,15 @@ using namespace std; #undef ASSERT #endif -/* Keep this section synchronized with RageThreads.h until refactored */ /** @brief RageThreads defines (don't pull in all of RageThreads.h here) */ namespace Checkpoints { void SetCheckpoint( const char *file, int line, const char *message ); } -/** @brief Set a checkpoint with a specified message. */ -#define _CHECKPOINT_M(f, l, m) (Checkpoints::SetCheckpoint(f, l, m)) -#define CHECKPOINT_M(m) (_CHECKPOINT_M(__FILE__, __LINE__, m)) /** @brief Set a checkpoint with no message. */ -#define CHECKPOINT (_CHECKPOINT_M(__FILE__, __LINE__, NULL)) +#define CHECKPOINT (Checkpoints::SetCheckpoint(__FILE__, __LINE__, NULL)) +/** @brief Set a checkpoint with a specified message. */ +#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m)) /** @@ -129,8 +127,8 @@ void NORETURN sm_crash( const char *reason = "Internal error" ); * such as DSound init failure.) */ #define FAIL_M(MESSAGE) do { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); } while(0) #define ASSERT_M(COND, MESSAGE) do { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } while(0) -#define FAIL_M(m) (_FAIL_M(__FILE__, __LINE__, m)) -#define ASSERT_M(c, m) (_ASSERT_M(__FILE__, __LINE__, c, m)) + + #if !defined(CO_EXIST_WITH_MFC) #define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed") #endif From f94302c02a8c2a8b8c9285051c3cff74bb4c9d89 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Thu, 27 Dec 2012 19:01:26 -0800 Subject: [PATCH 3/3] Fix line endings. --- src/Font.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index d2f7df7e8e..a2f9824993 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -285,15 +285,15 @@ void Font::MergeFont(Font &f) const glyph &Font::GetGlyph( wchar_t c ) const { - /* XXX: This is kind of nasty, but the parts that touch this are dark and - * scary. --Colby - * - * Snagged from OpenITG, original comment: - * shooting a blank really...DarkLink kept running into the stupid assert - * with non-roman song titles, and looking at it, I'm gonna guess that - * this is how ITG2 prevented crashing with them --infamouspat */ - //ASSERT(c >= 0 && c <= 0xFFFFFF); - if (c < 0 || c > 0xFFFFFF) + /* XXX: This is kind of nasty, but the parts that touch this are dark and + * scary. --Colby + * + * Snagged from OpenITG, original comment: + * shooting a blank really...DarkLink kept running into the stupid assert + * with non-roman song titles, and looking at it, I'm gonna guess that + * this is how ITG2 prevented crashing with them --infamouspat */ + //ASSERT(c >= 0 && c <= 0xFFFFFF); + if (c < 0 || c > 0xFFFFFF) c = 1; // Fast path: