14#include <lagrange/api.h>
100 const char* function,
103 const char* condition,
104 std::string_view message);
114#define LA_INTERNAL_EXPAND(x) x
116#define LA_INTERNAL_NARG2(...) \
117 LA_INTERNAL_EXPAND(LA_INTERNAL_NARG1(__VA_ARGS__, LA_INTERNAL_RSEQN()))
118#define LA_INTERNAL_NARG1(...) LA_INTERNAL_EXPAND(LA_INTERNAL_ARGSN(__VA_ARGS__))
119#define LA_INTERNAL_ARGSN(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
120#define LA_INTERNAL_RSEQN() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
122#define LA_INTERNAL_FUNC2(name, n) name##n
123#define LA_INTERNAL_FUNC1(name, n) LA_INTERNAL_FUNC2(name, n)
125#define LA_INTERNAL_GET_MACRO(func, ...) \
126 LA_INTERNAL_EXPAND( \
127 LA_INTERNAL_FUNC1(func, LA_INTERNAL_EXPAND(LA_INTERNAL_NARG2(__VA_ARGS__)))(__VA_ARGS__))
131#if defined(__GNUC__) || defined(__clang__)
132#define LA_ASSERT_FUNCTION __PRETTY_FUNCTION__
133#elif defined(_MSC_VER)
134#define LA_ASSERT_FUNCTION __FUNCSIG__
135#elif defined(__SUNPRO_CC)
136#define LA_ASSERT_FUNCTION __func__
138#define LA_ASSERT_FUNCTION __FUNCTION__
146#define LA_INTERNAL_ASSERT_ARGS_2(condition, message) \
147 ((void)(!static_cast<bool>((condition)) && ::lagrange::assertion_failed(LA_ASSERT_FUNCTION, __FILE__, __LINE__, #condition, message)))
148#define LA_INTERNAL_ASSERT_ARGS_1(condition) LA_INTERNAL_ASSERT_ARGS_2(condition, "")
150#define LA_INTERNAL_IGNORE_ARGS_2(condition, message) ((void)(0))
151#define LA_INTERNAL_IGNORE_ARGS_1(condition) LA_INTERNAL_IGNORE_ARGS_2(condition, "")
168#ifndef la_runtime_assert
169#define la_runtime_assert(...) \
170 LA_INTERNAL_EXPAND(LA_INTERNAL_GET_MACRO(LA_INTERNAL_ASSERT_ARGS_, __VA_ARGS__))
184#ifndef la_debug_assert
186#define la_debug_assert(...) \
187 LA_INTERNAL_EXPAND(LA_INTERNAL_GET_MACRO(LA_INTERNAL_IGNORE_ARGS_, __VA_ARGS__))
189#define la_debug_assert(...) \
190 LA_INTERNAL_EXPAND(LA_INTERNAL_GET_MACRO(LA_INTERNAL_ASSERT_ARGS_, __VA_ARGS__))
LA_CORE_API bool assertion_failed(const char *function, const char *file, unsigned int line, const char *condition, std::string_view message)
Called in case of an assertion failure.
Definition: assert.cpp:73
LA_CORE_API void trigger_breakpoint()
Call to explicitly trigger a debugger breakpoint.
Definition: assert.cpp:65
LA_CORE_API bool is_breakpoint_enabled()
Returns whether to trigger a debugger breakpoint on assert failure.
Definition: assert.cpp:60
LA_CORE_API void set_breakpoint_enabled(bool enabled)
Sets whether to trigger a debugger breakpoint on assert failure.
Definition: assert.cpp:55
Main namespace for Lagrange.
Definition: AABBIGL.h:30