[libcxx-commits] [libcxx] [libc++] Hoist <compare> outside the threads guard in <thread> (PR #202535)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 9 01:49:38 PDT 2026
philnik777 wrote:
> > Can we just hoist all the headers out of `_LIBCPP_HAS_THREADS`?
>
> That's basically what's discussed in [#202246 (review)](https://github.com/llvm/llvm-project/pull/202246#pullrequestreview-4450394461).
>
> The general question is whether we should include all sub-headers outside carve-outs and `_LIBCPP_STD_VER` blocks, or inside them. Right now we tend to include sub-headers INSIDE carve-outs and `_LIBCPP_STD_VER` checks with some degree of consistency (see for example `<ios>` or `<istream>`).
We're pretty consistently including detail headers outside the `_LIBCPP_STD_VER` checks, except in umbrella headers. I was never a huge fan of having headers behind carve-outs, since that adds another dimension to when which header is included.
> Including sub-headers outside carve-outs and `_LIBCPP_STD_VER` checks means that every implementation-detail header has to be made to work with the carve-outs (e.g. be made empty), which is more work for limited value, I think. Did you have something thought out in mind or you were just asking the question without a specific goal in mind?
We already have to do that, since we include detail headers unconditionally in most places (feel free to grep for e.g. `include <__thread/`). FWIW I also don' think the additional maintenance burden here is worth the improved compile times, since they are quite niche configurations.
https://github.com/llvm/llvm-project/pull/202535
More information about the libcxx-commits
mailing list