diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-20 23:13:37 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-20 23:13:37 +0100 |
commit | 409ef997e2ff99b2bbea89ea61d10fc8e26dac96 (patch) | |
tree | 103225ce6af074120731ce9bb3c16a3778687d6c /asl/base/assert.hpp | |
parent | 6fd19d6dfe2c9780ce268de4205300ede4a16b89 (diff) |
Add customizable assert failure handler
Diffstat (limited to 'asl/base/assert.hpp')
-rw-r--r-- | asl/base/assert.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/asl/base/assert.hpp b/asl/base/assert.hpp index 42e8635..d23e897 100644 --- a/asl/base/assert.hpp +++ b/asl/base/assert.hpp @@ -6,6 +6,10 @@ namespace asl { +using AssertFailureHandler = void (const char* msg, const source_location&, void* user); + +void set_assert_failure_handler(AssertFailureHandler handler, void* user); + void report_assert_failure(const char* msg, const source_location& sl = source_location{}); } // namespace asl @@ -16,6 +20,8 @@ void report_assert_failure(const char* msg, const source_location& sl = source_l #define ASL_DEBUG_BREAK() __builtin_debugtrap() #endif +// @Todo Configure asserts at build time + #define ASL_ASSERT(...) \ if (__VA_ARGS__) {} \ else \ |