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__); \
62#define BOTAN_ASSERT(expr, assertion_made) \
68 Botan::assertion_failure(#expr, assertion_made, __func__, __FILE__, __LINE__); \
75#define BOTAN_ASSERT_NOMSG(expr) \
81 Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
88#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made) \
92 if((expr1) != (expr2)) { \
94 Botan::assertion_failure(#expr1 " == " #expr2, assertion_made, __func__, __FILE__, __LINE__); \
101#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg) \
105 if((expr1) && !(expr2)) { \
107 Botan::assertion_failure(#expr1 " implies " #expr2, msg, __func__, __FILE__, __LINE__); \
114#define BOTAN_ASSERT_NONNULL(ptr) \
117 if((ptr) == nullptr) { \
119 Botan::assertion_failure(#ptr " is not null", "", __func__, __FILE__, __LINE__); \
123#if defined(BOTAN_ENABLE_DEBUG_ASSERTS)
125 #define BOTAN_DEBUG_ASSERT(expr) BOTAN_ASSERT_NOMSG(expr)
129 #define BOTAN_DEBUG_ASSERT(expr) \
141template <
typename... T>
144#define BOTAN_UNUSED Botan::ignore_params
163#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)