IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
assert.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/log.hxx>
6
7#ifdef assert
8#error Assert is defined!
9#endif
10
11namespace ice::detail
12{
13
14 void assert(
15 ice::String condition,
16 ice::String message,
17 fmt::format_args args,
19 ) noexcept;
20
21 void terminate() noexcept;
22
23} // namespace ice
24
25#if defined ICE_ASSERT
26#error "Found existing definition of 'ICE_ASSERT'!"
27#endif
28
29#define ICE_ASSERT(condition, message, ...) \
30 do{ \
31 if constexpr(ice::LogSeverity::Error <= ice::lowest_compiled_log_severity) \
32 { \
33 if (!(condition)) \
34 { \
35 ice::detail::assert( \
36 #condition, \
37 message, \
38 ice::detail::log_make_args(__VA_ARGS__), \
39 ice::detail::LogLocation{ .file = __FILE__, .line = __LINE__ } \
40 ); \
41 ice::detail::terminate(); \
42 } \
43 } \
44 } while(false)
Definition hashmap_details.hxx:13
void assert(ice::String condition, ice::String message, fmt::format_args args, ice::detail::LogLocation location) noexcept
void terminate() noexcept
ice::BasicString< char > String
Definition string.hxx:82
Definition log.hxx:15