Blender V5.3
BLI_assert.hh File Reference
#include <stddef.h>

Go to the source code of this file.

Macros

Object
#define _BLI_ASSERT_PRINT_POS(a)
#define _BLI_ASSERT_ABORT()
#define BLI_assert(a)
#define BLI_assert_msg(a, msg)
#define BLI_STATIC_ASSERT(a, msg)
#define BLI_STATIC_ASSERT_ALIGN(st, align)
#define BLI_assert_unreachable()
#define BLI_assert_unreachable_static()
#define BLI_assert_unreachable_static_t(T)

Functions

void _BLI_assert_print_pos (const char *file, int line, const char *function, const char *id)
void _BLI_assert_print_extra (const char *str)
void _BLI_assert_print_backtrace ()
void _BLI_assert_abort ()
void _BLI_assert_unreachable_print (const char *file, int line, const char *function)

Variables

template<class T>
constexpr bool _bli_always_false = false

Detailed Description

Macro Definition Documentation

◆ _BLI_ASSERT_ABORT

#define _BLI_ASSERT_ABORT ( )
Value:
(void)0

Definition at line 46 of file blenkernel/intern/sound.cc.

◆ _BLI_ASSERT_PRINT_POS

#define _BLI_ASSERT_PRINT_POS ( a)
Value:
_BLI_assert_print_pos(__FILE__, __LINE__, "<?>", #a)
void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id)
Definition BLI_assert.cc:20

Definition at line 40 of file blenkernel/intern/sound.cc.

◆ BLI_assert

#define BLI_assert ( a)
Value:
(void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
NULL)) : \
NULL)
void _BLI_assert_print_backtrace()
Definition BLI_assert.cc:36
#define _BLI_ASSERT_PRINT_POS(a)
#define _BLI_ASSERT_ABORT()

Definition at line 49 of file blenkernel/intern/sound.cc.

◆ BLI_assert_msg

#define BLI_assert_msg ( a,
msg )
Value:
(void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
NULL)) : \
NULL)
void _BLI_assert_print_extra(const char *str)
Definition BLI_assert.cc:25

A version of BLI_assert() to pass an additional message to be printed on failure.

Definition at line 56 of file blenkernel/intern/sound.cc.

◆ BLI_assert_unreachable

#define BLI_assert_unreachable ( )
Value:
{ \
_BLI_assert_unreachable_print(__FILE__, __LINE__, __func__); \
BLI_assert_msg(0, "This line of code is marked to be unreachable."); \
} \
((void)0)

Indicates that this line of code should never be executed. If it is reached, it will abort in debug builds and print an error in release builds.

Definition at line 78 of file blenkernel/intern/sound.cc.

◆ BLI_assert_unreachable_static

#define BLI_assert_unreachable_static ( )
Value:
static_assert([]<bool flag = false>() { return flag; }(), \
"Unreachable code path reached at compile-time!")

Indicates that this line should never be reached, even at compile-time. Just doing static_assert(false) doesn't work in C++20 for this use-case. BLI_assert_unreachable is similar but does not catch issues at compile-time.

Definition at line 90 of file blenkernel/intern/sound.cc.

◆ BLI_assert_unreachable_static_t

#define BLI_assert_unreachable_static_t ( T)
Value:
static_assert(_bli_always_false<T>, "Unreachable code path reached at compile-time!")
constexpr bool _bli_always_false
Definition BLI_assert.hh:93

Like BLI_assert_unreachable_static but allows passing in a type. This results in a more useful error message containing the type name.

Definition at line 100 of file blenkernel/intern/sound.cc.

◆ BLI_STATIC_ASSERT

#define BLI_STATIC_ASSERT ( a ,
msg )
Value:
static_assert(a, msg);

Definition at line 69 of file blenkernel/intern/sound.cc.

◆ BLI_STATIC_ASSERT_ALIGN

#define BLI_STATIC_ASSERT_ALIGN ( st,
align )
Value:
BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned")
#define BLI_STATIC_ASSERT(a, msg)

Definition at line 71 of file blenkernel/intern/sound.cc.

Function Documentation

◆ _BLI_assert_abort()

void _BLI_assert_abort ( )

Definition at line 43 of file BLI_assert.cc.

References _BLI_assert_abort().

Referenced by _BLI_assert_abort().

◆ _BLI_assert_print_backtrace()

void _BLI_assert_print_backtrace ( )

◆ _BLI_assert_print_extra()

void _BLI_assert_print_extra ( const char * str)

Definition at line 25 of file BLI_assert.cc.

References _BLI_assert_print_extra(), and str.

Referenced by _BLI_assert_print_extra().

◆ _BLI_assert_print_pos()

void _BLI_assert_print_pos ( const char * file,
int line,
const char * function,
const char * id )

Definition at line 20 of file BLI_assert.cc.

References _BLI_assert_print_pos().

Referenced by _BLI_assert_print_pos().

◆ _BLI_assert_unreachable_print()

void _BLI_assert_unreachable_print ( const char * file,
int line,
const char * function )

Definition at line 30 of file BLI_assert.cc.

References _BLI_assert_unreachable_print().

Referenced by _BLI_assert_unreachable_print().

Variable Documentation

◆ _bli_always_false

template<class T>
bool _bli_always_false = false
inlineconstexpr

Definition at line 93 of file BLI_assert.hh.