Skip to content

Commit 43370a3

Browse files
committed
Update __assertion_handler
This file was added as a part of LLVM 18 update (emscripten-core#21638) and was originally copied from https://github.com/llvm/llvm-project/blob/aadaa00de76ed0c4987b97450dd638f63a385bed/libcxx/vendor/llvm/default_assertion_handler.in, so this also updates the file with the newest `default_assertion_handler.in`.
1 parent 446c838 commit 43370a3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

system/lib/libcxx/include/__assertion_handler

+12-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@
2323

2424
#else
2525

26-
// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
27-
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
26+
# if __has_builtin(__builtin_verbose_trap)
27+
// AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream
28+
// version before upstream Clang actually got the builtin.
29+
// TODO: Remove once AppleClang supports the two-arguments version of the builtin.
30+
# if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
31+
# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap(message)
32+
# else
33+
# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message)
34+
# endif
35+
# else
36+
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
37+
# endif
2838

2939
#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
3040

0 commit comments

Comments
 (0)