diff --git a/mdbx.h b/mdbx.h index b10ab212..7ab171a1 100644 --- a/mdbx.h +++ b/mdbx.h @@ -1020,12 +1020,15 @@ LIBMDBX_API const char *mdbx_dump_val(const MDBX_val *key, char *const buf, const size_t bufsize); /** \brief Panics with message and causes abnormal process termination. */ -LIBMDBX_API void mdbx_panic(const char *fmt, ...) MDBX_PRINTF_ARGS(1, 2); +MDBX_NORETURN LIBMDBX_API void mdbx_panic(const char *fmt, ...) + MDBX_PRINTF_ARGS(1, 2); /** \brief Panics with asserton failed message and causes abnormal process * termination. */ -LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg, - const char *func, unsigned line); +MDBX_NORETURN LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, + const char *msg, + const char *func, + unsigned line); /** end of c_debug @} */ /** \brief Environment flags diff --git a/src/osal.c b/src/osal.c index 2e0bb56a..34aeb62d 100644 --- a/src/osal.c +++ b/src/osal.c @@ -247,13 +247,15 @@ __cold void mdbx_assert_fail(const MDBX_env *env, const char *msg, #endif } + while (1) { #if defined(_WIN32) || defined(_WIN64) - if (IsDebuggerPresent()) - DebugBreak(); - FatalExit(ERROR_UNHANDLED_ERROR); + if (IsDebuggerPresent()) + DebugBreak(); + FatalExit(ERROR_UNHANDLED_ERROR); #else - abort(); + abort(); #endif + } } __cold void mdbx_panic(const char *fmt, ...) { @@ -267,16 +269,18 @@ __cold void mdbx_panic(const char *fmt, ...) { (num < 1 || !message) ? "" : message; + while (1) { #if defined(_WIN32) || defined(_WIN64) - OutputDebugStringA("\r\nMDBX-PANIC: "); - OutputDebugStringA(const_message); - if (IsDebuggerPresent()) - DebugBreak(); - FatalExit(ERROR_UNHANDLED_ERROR); + OutputDebugStringA("\r\nMDBX-PANIC: "); + OutputDebugStringA(const_message); + if (IsDebuggerPresent()) + DebugBreak(); + FatalExit(ERROR_UNHANDLED_ERROR); #else - __assert_fail(const_message, "mdbx", 0, "panic"); - abort(); + __assert_fail(const_message, "mdbx", 0, "panic"); + abort(); #endif + } } /*----------------------------------------------------------------------------*/