[libcxx-commits] [libcxx] [libc++] debug semaaphore (PR #180353)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 7 08:21:26 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- libcxx/test/std/thread/thread.semaphore/timed.debug.pass.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/thread/thread.semaphore/timed.debug.pass.cpp b/libcxx/test/std/thread/thread.semaphore/timed.debug.pass.cpp
index d78331949..13c2470e7 100644
--- a/libcxx/test/std/thread/thread.semaphore/timed.debug.pass.cpp
+++ b/libcxx/test/std/thread/thread.semaphore/timed.debug.pass.cpp
@@ -18,14 +18,12 @@
 #include <iostream>
 #include <iomanip>
 
-
 #include "make_test_thread.h"
 #include "test_macros.h"
 
-int main(int, char**)
-{
+int main(int, char**) {
   auto const start = std::chrono::steady_clock::now();
-  auto log = [start] ()-> auto& {
+  auto log         = [start]() -> auto& {
     using namespace std::chrono;
 
     auto elapsed = steady_clock::now() - start;
@@ -41,36 +39,33 @@ int main(int, char**)
 
     auto milliseconds = duration_cast<std::chrono::milliseconds>(elapsed);
 
-    std::cerr << "["
-              << std::setw(2) << std::setfill('0') << hours.count() << ":"
-              << std::setw(2) << std::setfill('0') << minutes.count() << ":"
-              << std::setw(2) << std::setfill('0') << seconds.count() << "."
-              << std::setw(3) << std::setfill('0') << milliseconds.count()
-              << "] ";
+    std::cerr << "[" << std::setw(2) << std::setfill('0') << hours.count() << ":" << std::setw(2) << std::setfill('0')
+              << minutes.count() << ":" << std::setw(2) << std::setfill('0') << seconds.count() << "." << std::setw(3)
+              << std::setfill('0') << milliseconds.count() << "] ";
 
     return std::cerr;
   };
 
   std::counting_semaphore<> s(0);
 
-  log() << "try_acquire_until: start + " <<  std::chrono::milliseconds(250)  << "\n";
+  log() << "try_acquire_until: start + " << std::chrono::milliseconds(250) << "\n";
   assert(!s.try_acquire_until(start + std::chrono::milliseconds(250)));
-  log() << "done: try_acquire_until: start + " <<  std::chrono::milliseconds(250)  << "\n";
+  log() << "done: try_acquire_until: start + " << std::chrono::milliseconds(250) << "\n";
 
   log() << "try_acquire_for: " << std::chrono::milliseconds(250) << "\n";
   assert(!s.try_acquire_for(std::chrono::milliseconds(250)));
   log() << "done: try_acquire_for: " << std::chrono::milliseconds(250) << "\n";
 
-  std::thread t = support::make_test_thread([&](){
+  std::thread t = support::make_test_thread([&]() {
     std::this_thread::sleep_for(std::chrono::milliseconds(250));
     s.release();
     std::this_thread::sleep_for(std::chrono::milliseconds(250));
     s.release();
   });
 
-  log() << "try_acquire_until: start + " <<  std::chrono::seconds(2)  << "\n";
+  log() << "try_acquire_until: start + " << std::chrono::seconds(2) << "\n";
   assert(s.try_acquire_until(start + std::chrono::seconds(2)));
-  log() << "done: try_acquire_until: start + " <<  std::chrono::seconds(2)  << "\n";
+  log() << "done: try_acquire_until: start + " << std::chrono::seconds(2) << "\n";
 
   log() << "try_acquire_for: " << std::chrono::seconds(2) << "\n";
   assert(s.try_acquire_for(std::chrono::seconds(2)));

``````````

</details>


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


More information about the libcxx-commits mailing list