9#include <userver/utils/impl/source_location.hpp>
11USERVER_NAMESPACE_BEGIN
18[[noreturn]]
void UASSERT_failed(
19 std::string_view expr,
26[[noreturn]]
void LogAndThrowInvariantError(
27 std::string_view condition,
28 std::string_view message,
29 utils::impl::SourceLocation source_location
33inline constexpr bool kEnableAssert =
false;
35inline constexpr bool kEnableAssert =
true;
38extern bool dump_stacktrace_on_assert_failure;
56#define UASSERT_MSG(expr, msg)
58 if (USERVER_NAMESPACE
::utils::impl::kEnableAssert) {
61 USERVER_NAMESPACE
::utils::impl::UASSERT_failed(#expr, __FILE__, __LINE__, __func__, msg);
77#define UINVARIANT(condition, message)
81 if constexpr (USERVER_NAMESPACE
::utils::impl::kEnableAssert) {
82 USERVER_NAMESPACE
::utils::impl::UASSERT_failed(#condition, __FILE__, __LINE__, __func__, message);
84 USERVER_NAMESPACE
::utils::impl::LogAndThrowInvariantError(
85 #condition, message, USERVER_NAMESPACE
::utils::impl::SourceLocation::Current()