9#ifndef BOTAN_ASSERTION_CHECKING_H_
10#define BOTAN_ASSERTION_CHECKING_H_
25 assertion_failure(const
char* expr_str, const
char* assertion_made, const
char* func, const
char* file,
int line);
31[[noreturn]]
void BOTAN_UNSTABLE_API throw_invalid_argument(const
char* message, const
char* func, const
char* file);
33#define BOTAN_ARG_CHECK(expr, msg) \
39 Botan::throw_invalid_argument(msg, __func__, __FILE__); \
47[[noreturn]]
void BOTAN_UNSTABLE_API throw_invalid_state(
const char* message,
const char* func,
const char* file);
49#define BOTAN_STATE_CHECK(expr) \
55 Botan::throw_invalid_state(#expr, __func__, __FILE__); \
59#define BOTAN_STATE_CHECK_MSG(expr, msg) \
63 Botan::throw_invalid_state(msg, __func__, __FILE__); \
69#define BOTAN_ASSERT(expr, assertion_made) \
75 Botan::assertion_failure(#expr, assertion_made, __func__, __FILE__, __LINE__); \
82#define BOTAN_ASSERT_NOMSG(expr) \
88 Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
95#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made) \
99 if((expr1) != (expr2)) { \
101 Botan::assertion_failure(#expr1 " == " #expr2, assertion_made, __func__, __FILE__, __LINE__); \
108#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg) \
112 if((expr1) && !(expr2)) { \
114 Botan::assertion_failure(#expr1 " implies " #expr2, msg, __func__, __FILE__, __LINE__); \
121#define BOTAN_ASSERT_NONNULL(ptr) \
124 if((ptr) == nullptr) { \
126 Botan::assertion_failure(#ptr " is not null", "", __func__, __FILE__, __LINE__); \
130#if defined(BOTAN_ENABLE_DEBUG_ASSERTS)
132 #define BOTAN_DEBUG_ASSERT(expr) BOTAN_ASSERT_NOMSG(expr)
136 #define BOTAN_DEBUG_ASSERT(expr) \
148template <
typename... T>
151#define BOTAN_UNUSED Botan::ignore_params
173#define BOTAN_ASSERT_UNREACHABLE() Botan::assert_unreachable(__FILE__, __LINE__)
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
#define BOTAN_UNSTABLE_API
constexpr void ignore_params(const T &... args)