[libc-commits] [libc] [libc] Derive the default thread stack size from RLIMIT_STACK (PR #244571)

via libc-commits libc-commits at lists.llvm.org
Fri Nov 27 02:30:59 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 h,cpp -- libc/src/__support/threads/linux/stack_size.h libc/src/__support/threads/stack_size.h libc/test/integration/src/pthread/pthread_default_stacksize_test.cpp libc/test/src/__support/threads/linux/stack_size_test.cpp libc/src/__support/threads/linux/thread.cpp libc/src/__support/threads/thread.h libc/src/pthread/pthread_attr.h libc/src/pthread/pthread_attr_init.cpp libc/src/pthread/pthread_create.cpp libc/startup/linux/do_start.cpp libc/test/src/pthread/pthread_attr_test.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/libc/test/src/__support/threads/linux/stack_size_test.cpp b/libc/test/src/__support/threads/linux/stack_size_test.cpp
index 3718508d7..fe586d61e 100644
--- a/libc/test/src/__support/threads/linux/stack_size_test.cpp
+++ b/libc/test/src/__support/threads/linux/stack_size_test.cpp
@@ -27,8 +27,7 @@ constexpr size_t MAX_STACKSIZE = ~PAGE_MASK - PAGE_SIZE;
 
 TEST(LlvmLibcSupportThreadsStackSizeTest, BelowAndAtMinimum) {
   const size_t min_stacksize = static_cast<size_t>(PTHREAD_STACK_MIN);
-  const size_t aligned_min_stacksize =
-      (min_stacksize + PAGE_MASK) & ~PAGE_MASK;
+  const size_t aligned_min_stacksize = (min_stacksize + PAGE_MASK) & ~PAGE_MASK;
 
   EXPECT_EQ(stacksize_from_rlimit(0), aligned_min_stacksize);
   EXPECT_EQ(stacksize_from_rlimit(1), aligned_min_stacksize);
@@ -38,8 +37,7 @@ TEST(LlvmLibcSupportThreadsStackSizeTest, BelowAndAtMinimum) {
 
 TEST(LlvmLibcSupportThreadsStackSizeTest, PageAlignment) {
   const size_t min_stacksize = static_cast<size_t>(PTHREAD_STACK_MIN);
-  const size_t aligned_min_stacksize =
-      (min_stacksize + PAGE_MASK) & ~PAGE_MASK;
+  const size_t aligned_min_stacksize = (min_stacksize + PAGE_MASK) & ~PAGE_MASK;
 
   EXPECT_EQ(stacksize_from_rlimit(aligned_min_stacksize + 1),
             aligned_min_stacksize + PAGE_SIZE);

``````````

</details>


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


More information about the libc-commits mailing list