mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 22:58:50 +01:00
Merge remote-tracking branch 'tor-github/pr/952' into maint-0.4.0
This commit is contained in:
commit
e51b57ee04
3 changed files with 23 additions and 3 deletions
4
changes/bug30189
Normal file
4
changes/bug30189
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
o Minor bugfixes (compilation, unusual configuration):
|
||||||
|
- Avoid failures when building with ALL_BUGS_ARE_FAILED due to
|
||||||
|
missing declarations of abort(), and prevent other such failures
|
||||||
|
in the future. Fixes bug 30189; bugfix on 0.3.4.1-alpha.
|
|
@ -19,6 +19,7 @@
|
||||||
#include "lib/string/printf.h"
|
#include "lib/string/printf.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef TOR_UNIT_TESTS
|
#ifdef TOR_UNIT_TESTS
|
||||||
static void (*failed_assertion_cb)(void) = NULL;
|
static void (*failed_assertion_cb)(void) = NULL;
|
||||||
|
@ -120,6 +121,19 @@ tor_bug_occurred_(const char *fname, unsigned int line,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the abort() function to kill the current process with a fatal
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* (This is a separate function so that we declare it in util_bug.h without
|
||||||
|
* including stdlib in all the users of util_bug.h)
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
tor_abort_(void)
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/** Take a filename and return a pointer to its final element. This
|
/** Take a filename and return a pointer to its final element. This
|
||||||
* function is called on __FILE__ to fix a MSVC nit where __FILE__
|
* function is called on __FILE__ to fix a MSVC nit where __FILE__
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
if (ASSERT_PREDICT_LIKELY_(expr)) { \
|
if (ASSERT_PREDICT_LIKELY_(expr)) { \
|
||||||
} else { \
|
} else { \
|
||||||
tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, #expr); \
|
tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, #expr); \
|
||||||
abort(); \
|
tor_abort_(); \
|
||||||
} STMT_END
|
} STMT_END
|
||||||
#endif /* defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS) */
|
#endif /* defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS) */
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
STMT_BEGIN { \
|
STMT_BEGIN { \
|
||||||
tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, \
|
tor_assertion_failed_(SHORT_FILE__, __LINE__, __func__, \
|
||||||
"line should be unreached"); \
|
"line should be unreached"); \
|
||||||
abort(); \
|
tor_abort_(); \
|
||||||
} STMT_END
|
} STMT_END
|
||||||
|
|
||||||
/* Non-fatal bug assertions. The "unreached" variants mean "this line should
|
/* Non-fatal bug assertions. The "unreached" variants mean "this line should
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
#define BUG(cond) \
|
#define BUG(cond) \
|
||||||
(ASSERT_PREDICT_UNLIKELY_(cond) ? \
|
(ASSERT_PREDICT_UNLIKELY_(cond) ? \
|
||||||
(tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
|
(tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
|
||||||
abort(), 1) \
|
tor_abort_(), 1) \
|
||||||
: 0)
|
: 0)
|
||||||
#elif defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)
|
#elif defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)
|
||||||
#define tor_assert_nonfatal_unreached() STMT_NIL
|
#define tor_assert_nonfatal_unreached() STMT_NIL
|
||||||
|
@ -226,6 +226,8 @@ void tor_bug_occurred_(const char *fname, unsigned int line,
|
||||||
const char *func, const char *expr,
|
const char *func, const char *expr,
|
||||||
int once);
|
int once);
|
||||||
|
|
||||||
|
void tor_abort_(void) ATTR_NORETURN;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SHORT_FILE__ (tor_fix_source_file(__FILE__))
|
#define SHORT_FILE__ (tor_fix_source_file(__FILE__))
|
||||||
const char *tor_fix_source_file(const char *fname);
|
const char *tor_fix_source_file(const char *fname);
|
||||||
|
|
Loading…
Add table
Reference in a new issue