diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-17 19:42:29 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-17 19:42:29 -0500 |
commit | 8249b28bea29e8ce17eac12776a60ec3f9e47176 (patch) | |
tree | 98318d7564b5f618cfb59e23cc6b918fcab88ee8 /include/fud_assert.hpp | |
parent | b32e83ece42cec5aa9dee370bcdf349d23dbc8ba (diff) |
Rename InvalidInput to ArgumentInvalid.
Diffstat (limited to 'include/fud_assert.hpp')
-rw-r--r-- | include/fud_assert.hpp | 13 |
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()); |