[libcxx-commits] [libcxx] [libc++] Hoist <compare> outside the threads guard in <thread> (PR #202535)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 9 01:24:20 PDT 2026
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/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.
>From 629be94a70698ca5288f59926429166ecf8527ee Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 9 Jun 2026 10:14:18 +0200
Subject: [PATCH] [libc++] Hoist <compare> outside the threads guard in
<thread>
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.
---
libcxx/include/thread | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libcxx/include/thread b/libcxx/include/thread
index f252273ebadcd..a8f7958346554 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