mirror of
https://github.com/bkaradzic/bx.git
synced 2026-06-08 11:13:49 +00:00
Suppress MSVC CRT assert dialogs. (#395)
This commit is contained in:
committed by
GitHub
parent
217823bc0a
commit
eed706fb27
28
tests/test.h
28
tests/test.h
@@ -11,20 +11,26 @@
|
||||
// Override bx asserts in test builds: failing asserts throw std::exception so that Catch2's
|
||||
// REQUIRE_ASSERTS (REQUIRE_THROWS) can catch them.
|
||||
#if BX_CONFIG_DEBUG
|
||||
# define BX_ASSERT(_condition, ...) \
|
||||
do { \
|
||||
if (!(_condition) ) \
|
||||
{ \
|
||||
throw ::std::exception(); \
|
||||
} \
|
||||
# define BX_ASSERT(_condition, ...) \
|
||||
do { \
|
||||
if (!(_condition) ) \
|
||||
{ \
|
||||
BX_PRAGMA_DIAGNOSTIC_PUSH(); \
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4297); \
|
||||
throw ::std::exception(); \
|
||||
BX_PRAGMA_DIAGNOSTIC_POP(); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
# define BX_ASSERT_LOC(_location, _condition, ...) \
|
||||
do { \
|
||||
(void)(_location); \
|
||||
if (!(_condition) ) \
|
||||
{ \
|
||||
throw ::std::exception(); \
|
||||
do { \
|
||||
(void)(_location); \
|
||||
if (!(_condition) ) \
|
||||
{ \
|
||||
BX_PRAGMA_DIAGNOSTIC_PUSH(); \
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4297); \
|
||||
throw ::std::exception(); \
|
||||
BX_PRAGMA_DIAGNOSTIC_POP(); \
|
||||
} \
|
||||
} while (false)
|
||||
#endif // BX_CONFIG_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user