Added clang-tidy config and cleaned up the code a little.

This commit is contained in:
2024-08-18 13:30:40 +02:00
parent 9f011952c2
commit 6d111904d4
7 changed files with 142 additions and 65 deletions

View File

@@ -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)) \