44 # if defined(__GNUC__)
45 # define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a)
46 # elif defined(_MSC_VER)
47 # define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a)
49 # define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", # a)
52 # ifdef WITH_ASSERT_ABORT
53 # define _BLI_ASSERT_ABORT _BLI_assert_abort
55 # define _BLI_ASSERT_ABORT() (void)0
58 # define BLI_assert(a) \
59 (void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
60 _BLI_ASSERT_PRINT_POS(a), \
61 _BLI_ASSERT_ABORT(), \
65 # define BLI_assert(a) ((void)0)
68 #if defined(__cplusplus)
70 # define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg);
71 #elif defined(_MSC_VER)
73 # if (_MSC_VER > 1910) && !defined(__clang__)
74 # define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg);
76 # define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a);
78 #elif defined(__COVERITY__)
80 # define BLI_STATIC_ASSERT(a, msg)
81 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
83 # define BLI_STATIC_ASSERT(a, msg) _Static_assert(a, msg);
86 # define BLI_STATIC_ASSERT(a, msg)
89 #define BLI_STATIC_ASSERT_ALIGN(st, align) \
90 BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned")
96 #define BLI_assert_unreachable() \
98 _BLI_assert_unreachable_print(__FILE__, __LINE__, __func__); \
99 BLI_assert(!"This line of code is marked to be unreachable."); \
void _BLI_assert_print_backtrace(void)
void _BLI_assert_unreachable_print(const char *file, const int line, const char *function)
void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id)
void _BLI_assert_abort(void)