Nice.
This commit is contained in:
@@ -39,39 +39,16 @@ struct SourceLocation {
|
||||
|
||||
} // namespace ds
|
||||
|
||||
// Define assertion macros with different behaviors based on build configuration
|
||||
#if defined(NDEBUG) && !defined(DS_ENABLE_RELEASE_ASSERTS)
|
||||
// Assertions disabled in release builds by default
|
||||
#define ASSERT(condition) ((void)0)
|
||||
#define ASSERT_MSG(condition, message) ((void)0)
|
||||
#else
|
||||
// Standard assertion
|
||||
#define ASSERT(condition) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
ds::assert_fail(#condition, DS_CURRENT_LOCATION); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
// Assertion with custom message
|
||||
#define ASSERT_MSG(condition, message) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
ds::assert_fail(#condition, DS_CURRENT_LOCATION, message); \
|
||||
} \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
// Always-active assertion for critical checks, even in release builds
|
||||
#define ASSERT_ALWAYS(condition) \
|
||||
// Standard assertion
|
||||
#define ASSERT(condition) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
ds::assert_fail(#condition, DS_CURRENT_LOCATION); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
// Always-active assertion with custom message for critical checks
|
||||
#define ASSERT_ALWAYS_MSG(condition, message) \
|
||||
|
||||
// Assertion with custom message
|
||||
#define ASSERT_MSG(condition, message) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
ds::assert_fail(#condition, DS_CURRENT_LOCATION, message); \
|
||||
|
Reference in New Issue
Block a user