Added clang-tidy config and cleaned up the code a little.
This commit is contained in:
@@ -58,30 +58,33 @@ MIJIN_ERROR(msg) \
|
||||
std::abort()
|
||||
|
||||
// TODO: make ignoreAll work (static variables cannot be used in constexpr functions)
|
||||
#define MIJIN_ASSERT(condition, msg) \
|
||||
if (!static_cast<bool>(condition)) \
|
||||
{ \
|
||||
/* static bool ignoreAll = false; */ \
|
||||
if (true) /*!ignoreAll */ \
|
||||
{ \
|
||||
const mijin::AssertionResult assertion_result__ = mijin::handleAssert( \
|
||||
#condition, msg, std::source_location::current()); \
|
||||
switch (assertion_result__) \
|
||||
{ \
|
||||
case mijin::AssertionResult::ABORT: \
|
||||
std::abort(); \
|
||||
break; \
|
||||
case mijin::AssertionResult::IGNORE: \
|
||||
/*break*/; \
|
||||
case mijin::AssertionResult::IGNORE_ALL: \
|
||||
/* ignoreAll = true; */ \
|
||||
break; \
|
||||
default: /* ERROR */ \
|
||||
MIJIN_ERROR("Debug assertion failed: " #condition "\nMessage: " msg); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#define MIJIN_ASSERT(condition, msg) \
|
||||
do \
|
||||
{ \
|
||||
if (!static_cast<bool>(condition)) \
|
||||
{ \
|
||||
/* static bool ignoreAll = false; */ \
|
||||
if (true) /*!ignoreAll */ \
|
||||
{ \
|
||||
const mijin::AssertionResult assertion_result__ = mijin::handleAssert( \
|
||||
#condition, msg, std::source_location::current()); \
|
||||
switch (assertion_result__) \
|
||||
{ \
|
||||
case mijin::AssertionResult::ABORT: \
|
||||
std::abort(); \
|
||||
break; \
|
||||
case mijin::AssertionResult::IGNORE: \
|
||||
/*break*/; \
|
||||
case mijin::AssertionResult::IGNORE_ALL: \
|
||||
/* ignoreAll = true; */ \
|
||||
break; \
|
||||
default: /* ERROR */ \
|
||||
MIJIN_ERROR("Debug assertion failed: " #condition "\nMessage: " msg); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while(false)
|
||||
|
||||
#define MIJIN_ASSERT_FATAL(condition, msg) \
|
||||
if (!static_cast<bool>(condition)) \
|
||||
|
||||
Reference in New Issue
Block a user