diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/include/error.h')
-rw-r--r-- | src/third_party/wiredtiger/src/include/error.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/src/include/error.h b/src/third_party/wiredtiger/src/include/error.h index f94c3d7b880..6f28dfae2c8 100644 --- a/src/third_party/wiredtiger/src/include/error.h +++ b/src/third_party/wiredtiger/src/include/error.h @@ -19,6 +19,13 @@ #define WT_DIAGNOSTIC_YIELD #endif +#define __wt_err(session, error, ...) \ + __wt_err_func(session, error, __func__, __LINE__, __VA_ARGS__) +#define __wt_errx(session, ...) \ + __wt_errx_func(session, __func__, __LINE__, __VA_ARGS__) +#define __wt_set_return(session, error) \ + __wt_set_return_func(session, __func__, __LINE__, error) + /* Set "ret" and branch-to-err-label tests. */ #define WT_ERR(a) do { \ if ((ret = (a)) != 0) \ @@ -89,18 +96,18 @@ #define WT_TRET_BUSY_OK(a) WT_TRET_ERROR_OK(a, EBUSY) #define WT_TRET_NOTFOUND_OK(a) WT_TRET_ERROR_OK(a, WT_NOTFOUND) +/* Called on unexpected code path: locate the failure. */ +#define __wt_illegal_value(session, v) \ + __wt_illegal_value_func(session, (uintmax_t)v, __func__, __LINE__) + /* Return and branch-to-err-label cases for switch statements. */ -#define WT_ILLEGAL_VALUE(session) \ +#define WT_ILLEGAL_VALUE(session, v) \ default: \ - return (__wt_illegal_value(session, NULL)) -#define WT_ILLEGAL_VALUE_ERR(session) \ + return (__wt_illegal_value(session, v)) +#define WT_ILLEGAL_VALUE_ERR(session, v) \ default: \ - ret = __wt_illegal_value(session, NULL); \ + ret = __wt_illegal_value(session, v); \ goto err -#define WT_ILLEGAL_VALUE_SET(session) \ - default: \ - ret = __wt_illegal_value(session, NULL); \ - break #define WT_PANIC_MSG(session, v, ...) do { \ __wt_err(session, v, __VA_ARGS__); \ @@ -125,8 +132,10 @@ */ #ifdef HAVE_DIAGNOSTIC #define WT_ASSERT(session, exp) do { \ - if (!(exp)) \ - __wt_assert(session, 0, __func__, __LINE__, "%s", #exp);\ + if (!(exp)) { \ + __wt_errx(session, "%s", #exp); \ + __wt_abort(session); \ + } \ } while (0) #else #define WT_ASSERT(session, exp) \ |