mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx: добавлено MDBX_NORETURN
к mdbx_panic()
и mdbx_assert_fail()
.
This commit is contained in:
parent
375fa3a225
commit
bcd5bad74a
9
mdbx.h
9
mdbx.h
@ -1020,12 +1020,15 @@ LIBMDBX_API const char *mdbx_dump_val(const MDBX_val *key, char *const buf,
|
|||||||
const size_t bufsize);
|
const size_t bufsize);
|
||||||
|
|
||||||
/** \brief Panics with message and causes abnormal process termination. */
|
/** \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
|
/** \brief Panics with asserton failed message and causes abnormal process
|
||||||
* termination. */
|
* termination. */
|
||||||
LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg,
|
MDBX_NORETURN LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env,
|
||||||
const char *func, unsigned line);
|
const char *msg,
|
||||||
|
const char *func,
|
||||||
|
unsigned line);
|
||||||
/** end of c_debug @} */
|
/** end of c_debug @} */
|
||||||
|
|
||||||
/** \brief Environment flags
|
/** \brief Environment flags
|
||||||
|
26
src/osal.c
26
src/osal.c
@ -247,13 +247,15 @@ __cold void mdbx_assert_fail(const MDBX_env *env, const char *msg,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
if (IsDebuggerPresent())
|
if (IsDebuggerPresent())
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
FatalExit(ERROR_UNHANDLED_ERROR);
|
FatalExit(ERROR_UNHANDLED_ERROR);
|
||||||
#else
|
#else
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__cold void mdbx_panic(const char *fmt, ...) {
|
__cold void mdbx_panic(const char *fmt, ...) {
|
||||||
@ -267,16 +269,18 @@ __cold void mdbx_panic(const char *fmt, ...) {
|
|||||||
(num < 1 || !message) ? "<troubles with panic-message preparation>"
|
(num < 1 || !message) ? "<troubles with panic-message preparation>"
|
||||||
: message;
|
: message;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
OutputDebugStringA("\r\nMDBX-PANIC: ");
|
OutputDebugStringA("\r\nMDBX-PANIC: ");
|
||||||
OutputDebugStringA(const_message);
|
OutputDebugStringA(const_message);
|
||||||
if (IsDebuggerPresent())
|
if (IsDebuggerPresent())
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
FatalExit(ERROR_UNHANDLED_ERROR);
|
FatalExit(ERROR_UNHANDLED_ERROR);
|
||||||
#else
|
#else
|
||||||
__assert_fail(const_message, "mdbx", 0, "panic");
|
__assert_fail(const_message, "mdbx", 0, "panic");
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user