[libcxx-commits] [libcxx] [libc++] Avoid including <features.h> on arbitrary platforms (PR #125587)

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 10 13:43:22 PST 2025


petrhosek wrote:

> > @petrhosek Gentle ping. If you have specific concerns about landing this partial revert, please let me know ASAP so we can work on addressing them. Landing this patch addresses a regression that was introduced in LLVM 20 so I'd like to do this sooner rather than later.
> 
> I believe this change should be fine, but I'll test it locally against our embedded projects just to be sure that nothing breaks.

I tested this locally and it looks like this change breaks the libc++ on baremetal. Specifically this condition no longer evaluates as true: https://github.com/llvm/llvm-project/blob/d7fd2a2a3befe451d3cc70612a40e8c90a780caf/libcxx/src/chrono.cpp#L34-L36

We'll need some alternative. We could move the `__LLVM_LIBC__` to [__llvm-libc-common.h](https://github.com/llvm/llvm-project/blob/d7fd2a2a3befe451d3cc70612a40e8c90a780caf/libc/include/__llvm-libc-common.h) which is included from all other libc headers. We could also try to detect whether `timespec_get` is available without checking for a specific libc.

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


More information about the libcxx-commits mailing list