first commit
This commit is contained in:
35
include/platform/assert/nassert.h
Normal file
35
include/platform/assert/nassert.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NASSERT__
|
||||
#define __NASSERT__
|
||||
|
||||
|
||||
namespace GS {
|
||||
namespace Assert {
|
||||
|
||||
/// Trigger a system assertion.
|
||||
extern void Trigger(const char *source, int line, const char *condition, const char *message = 0);
|
||||
|
||||
} // Assert
|
||||
} // GS
|
||||
|
||||
// Portable assert.
|
||||
#ifdef _DEBUG
|
||||
#define __ASSERT__(_EXP_) if (!(_EXP_)) GS::Assert::Trigger(__FILE__, __LINE__, #_EXP_)
|
||||
#define __ASSERT_MSG__(_EXP_, _MSG_) if (!(_EXP_)) GS::Assert::Trigger(__FILE__, __LINE__, #_EXP_, _MSG_)
|
||||
#define __ASSERT_ALWAYS__ GS::Assert::Trigger(__FILE__, __LINE__, "Unconditional")
|
||||
#else
|
||||
#define __ASSERT__(_EXP_)
|
||||
#define __ASSERT_MSG__(_EXP_, _MSG_)
|
||||
#define __ASSERT_ALWAYS__
|
||||
#endif
|
||||
|
||||
#define __RASSERT__(_EXP_) if (!(_EXP_)) GS::Assert::Trigger(__FILE__, __LINE__, #_EXP_)
|
||||
#define __RASSERT_MSG__(_EXP_, _MSG_) if (!(_EXP_)) GS::Assert::Trigger(__FILE__, __LINE__, #_EXP_, _MSG_)
|
||||
|
||||
|
||||
#endif // __NASSERT__
|
||||
Reference in New Issue
Block a user