33# define _BLI_ASSERT_PRINT_POS(a) \
34 _BLI_assert_print_pos( \
35 __FILE__, __LINE__, __func__, #a)
36# elif defined(_MSC_VER)
37# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, #a)
39# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", #a)
42# ifdef WITH_ASSERT_ABORT
43# define _BLI_ASSERT_ABORT _BLI_assert_abort
45# define _BLI_ASSERT_ABORT() (void)0
48# define BLI_assert(a) \
49 (void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
50 _BLI_ASSERT_PRINT_POS(a), \
51 _BLI_ASSERT_ABORT(), \
55# define BLI_assert_msg(a, msg) \
56 (void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
57 _BLI_ASSERT_PRINT_POS(a), \
58 _BLI_assert_print_extra(msg), \
59 _BLI_ASSERT_ABORT(), \
63# define BLI_assert(a) ((void)0)
64# define BLI_assert_msg(a, msg) ((void)0)
68#define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg);
70#define BLI_STATIC_ASSERT_ALIGN(st, align) \
71 BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned")
77#define BLI_assert_unreachable() \
79 _BLI_assert_unreachable_print(__FILE__, __LINE__, __func__); \
80 BLI_assert_msg(0, "This line of code is marked to be unreachable."); \
89#define BLI_assert_unreachable_static() \
90 static_assert([]<bool flag = false>() { return flag; }(), \
91 "Unreachable code path reached at compile-time!")
99#define BLI_assert_unreachable_static_t(T) \
100 static_assert(_bli_always_false<T>, "Unreachable code path reached at compile-time!")
void _BLI_assert_print_extra(const char *str)
constexpr bool _bli_always_false
void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id)
void _BLI_assert_print_backtrace()
void _BLI_assert_unreachable_print(const char *file, int line, const char *function)