Botan 3.1.1
Crypto and TLS for C&
Namespaces | Macros | Functions
assert.h File Reference

Public Header. More...

#include <botan/compiler.h>

Go to the source code of this file.

Namespaces

namespace  Botan
 

Macros

#define BOTAN_ARG_CHECK(expr, msg)
 
#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_ASSERT_UNREACHABLE()   Botan::assert_unreachable(__FILE__, __LINE__)
 
#define BOTAN_DEBUG_ASSERT(expr)
 
#define BOTAN_STATE_CHECK(expr)
 
#define BOTAN_UNUSED   Botan::ignore_params
 

Functions

void Botan::assert_unreachable (const char *file, int line)
 
void Botan::assertion_failure (const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
 
template<typename T >
void Botan::ignore_param (T &&)
 
template<typename... T>
void Botan::ignore_params (T &&... args)
 
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)
 

Detailed Description

Public Header.

Definition in file assert.h.

Macro Definition Documentation

◆ BOTAN_ARG_CHECK

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

Definition at line 29 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)

Make an assertion

Definition at line 50 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 68 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 77 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 59 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 86 of file assert.h.

◆ BOTAN_ASSERT_UNREACHABLE

#define BOTAN_ASSERT_UNREACHABLE ( )    Botan::assert_unreachable(__FILE__, __LINE__)

Definition at line 137 of file assert.h.

◆ BOTAN_DEBUG_ASSERT

#define BOTAN_DEBUG_ASSERT (   expr)
Value:
do { \
} while(0)

Definition at line 98 of file assert.h.

◆ BOTAN_STATE_CHECK

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

Definition at line 41 of file assert.h.

◆ BOTAN_UNUSED

#define BOTAN_UNUSED   Botan::ignore_params

Definition at line 118 of file assert.h.