8#include <botan/assert.h>
10#include <botan/exceptn.h>
11#include <botan/internal/fmt.h>
12#include <botan/internal/target_info.h>
15#if defined(BOTAN_TERMINATE_ON_ASSERTS)
27 throw Invalid_State(
fmt(
"Invalid state: expr {} was false in {}:{}", expr, func, file));
30void assertion_failure(
const char* expr_str,
const char* assertion_made,
const char* func,
const char* file,
int line) {
31 std::ostringstream format;
33 format <<
"False assertion ";
35 if(assertion_made && assertion_made[0] != 0) {
36 format <<
"'" << assertion_made <<
"' (expression " << expr_str <<
") ";
38 format << expr_str <<
" ";
42 format <<
"in " << func <<
" ";
45 format <<
"@" << file <<
":" << line;
47#if defined(BOTAN_TERMINATE_ON_ASSERTS)
48 std::cerr << format.str() <<
'\n';
30void assertion_failure(
const char* expr_str,
const char* assertion_made,
const char* func,
const char* file,
int line) {
…}
56 const std::string msg =
fmt(
"Codepath that was marked unreachable was reached @{}:{}", file, line);
58#if defined(BOTAN_TERMINATE_ON_ASSERTS)
59 std::cerr << msg <<
'\n';
void assert_unreachable(const char *file, int line)
void throw_invalid_state(const char *expr, const char *func, const char *file)
void throw_invalid_argument(const char *message, const char *func, const char *file)
std::string fmt(std::string_view format, const T &... args)
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)