Skip to content

Commit

Permalink
add missing exceptions helper under FreeBSD
Browse files Browse the repository at this point in the history
Summary:
FreeBSD uses libc++ with libcxxrt, as v.s. libc++ with libc++'s cxxabi. The folly wrappers used a helper `cxxabi_with_cxa_exception` that we define only for libc++ with libc++'s cxxabi, so define it also for libc++ with libcxxrt under FreeBSD.

The breakage blames to {D57677424}, which introduced the call under libc++ unconditionally.

Fixes: facebook#2232.

Differential Revision: D58626578
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jun 15, 2024
1 parent 4618cf8 commit 4d83a60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions folly/lang/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,13 @@ bool exception_ptr_access_rt_v_() noexcept {
return true;
}

template <typename F>
static decltype(auto) cxxabi_with_cxa_exception(void* object, F f) {
using cxa_exception = abi::__cxa_exception;
auto exception = object ? static_cast<cxa_exception*>(object) - 1 : nullptr;
return f(exception);
}

std::type_info const* exception_ptr_get_type_(
std::exception_ptr const& ptr) noexcept {
if (!ptr) {
Expand Down

0 comments on commit 4d83a60

Please sign in to comment.