This commit is contained in:
Jonathan Payne
2012-12-27 21:47:40 -08:00
3 changed files with 16 additions and 32 deletions
+2 -4
View File
@@ -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
+5 -19
View File
@@ -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))
/**
@@ -127,21 +125,9 @@ 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(m) (_FAIL_M(__FILE__, __LINE__, m))
#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)
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")