Skip to content

Commit ee7b555

Browse files
Simplify some changes
1 parent b54ee4e commit ee7b555

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

infra/util/ReallyAssert.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "infra/util/ReallyAssert.hpp"
22
#include "infra/util/LogAndAbort.hpp"
33

4+
#if INFRA_UTIL_REALLY_ASSERT_LOGGING_ENABLED
45
namespace infra
56
{
67
static AssertionFailureHandler customHandler = nullptr;
@@ -18,3 +19,4 @@ namespace infra
1819
infra::ExecuteLogAndAbortHook("\nAssertion failed [%s] at %s:%d\n", condition, file, line);
1920
}
2021
}
22+
#endif

infra/util/ReallyAssert.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
#include <cstdlib>
88
#include <functional>
99

10+
#if defined(EMIL_HOST_BUILD) || defined(EMIL_ENABLE_REALLY_ASSERT_LOGGING)
11+
#define INFRA_UTIL_REALLY_ASSERT_LOGGING_ENABLED 1
12+
#else
13+
#define INFRA_UTIL_REALLY_ASSERT_LOGGING_ENABLED 0
14+
#endif
15+
16+
#ifdef INFRA_UTIL_REALLY_ASSERT_LOGGING_ENABLED
1017
namespace infra
1118
{
1219
using AssertionFailureHandler = std::function<void(const char* condition, const char* file, int line)>;
@@ -16,9 +23,9 @@ namespace infra
1623
void HandleAssertionFailure(const char* condition, const char* file, int line);
1724
}
1825

19-
#if defined(EMIL_HOST_BUILD) || defined(EMIL_ENABLE_LOG_AND_ABORT_LOGGING)
2026
#define INFRA_UTIL_REALLY_ASSERT_TRIGGER(condition) \
2127
infra::HandleAssertionFailure(#condition, __FILE__, __LINE__)
28+
2229
#else
2330
#define INFRA_UTIL_REALLY_ASSERT_TRIGGER(condition)
2431
#endif

0 commit comments

Comments
 (0)