HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
assert.hpp
1
// Copyright Take Vos 2020-2021.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#ifndef ASSERT_HPP
6
#define ASSERT_HPP
7
8
#pragma once
9
10
#include "os_detect.hpp"
11
#include "debugger.hpp"
12
#include "utils.hpp"
13
#include <exception>
14
15
namespace
tt {
16
21
#define tt_assert(expression, ...) \
22
do { \
23
if (!(expression)) { \
24
if constexpr (::tt::nr_arguments(__VA_ARGS__) == 0) { \
25
[[unlikely]] tt_debugger_abort(#expression); \
26
} else { \
27
[[unlikely]] tt_debugger_abort(__VA_ARGS__); \
28
} \
29
} \
30
} while (false)
31
32
#if TT_BUILD_TYPE == TT_BT_DEBUG
37
#define tt_axiom(expression, ...) tt_assert(expression __VA_OPT__(,) __VA_ARGS__)
38
42
#define tt_no_default() [[unlikely]] tt_debugger_abort("tt_no_default()")
43
44
#else
45
50
#define tt_axiom(expression, ...) tt_assume(expression)
51
55
#define tt_no_default() tt_unreachable()
56
#endif
57
61
#define tt_static_no_default() []<bool Flag = false>(){ static_assert(Flag); }()
62
66
#define tt_not_implemented() [[unlikely]] tt_debugger_abort("tt_not_implemented()")
67
68
}
// namespace tt
69
70
#endif
Generated on Mon Apr 22 2024 12:53:41 for HikoGUI by
1.10.0