From: Nick Mathewson Date: Mon, 15 Apr 2019 18:27:32 +0000 (-0400) Subject: Merge branch 'bug30189_035' into bug30189_041 X-Git-Tag: tor-0.4.1.1-alpha~56^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=358df18064d0389219e610cf9aa5b08bbd6a0ec8;p=thirdparty%2Ftor.git Merge branch 'bug30189_035' into bug30189_041 --- 358df18064d0389219e610cf9aa5b08bbd6a0ec8 diff --cc src/lib/log/util_bug.h index 63c5309c98,2a4d68127e..2e220b7286 --- a/src/lib/log/util_bug.h +++ b/src/lib/log/util_bug.h @@@ -99,22 -95,19 +99,22 @@@ #else /** Like assert(3), but send assertion failures to the log as well as to * stderr. */ -#define tor_assert(expr) STMT_BEGIN \ +#define tor_assert(expr) tor_assertf(expr, NULL) + +#define tor_assertf(expr, fmt, ...) STMT_BEGIN \ if (ASSERT_PREDICT_LIKELY_(expr)) { \ } else { \ - tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, #expr); \ - tor_abort_(); \ + tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, #expr, \ + fmt, ##__VA_ARGS__); \ - abort(); \ ++ tor_abort_(); \ } STMT_END #endif /* defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS) */ #define tor_assert_unreached() \ STMT_BEGIN { \ tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, \ - "line should be unreached"); \ + "line should be unreached", NULL); \ - abort(); \ + tor_abort_(); \ } STMT_END /* Non-fatal bug assertions. The "unreached" variants mean "this line should @@@ -240,12 -221,13 +240,14 @@@ #define tor_fragile_assert() tor_assert_nonfatal_unreached_once() void tor_assertion_failed_(const char *fname, unsigned int line, - const char *func, const char *expr); + const char *func, const char *expr, + const char *fmt, ...); void tor_bug_occurred_(const char *fname, unsigned int line, const char *func, const char *expr, - int once); + int once, const char *fmt, ...); + void tor_abort_(void) ATTR_NORETURN; + #ifdef _WIN32 #define SHORT_FILE__ (tor_fix_source_file(__FILE__)) const char *tor_fix_source_file(const char *fname);