tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
assert.hpp File Reference

Go to the source code of this file.

Classes

struct  assert_msg
 Payload for an assertion. More...
 

Namespaces

namespace  etl
 

Macros

#define TETL_ASSERT(...)   TETL_ASSERT_IMPL(__VA_ARGS__)
 
#define TETL_ASSERT_IMPL(...)
 

Functions

template<typename Assertion >
auto assert_handler (Assertion const &msg) -> void
 
auto exit (int) -> void
 

Macro Definition Documentation

◆ TETL_ASSERT

#define TETL_ASSERT (   ...)    TETL_ASSERT_IMPL(__VA_ARGS__)

◆ TETL_ASSERT_IMPL

#define TETL_ASSERT_IMPL (   ...)
Value:
do { \
if (not(__VA_ARGS__)) [[unlikely]] { \
/* TETL_DEBUG_TRAP(); */ \
etl::assert_handler( \
.line = __LINE__, \
.file = __FILE__, \
.func = etl::is_hosted() ? TETL_BUILTIN_FUNCTION() : nullptr, \
.expression = etl::is_hosted() ? TETL_STRINGIFY((__VA_ARGS__)) : nullptr, \
} \
); \
} \
} while (false)
#define TETL_BUILTIN_FUNCTION()
Definition builtin_functions.hpp:28
Definition adjacent_find.hpp:9
consteval auto is_hosted() noexcept -> bool
Definition implementation.hpp:20
#define TETL_STRINGIFY(str)
Definition preprocessor.hpp:28
Payload for an assertion.
Definition assert.hpp:22
int line
Definition assert.hpp:23

Function Documentation

◆ exit()

auto exit ( int  ) -> void
inline
Examples
cassert.cpp.