summaryrefslogtreecommitdiff
path: root/include/fud_assert.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_assert.hpp')
-rw-r--r--include/fud_assert.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/fud_assert.hpp b/include/fud_assert.hpp
index 6b21fdc..ecfaa2f 100644
--- a/include/fud_assert.hpp
+++ b/include/fud_assert.hpp
@@ -22,9 +22,22 @@
// #include <stacktrace>
#include <source_location>
+#include "fud_span.hpp"
namespace fud {
+constexpr std::size_t MAX_FILE_CHARS = 256;
+constexpr std::size_t MAX_FUNCTION_CHARS = 256;
+constexpr std::size_t BITS_PER_OCTAL = 3;
+constexpr auto MAX_LINE_CHARS = BITS_PER_OCTAL * sizeof(decltype(std::source_location{}.line())) + 3;
+constexpr std::size_t MAX_ASSERT_CHARS = 512 - MAX_LINE_CHARS;
+constexpr std::size_t ASSERT_MSG_SIZE = MAX_FILE_CHARS + MAX_LINE_CHARS + MAX_FUNCTION_CHARS + MAX_ASSERT_CHARS;
+
+void assertFormat(
+ const char* assertion,
+ std::source_location sourceLocation,
+ Span<char, ASSERT_MSG_SIZE> buffer);
+
[[noreturn]] void assertFail(
const char* assertion,
std::source_location sourceLocation = std::source_location::current());