[libcxx-commits] [libcxx] ef3a391 - [libc++][C++20 modules] Tests no threading build.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 22 11:15:21 PDT 2023
Author: Mark de Wever
Date: 2023-08-22T20:15:16+02:00
New Revision: ef3a39160d55f6f3192d6bcc6e5efd3693cb07e0
URL: https://github.com/llvm/llvm-project/commit/ef3a39160d55f6f3192d6bcc6e5efd3693cb07e0
DIFF: https://github.com/llvm/llvm-project/commit/ef3a39160d55f6f3192d6bcc6e5efd3693cb07e0.diff
LOG: [libc++][C++20 modules] Tests no threading build.
Depends on D158330
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158331
Added:
Modified:
libcxx/cmake/caches/Generic-no-threads.cmake
libcxx/docs/Modules.rst
libcxx/modules/CMakeLists.txt.in
libcxx/modules/std/barrier.inc
libcxx/modules/std/chrono.inc
libcxx/modules/std/condition_variable.inc
libcxx/modules/std/future.inc
libcxx/modules/std/latch.inc
libcxx/modules/std/memory.inc
libcxx/modules/std/mutex.inc
libcxx/modules/std/semaphore.inc
libcxx/modules/std/shared_mutex.inc
libcxx/modules/std/stop_token.inc
libcxx/modules/std/thread.inc
libcxx/utils/ci/buildkite-pipeline.yml
Removed:
################################################################################
diff --git a/libcxx/cmake/caches/Generic-no-threads.cmake b/libcxx/cmake/caches/Generic-no-threads.cmake
index 616baef1be7bef..2aeab22915e00c 100644
--- a/libcxx/cmake/caches/Generic-no-threads.cmake
+++ b/libcxx/cmake/caches/Generic-no-threads.cmake
@@ -1,3 +1,4 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
diff --git a/libcxx/docs/Modules.rst b/libcxx/docs/Modules.rst
index 2fde26ad53e15e..cba8d7876cde51 100644
--- a/libcxx/docs/Modules.rst
+++ b/libcxx/docs/Modules.rst
@@ -44,6 +44,7 @@ What works
* ``LIBCXX_ENABLE_LOCALIZATION``
* ``LIBCXX_ENABLE_WIDE_CHARACTERS``
+ * ``LIBCXX_ENABLE_THREADS``
Some of the current limitations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index 88272e170ed352..a3ba3454cfc659 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -29,9 +29,6 @@ macro(compile_define_if condition def)
endif()
endmacro()
-if(NOT @LIBCXX_ENABLE_THREADS@ OR NOT @LIBCXXABI_ENABLE_THREADS@ OR NOT @LIBCXX_ENABLE_MONOTONIC_CLOCK@)
- message(FATAL_ERROR "Modules without thread support is not yet implemented.")
-endif()
if(NOT @LIBCXX_ENABLE_FILESYSTEM@)
message(FATAL_ERROR "Modules without filesystem support is not yet implemented.")
endif()
diff --git a/libcxx/modules/std/barrier.inc b/libcxx/modules/std/barrier.inc
index bafd87e4acb2f1..dadb67f7ef3301 100644
--- a/libcxx/modules/std/barrier.inc
+++ b/libcxx/modules/std/barrier.inc
@@ -8,5 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
using std::barrier;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/chrono.inc b/libcxx/modules/std/chrono.inc
index b5e6ee7006000d..8976e2a0dd6a96 100644
--- a/libcxx/modules/std/chrono.inc
+++ b/libcxx/modules/std/chrono.inc
@@ -112,8 +112,10 @@ export namespace std {
using std::chrono::file_time;
+#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
// [time.clock.steady], class steady_clock
using std::chrono::steady_clock;
+#endif
// [time.clock.hires], class high_resolution_clock
using std::chrono::high_resolution_clock;
diff --git a/libcxx/modules/std/condition_variable.inc b/libcxx/modules/std/condition_variable.inc
index 95d00f3c0e5a2b..b428918f90603d 100644
--- a/libcxx/modules/std/condition_variable.inc
+++ b/libcxx/modules/std/condition_variable.inc
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
-
+#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.condition.condvar], class condition_variable
using std::condition_variable;
// [thread.condition.condvarany], class condition_variable_any
@@ -18,5 +18,5 @@ export namespace std {
using std::notify_all_at_thread_exit;
using std::cv_status;
-
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/future.inc b/libcxx/modules/std/future.inc
index 8ff034de49d961..2500ad1dee2740 100644
--- a/libcxx/modules/std/future.inc
+++ b/libcxx/modules/std/future.inc
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
using std::future_errc;
using std::future_status;
using std::launch;
@@ -50,4 +51,5 @@ export namespace std {
// [futures.async], function template async
using std::async;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/latch.inc b/libcxx/modules/std/latch.inc
index 5afb8ff6120656..922a55e038ec37 100644
--- a/libcxx/modules/std/latch.inc
+++ b/libcxx/modules/std/latch.inc
@@ -8,5 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
using std::latch;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/memory.inc b/libcxx/modules/std/memory.inc
index 06af546de537e7..d91c549e854f90 100644
--- a/libcxx/modules/std/memory.inc
+++ b/libcxx/modules/std/memory.inc
@@ -187,6 +187,7 @@ export namespace std {
// [inout.ptr], function template inout_ptr
// using std::inout_ptr;
+#ifndef _LIBCPP_HAS_NO_THREADS
// [depr.util.smartptr.shared.atomic]
using std::atomic_is_lock_free;
@@ -203,4 +204,5 @@ export namespace std {
using std::atomic_compare_exchange_strong_explicit;
using std::atomic_compare_exchange_weak;
using std::atomic_compare_exchange_weak_explicit;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/mutex.inc b/libcxx/modules/std/mutex.inc
index fa55324c56c4c9..24c7f2e598a8bd 100644
--- a/libcxx/modules/std/mutex.inc
+++ b/libcxx/modules/std/mutex.inc
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.mutex.class], class mutex
using std::mutex;
// [thread.mutex.recursive], class recursive_mutex
@@ -35,6 +36,7 @@ export namespace std {
// [thread.lock.algorithm], generic locking algorithms
using std::lock;
using std::try_lock;
+#endif // _LIBCPP_HAS_NO_THREADS
using std::once_flag;
diff --git a/libcxx/modules/std/semaphore.inc b/libcxx/modules/std/semaphore.inc
index bc8d905ac28163..a8c8a1b6018e18 100644
--- a/libcxx/modules/std/semaphore.inc
+++ b/libcxx/modules/std/semaphore.inc
@@ -8,8 +8,10 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.sema.cnt], class template counting_semaphore
using std::counting_semaphore;
using std::binary_semaphore;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/shared_mutex.inc b/libcxx/modules/std/shared_mutex.inc
index 2b0782e718ea51..5f09446e38bc77 100644
--- a/libcxx/modules/std/shared_mutex.inc
+++ b/libcxx/modules/std/shared_mutex.inc
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.sharedmutex.class], class shared_mutex
using std::shared_mutex;
// [thread.sharedtimedmutex.class], class shared_timed_mutex
@@ -15,4 +16,5 @@ export namespace std {
// [thread.lock.shared], class template shared_lock
using std::shared_lock;
using std::swap;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/stop_token.inc b/libcxx/modules/std/stop_token.inc
index 80b53e96b7149f..5daf4609611f87 100644
--- a/libcxx/modules/std/stop_token.inc
+++ b/libcxx/modules/std/stop_token.inc
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
// [stoptoken], class stop_token
using std::stop_token;
@@ -20,4 +21,5 @@ export namespace std {
// [stopcallback], class template stop_callback
using std::stop_callback;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/modules/std/thread.inc b/libcxx/modules/std/thread.inc
index 89b1d232772e53..114840e3d1cbf9 100644
--- a/libcxx/modules/std/thread.inc
+++ b/libcxx/modules/std/thread.inc
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
export namespace std {
+#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.thread.class], class thread
using std::thread;
@@ -28,11 +29,12 @@ export namespace std {
// [thread.thread.id]
using std::operator==;
using std::operator<=>;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::operator<<;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+# endif // _LIBCPP_HAS_NO_LOCALIZATION
using std::formatter;
using std::hash;
+#endif // _LIBCPP_HAS_NO_THREADS
} // namespace std
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index cce1c5a2205532..2b6cd6e222a0fe 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -569,8 +569,11 @@ steps:
- "**/test-results.xml"
- "**/*.abilist"
env:
- CC: "clang-${LLVM_HEAD_VERSION}"
- CXX: "clang++-${LLVM_HEAD_VERSION}"
+ # Note: Modules require and absolute path for clang-scan-deps
+ # https://github.com/llvm/llvm-project/issues/61006
+ CC: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang"
+ CXX: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang++"
+ CMAKE: "/opt/bin/cmake"
ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
More information about the libcxx-commits
mailing list