[libcxx-commits] [libcxxabi] [libc++abi] Revert gating of `__cxa_thread_atexit` on Linux||Fuchsia (PR #186054)

Guillaume Outters via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 2 03:54:19 PDT 2026


outtersg wrote:

FWIW (just trying to build clang 22 on a FreeBSD 10.2, whose stock clang is a 3.4.1…), I'm not really fond of the addition of every OS to the `#if`, while the "no `#if`" policy worked well until now.

Following up [my comment on #116261](https://github.com/llvm/llvm-project/pull/116261#discussion_r3020471740), I successfully built a full 22.1.2 ecosystem (llvm, clang, libc++, libc++abi, openmp, clang-rt, lld, lldb, flang, flang-rt), both on FreeBSD 10.2 and 15.0 by _removing the `#if`_, for 2 passes (first "bootstrap" pass without lld, lldb, flang, flang-rt).
Of course I got the `warning: no previous prototype for function '__cxa_thread_atexit' [-Wmissing-prototypes]` that caused [the CI failure](https://buildkite.com/llvm-project/libcxx-ci/builds/154962#019ce12a-a019-4e6c-b843-d0d5813d491b) you mentioned @ldionne; but this seems due to [a 2014 commit](https://github.com/llvm/llvm-project/commit/12c0c8b67fdcb11352bac93dde9c76ce47f32744) which added a `__cxa_thread_atexit` implementation with diverging conditions:
* `UNIX` in the `CMakeLists.txt`
* `__Linux__` only in `cxxabi.h`

Thus the warning (that the CI errors) on non-Linux Unix platforms.

So, with the example of my FreeBSD 10.2 and 15.0 sandboxes, wouldn't a cleaner solution be to
**_remove_ those limiting `#if`s**, and instead **make `cxxabi.h` consistent with its `CMakeLists`** by declaring and defining `__cxa_thread_atexit` on every non-Apple-or-Cygwin Unix platform?

https://github.com/llvm/llvm-project/pull/186054


More information about the libcxx-commits mailing list