Skip to content

Commit 2f96e0b

Browse files
committed
Avoid using abort_message from test
1 parent 34a91d5 commit 2f96e0b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

libcxxabi/src/abort_message.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
1515
abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
1616

17-
#define _LIBCXXABI_ASSERT(expr, msg) \
18-
do { \
19-
if (!(expr)) { \
20-
char const* __msg = (msg); \
21-
::abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
22-
} \
23-
} while (false)
17+
#ifndef _LIBCXXABI_ASSERT
18+
# define _LIBCXXABI_ASSERT(expr, msg) \
19+
do { \
20+
if (!(expr)) { \
21+
char const* __msg = (msg); \
22+
::abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
23+
} \
24+
} while (false)
2425

2526
#endif
27+
28+
#endif // __ABORT_MESSAGE_H_

libcxxabi/test/test_fallback_malloc.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ typedef std::deque<void *> container;
2727

2828
TEST_DIAGNOSTIC_PUSH
2929
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
30+
#define _LIBCXXABI_ASSERT(expr, msg) assert((expr) && (msg))
31+
3032
// #define DEBUG_FALLBACK_MALLOC
3133
#define INSTRUMENT_FALLBACK_MALLOC
3234
#include "../src/fallback_malloc.cpp"

0 commit comments

Comments
 (0)