Add CHECK_DEBUG soft check for non-release builds
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_ASSERTION
|
#if ENABLE_ASSERTION
|
||||||
// Performs hard assertion of the expression. Crashes the engine and inserts debugger break in case of expression fail.
|
// Performs a hard assertion of the expression. Crashes the engine and triggers a debugger break if the expression fails.
|
||||||
#define ASSERT(expression) \
|
#define ASSERT(expression) \
|
||||||
if (!(expression)) \
|
if (!(expression)) \
|
||||||
{ \
|
{ \
|
||||||
@@ -46,24 +46,40 @@
|
|||||||
Platform::Assert(#expression, __FILE__, __LINE__); \
|
Platform::Assert(#expression, __FILE__, __LINE__); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
// Performs a hard assertion of the expression. Crashes the engine and triggers a debugger break if the expression fails.
|
||||||
#define ASSERT(expression) ((void)0)
|
#define ASSERT(expression) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
#if ENABLE_ASSERTION_LOW_LAYERS
|
#if ENABLE_ASSERTION_LOW_LAYERS
|
||||||
|
// Performs a hard assertion of the expression. Crashes the engine and triggers a debugger break if the expression fails.
|
||||||
#define ASSERT_LOW_LAYER(x) ASSERT(x)
|
#define ASSERT_LOW_LAYER(x) ASSERT(x)
|
||||||
#else
|
#else
|
||||||
|
// Performs a hard assertion of the expression. Crashes the engine and triggers a debugger break if the expression fails.
|
||||||
#define ASSERT_LOW_LAYER(x)
|
#define ASSERT_LOW_LAYER(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Performs soft check of the expression. Logs the expression fail to log and returns the function call.
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call.
|
||||||
#define CHECK(expression) \
|
#define CHECK(expression) \
|
||||||
if (!(expression)) \
|
if (!(expression)) \
|
||||||
{ \
|
{ \
|
||||||
Platform::CheckFailed(#expression, __FILE__, __LINE__); \
|
Platform::CheckFailed(#expression, __FILE__, __LINE__); \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call using the given return value.
|
||||||
#define CHECK_RETURN(expression, returnValue) \
|
#define CHECK_RETURN(expression, returnValue) \
|
||||||
if (!(expression)) \
|
if (!(expression)) \
|
||||||
{ \
|
{ \
|
||||||
Platform::CheckFailed(#expression, __FILE__, __LINE__); \
|
Platform::CheckFailed(#expression, __FILE__, __LINE__); \
|
||||||
return returnValue; \
|
return returnValue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_ASSERTION
|
||||||
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call.
|
||||||
|
#define CHECK_DEBUG(expression) CHECK(expression)
|
||||||
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call using the given return value.
|
||||||
|
#define CHECK_RETURN_DEBUG(expression, returnValue) CHECK_RETURN(expression, returnValue)
|
||||||
|
#else
|
||||||
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call.
|
||||||
|
#define CHECK_DEBUG(expression) ((void)0)
|
||||||
|
// Performs a soft check of the expression. Logs the expression failure and returns from the function call using the given return value.
|
||||||
|
#define CHECK_RETURN_DEBUG(expression, returnValue) ((void)0)
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user