From a141c401f78467bc15f62882fca5d55a007cacbb Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 17 Feb 2025 00:21:48 +0100 Subject: Reorganize everything --- asl/base/assert.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 asl/base/assert.hpp (limited to 'asl/base/assert.hpp') diff --git a/asl/base/assert.hpp b/asl/base/assert.hpp new file mode 100644 index 0000000..42e8635 --- /dev/null +++ b/asl/base/assert.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include "asl/base/config.hpp" +#include "asl/base/meta.hpp" + +namespace asl +{ + +void report_assert_failure(const char* msg, const source_location& sl = source_location{}); + +} // namespace asl + +#if ASL_COMPILER_CLANG_CL + #define ASL_DEBUG_BREAK() __debugbreak() +#elif ASL_COMPILER_CLANG + #define ASL_DEBUG_BREAK() __builtin_debugtrap() +#endif + +#define ASL_ASSERT(...) \ + if (__VA_ARGS__) {} \ + else \ + { \ + ::asl::report_assert_failure(#__VA_ARGS__); \ + ASL_DEBUG_BREAK(); \ + } + +#define ASL_ASSERT_RELEASE(...) \ + if (__VA_ARGS__) {} \ + else \ + { \ + ::asl::report_assert_failure(#__VA_ARGS__); \ + ASL_DEBUG_BREAK(); \ + } -- cgit