5#ifndef BITCOIN_UTIL_CHECK_H
6#define BITCOIN_UTIL_CHECK_H
18#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
25#ifdef ABORT_ON_FAILED_ASSUME
64 return std::forward<T>(val);
68#error "Cannot compile without assertions!"
72void assertion_fail(std::string_view file,
int line, std::string_view func, std::string_view assertion);
75template <
bool IS_ASSERT,
typename T>
76constexpr T&&
inline_assertion_check(
LIFETIMEBOUND T&& val, [[maybe_unused]]
const char* file, [[maybe_unused]]
int line, [[maybe_unused]]
const char* func, [[maybe_unused]]
const char* assertion)
83 return std::forward<T>(val);
89#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), __FILE__, __LINE__, __func__)
102#define CHECK_NONFATAL(condition) \
103 inline_check_non_fatal(condition, __FILE__, __LINE__, __func__, #condition)
106#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
118#define Assume(val) inline_assertion_check<false>(val, __FILE__, __LINE__, __func__, #val)
123#define NONFATAL_UNREACHABLE() \
124 throw NonFatalCheckError( \
125 "Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__)
T && inline_check_non_fatal(LIFETIMEBOUND T &&val, const char *file, int line, const char *func, const char *assertion)
Helper for CHECK_NONFATAL()
constexpr T && inline_assertion_check(LIFETIMEBOUND T &&val, const char *file, int line, const char *func, const char *assertion)
Helper for Assert()/Assume()
std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func)
void assertion_fail(std::string_view file, int line, std::string_view func, std::string_view assertion)
Helper for Assert()
std::atomic< bool > g_enable_dynamic_fuzz_determinism
bool EnableFuzzDeterminism()
constexpr bool G_ABORT_ON_FAILED_ASSUME
constexpr bool G_FUZZING_BUILD
NonFatalCheckError(std::string_view msg, std::string_view file, int line, std::string_view func)
#define T(expected, seed, data)