[libcxx-commits] [libcxx] 700ff25 - [libc++] Hoist <compare> outside the threads guard in <thread> (#202535)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 11 02:16:47 PDT 2026


Author: Louis Dionne
Date: 2026-06-11T11:16:41+02:00
New Revision: 700ff25b03ec747784f1e6a92e076ee009db37aa

URL: https://github.com/llvm/llvm-project/commit/700ff25b03ec747784f1e6a92e076ee009db37aa
DIFF: https://github.com/llvm/llvm-project/commit/700ff25b03ec747784f1e6a92e076ee009db37aa.diff

LOG: [libc++] Hoist <compare> outside the threads guard in <thread> (#202535)

The standard mandates [thread.syn] include <compare> as part of
<thread>'s synopsis. This is a standards-mandated dependency, not a
thread-feature dependency, so it should be visible regardless of
_LIBCPP_HAS_THREADS.

This matches how we handle standard-mandated includes elsewhere, see for
example #134877.

Added: 
    

Modified: 
    libcxx/include/thread

Removed: 
    


################################################################################
diff  --git a/libcxx/include/thread b/libcxx/include/thread
index 1c804bdd55dd6..fa50d048330c6 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -91,6 +91,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 #else
 #  include <__config>
 
+// standard-mandated includes
+
+// [thread.syn]
+#  include <compare>
+
 #  if _LIBCPP_HAS_THREADS
 
 #    include <__thread/this_thread.h>
@@ -106,11 +111,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 
 #    include <version>
 
-// standard-mandated includes
-
-// [thread.syn]
-#    include <compare>
-
 #    if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #      pragma GCC system_header
 #    endif


        


More information about the libcxx-commits mailing list