mark assert_fail as cold and noreturn; move assert to internal.h (see issue #1091, and python/cpython#134586)

This commit is contained in:
daanx
2025-05-30 09:29:35 -07:00
parent 3e32b4c385
commit 715acc0329
3 changed files with 69 additions and 48 deletions

View File

@@ -574,7 +574,6 @@ struct mi_tld_s {
};
// ------------------------------------------------------
// Debug
// ------------------------------------------------------
@@ -589,26 +588,6 @@ struct mi_tld_s {
#define MI_DEBUG_PADDING (0xDE)
#endif
#if (MI_DEBUG)
// use our own assertion to print without memory allocation
void _mi_assert_fail(const char* assertion, const char* fname, unsigned int line, const char* func );
#define mi_assert(expr) ((expr) ? (void)0 : _mi_assert_fail(#expr,__FILE__,__LINE__,__func__))
#else
#define mi_assert(x)
#endif
#if (MI_DEBUG>1)
#define mi_assert_internal mi_assert
#else
#define mi_assert_internal(x)
#endif
#if (MI_DEBUG>2)
#define mi_assert_expensive mi_assert
#else
#define mi_assert_expensive(x)
#endif
// ------------------------------------------------------
// Statistics