Botan 2.19.5 Crypto and TLS for C&

Namespaces | Macros | Functions
assert.h File Reference
`#include <botan/build.h>`
`#include <botan/compiler.h>`

Go to the source code of this file.

## Namespaces
namespace | Botan

## Macros
#define | _BOTAN_UNUSED_GET_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, IMPL_NAME, ...) IMPL_NAME
#define | _BOTAN_UNUSED_IMPL1(a) static_cast<void>(a)
#define | _BOTAN_UNUSED_IMPL2(a, b) static_cast<void>(a); _BOTAN_UNUSED_IMPL1(b)
#define | _BOTAN_UNUSED_IMPL3(a, b, c) static_cast<void>(a); _BOTAN_UNUSED_IMPL2(b, c)
#define | _BOTAN_UNUSED_IMPL4(a, b, c, d) static_cast<void>(a); _BOTAN_UNUSED_IMPL3(b, c, d)
#define | _BOTAN_UNUSED_IMPL5(a, b, c, d, e) static_cast<void>(a); _BOTAN_UNUSED_IMPL4(b, c, d, e)
#define | _BOTAN_UNUSED_IMPL6(a, b, c, d, e, f) static_cast<void>(a); _BOTAN_UNUSED_IMPL5(b, c, d, e, f)
#define | _BOTAN_UNUSED_IMPL7(a, b, c, d, e, f, g) static_cast<void>(a); _BOTAN_UNUSED_IMPL6(b, c, d, e, f, g)
#define | _BOTAN_UNUSED_IMPL8(a, b, c, d, e, f, g, h) static_cast<void>(a); _BOTAN_UNUSED_IMPL7(b, c, d, e, f, g, h)
#define | _BOTAN_UNUSED_IMPL9(a, b, c, d, e, f, g, h, i) static_cast<void>(a); _BOTAN_UNUSED_IMPL8(b, c, d, e, f, g, h, i)
#define | BOTAN_ARG_CHECK(expr, msg) do { if(!(expr)) Botan::throw_invalid_argument(msg, __func__, __FILE__); } while(0)
#define | BOTAN_ASSERT(expr, assertion_made)
#define | BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
#define | BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg)
#define | BOTAN_ASSERT_NOMSG(expr)
#define | BOTAN_ASSERT_NONNULL(ptr)
#define | BOTAN_DEBUG_ASSERT(expr) do {} while(0)
#define | BOTAN_STATE_CHECK(expr) do { if(!(expr)) Botan::throw_invalid_state(#expr, __func__, __FILE__); } while(0)
#define | BOTAN_UNUSED(...)

## Functions
void | Botan::assertion_failure (const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
void | Botan::throw_invalid_argument (const char *message, const char *func, const char *file)
void | Botan::throw_invalid_state (const char *expr, const char *func, const char *file)

## Macro Definition Documentation

## ◆ _BOTAN_UNUSED_GET_IMPL

#define _BOTAN_UNUSED_GET_IMPL | ( |  | _1,
|  |  | _2,
|  |  | _3,
|  |  | _4,
|  |  | _5,
|  |  | _6,
|  |  | _7,
|  |  | _8,
|  |  | _9,
|  |  | IMPL_NAME,
|  |  | ...
| ) |  | IMPL_NAME

Definition at line 140 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL1

#define _BOTAN_UNUSED_IMPL1 | ( |  | a | ) | static_cast<void>(a)

Mark variable as unused. Takes between 1 and 9 arguments and marks all as unused, e.g. BOTAN_UNUSED(a); or BOTAN_UNUSED(x, y, z);

Definition at line 131 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL2

#define _BOTAN_UNUSED_IMPL2 | ( |  | a,
|  |  | b
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL1(b)

Definition at line 132 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL3

#define _BOTAN_UNUSED_IMPL3 | ( |  | a,
|  |  | b,
|  |  | c
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL2(b, c)

Definition at line 133 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL4

#define _BOTAN_UNUSED_IMPL4 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL3(b, c, d)

Definition at line 134 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL5

#define _BOTAN_UNUSED_IMPL5 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL4(b, c, d, e)

Definition at line 135 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL6

#define _BOTAN_UNUSED_IMPL6 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL5(b, c, d, e, f)

Definition at line 136 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL7

#define _BOTAN_UNUSED_IMPL7 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL6(b, c, d, e, f, g)

Definition at line 137 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL8

#define _BOTAN_UNUSED_IMPL8 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g,
|  |  | h
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL7(b, c, d, e, f, g, h)

Definition at line 138 of file assert.h.

## ◆ _BOTAN_UNUSED_IMPL9

#define _BOTAN_UNUSED_IMPL9 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g,
|  |  | h,
|  |  | i
| ) |  | static_cast<void>(a); _BOTAN_UNUSED_IMPL8(b, c, d, e, f, g, h, i)

Definition at line 139 of file assert.h.

## ◆ BOTAN_ARG_CHECK

#define BOTAN_ARG_CHECK | ( |  | expr,
|  |  | msg
| ) |  | do { if(!(expr)) Botan::throw_invalid_argument(msg, __func__, __FILE__); } while(0)

Definition at line 37 of file assert.h.

## ◆ BOTAN_ASSERT

#define BOTAN_ASSERT | ( |  | expr,
|  |  | assertion_made
| ) |  |

Value:
do { \
if(!(expr)) \
Botan::assertion_failure(#expr, \
assertion_made, \
__func__, \
__FILE__, \
__LINE__); \
} while(0)
Botan::assertion_failure
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:31

Make an assertion

Definition at line 55 of file assert.h.

## ◆ BOTAN_ASSERT_EQUAL

#define BOTAN_ASSERT_EQUAL | ( |  | expr1,
|  |  | expr2,
|  |  | assertion_made
| ) |  |

Value:
do { \
if((expr1) != (expr2)) \
Botan::assertion_failure(#expr1 " == " #expr2, \
assertion_made, \
__func__, \
__FILE__, \
__LINE__); \
} while(0)

Assert that value1 == value2

Definition at line 81 of file assert.h.

## ◆ BOTAN_ASSERT_IMPLICATION

#define BOTAN_ASSERT_IMPLICATION | ( |  | expr1,
|  |  | expr2,
|  |  | msg
| ) |  |

Value:
do { \
if((expr1) && !(expr2)) \
Botan::assertion_failure(#expr1 " implies " #expr2, \
msg, \
__func__, \
__FILE__, \
__LINE__); \
} while(0)

Assert that expr1 (if true) implies expr2 is also true

Definition at line 94 of file assert.h.

## ◆ BOTAN_ASSERT_NOMSG

#define BOTAN_ASSERT_NOMSG | ( |  | expr | ) |

Value:
do { \
if(!(expr)) \
Botan::assertion_failure(#expr, \
"", \
__func__, \
__FILE__, \
__LINE__); \
} while(0)

Make an assertion

Definition at line 68 of file assert.h.

## ◆ BOTAN_ASSERT_NONNULL

#define BOTAN_ASSERT_NONNULL | ( |  | ptr | ) |

Value:
do { \
if((ptr) == nullptr) \
Botan::assertion_failure(#ptr " is not null", \
"", \
__func__, \
__FILE__, \
__LINE__); \
} while(0)

Assert that a pointer is not null

Definition at line 107 of file assert.h.

## ◆ BOTAN_DEBUG_ASSERT

#define BOTAN_DEBUG_ASSERT | ( |  | expr | ) | do {} while(0)

Definition at line 123 of file assert.h.

## ◆ BOTAN_STATE_CHECK

#define BOTAN_STATE_CHECK | ( |  | expr | ) | do { if(!(expr)) Botan::throw_invalid_state(#expr, __func__, __FILE__); } while(0)

Definition at line 49 of file assert.h.

## ◆ BOTAN_UNUSED

#define BOTAN_UNUSED | ( |  | ... | ) |

Value:
_BOTAN_UNUSED_GET_IMPL(__VA_ARGS__, \
_BOTAN_UNUSED_IMPL9, \
_BOTAN_UNUSED_IMPL8, \
_BOTAN_UNUSED_IMPL7, \
_BOTAN_UNUSED_IMPL6, \
_BOTAN_UNUSED_IMPL5, \
_BOTAN_UNUSED_IMPL4, \
_BOTAN_UNUSED_IMPL3, \
_BOTAN_UNUSED_IMPL2, \
_BOTAN_UNUSED_IMPL1, \
unused dummy rest value \
) /* we got an one of _BOTAN_UNUSED_IMPL*, now call it */ (__VA_ARGS__)
_BOTAN_UNUSED_IMPL5
#define _BOTAN_UNUSED_IMPL5(a, b, c, d, e)
Definition: assert.h:135
_BOTAN_UNUSED_IMPL1
#define _BOTAN_UNUSED_IMPL1(a)
Definition: assert.h:131
_BOTAN_UNUSED_IMPL7
#define _BOTAN_UNUSED_IMPL7(a, b, c, d, e, f, g)
Definition: assert.h:137
_BOTAN_UNUSED_IMPL3
#define _BOTAN_UNUSED_IMPL3(a, b, c)
Definition: assert.h:133
_BOTAN_UNUSED_IMPL9
#define _BOTAN_UNUSED_IMPL9(a, b, c, d, e, f, g, h, i)
Definition: assert.h:139
_BOTAN_UNUSED_GET_IMPL
#define _BOTAN_UNUSED_GET_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, IMPL_NAME,...)
Definition: assert.h:140
_BOTAN_UNUSED_IMPL2
#define _BOTAN_UNUSED_IMPL2(a, b)
Definition: assert.h:132
_BOTAN_UNUSED_IMPL6
#define _BOTAN_UNUSED_IMPL6(a, b, c, d, e, f)
Definition: assert.h:136
_BOTAN_UNUSED_IMPL4
#define _BOTAN_UNUSED_IMPL4(a, b, c, d)
Definition: assert.h:134
_BOTAN_UNUSED_IMPL8
#define _BOTAN_UNUSED_IMPL8(a, b, c, d, e, f, g, h)
Definition: assert.h:138

Definition at line 142 of file assert.h.