From 409ef997e2ff99b2bbea89ea61d10fc8e26dac96 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 20 Feb 2025 23:13:37 +0100 Subject: Add customizable assert failure handler --- asl/base/assert.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'asl/base/assert.hpp') 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 \ -- cgit