[libcxx-commits] [libcxx] [libc++] Avoid including <features.h> on arbitrary platforms (PR #125587)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 5 06:28:49 PST 2025
ldionne wrote:
> This is going to break other platforms supported by LLVM libc, most notably baremetal (for which we don't really have a great detection mechanism since there's no OS).
>
> An alternative to using an LLVM libc provided header would be to store the value of [`LIBCXX_LIBC`](https://github.com/llvm/llvm-project/blob/646d352ab0d0a9cfafa3f2c9c415b5773834ad5b/libcxx/CMakeLists.txt#L231) CMake option in `__config_site` and then use that. This could also eventually replace [`_LIBCPP_HAS_MUSL_LIBC`](https://github.com/llvm/llvm-project/blob/646d352ab0d0a9cfafa3f2c9c415b5773834ad5b/libcxx/include/__config_site.in#L19).
At first glance, I'm really not a huge fan of hardcoding the libc we're building on top of in `__config_site`. However, I do think that this is potentially a more elegant approach than what we do right now (a mix of `_LIBCPP_HAS_MUSL_LIBC` and auto-detection), and it would also solve some problems we have downstream so I think this might be generally useful.
I'm willing to work on that, but it's not something we'd be able to cherry-pick back to LLVM 20 given its complexity and the time it'll take to put something together. In the meantime, I think it's pretty urgent to restore to a behavior that works on mainstream platforms. If you have specific concerns about this patch breaking some new setups since the last release, perhaps we can carve them out using additional `#ifdef`s?
https://github.com/llvm/llvm-project/pull/125587
More information about the libcxx-commits
mailing list