Skip to content

Commit

Permalink
[libc++][hardening] Use __builtin_verbose_trap if it's available.
Browse files Browse the repository at this point in the history
Keep falling back to `__builtin_trap` on older versions of Clang.
  • Loading branch information
var-const authored and ldionne committed Jul 9, 2024
1 parent a1d73ac commit ea44fac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libcxx/vendor/llvm/default_assertion_handler.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@

#else

// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
# if __has_builtin(__builtin_verbose_trap)
# define _LIBCPP_ASSERTION_HANDLER(message) (__builtin_verbose_trap(message))
# else
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
# endif

#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG

Expand Down

0 comments on commit ea44fac

Please sign in to comment.