Blender  V2.93
Macros | Functions
BLI_assert.h File Reference

Go to the source code of this file.

Macros

#define _BLI_ASSERT_PRINT_POS(a)   _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", # a)
 
#define _BLI_ASSERT_ABORT()   (void)0
 
#define BLI_assert(a)
 
#define BLI_STATIC_ASSERT(a, msg)
 
#define BLI_STATIC_ASSERT_ALIGN(st, align)    BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned")
 
#define BLI_assert_unreachable()
 

Functions

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

Detailed Description

Defines:

Definition in file BLI_assert.h.

Macro Definition Documentation

◆ _BLI_ASSERT_ABORT

#define _BLI_ASSERT_ABORT ( )    (void)0

Definition at line 55 of file BLI_assert.h.

◆ _BLI_ASSERT_PRINT_POS

#define _BLI_ASSERT_PRINT_POS (   a)    _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", # a)

Definition at line 49 of file BLI_assert.h.

◆ BLI_assert

#define BLI_assert (   a)
Value:
(void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
_BLI_ASSERT_PRINT_POS(a), \
_BLI_ASSERT_ABORT(), \
NULL)) : \
NULL)
void _BLI_assert_print_backtrace(void)
Definition: BLI_assert.c:40
static unsigned a[3]
Definition: RandGen.cpp:92

Definition at line 58 of file BLI_assert.h.

◆ BLI_assert_unreachable

#define BLI_assert_unreachable ( )
Value:
{ \
_BLI_assert_unreachable_print(__FILE__, __LINE__, __func__); \
BLI_assert(!"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 96 of file BLI_assert.h.

◆ BLI_STATIC_ASSERT

#define BLI_STATIC_ASSERT (   a,
  msg 
)

Definition at line 86 of file BLI_assert.h.

◆ BLI_STATIC_ASSERT_ALIGN

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

Definition at line 89 of file BLI_assert.h.

Function Documentation

◆ _BLI_assert_abort()

void _BLI_assert_abort ( void  )

Wrap to remove 'noreturn' attribute since this suppresses missing return statements, allowing changes to debug builds to accidentally to break release builds.

For example BLI_assert(0); at the end of a function that returns a value, will hide that it's missing a return.

Definition at line 54 of file BLI_assert.c.

◆ _BLI_assert_print_backtrace()

void _BLI_assert_print_backtrace ( void  )

Definition at line 40 of file BLI_assert.c.

References BLI_system_backtrace().

◆ _BLI_assert_print_pos()

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

Definition at line 29 of file BLI_assert.c.

References file.

◆ _BLI_assert_unreachable_print()

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

Definition at line 34 of file BLI_assert.c.

References file.