[libc-commits] [libc] [libc]: Add -Wextra for libc tests (PR #133643)

Vinay Deshmukh via libc-commits libc-commits at lists.llvm.org
Tue Apr 1 19:27:52 PDT 2025


https://github.com/vinay-deshmukh updated https://github.com/llvm/llvm-project/pull/133643

>From ef115eeb591c6a5915d878b6a233224f3e0b1e14 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 13:15:10 -0400
Subject: [PATCH 01/19] Wextra

---
 libc/CMakeLists.txt                        | 1 +
 libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index b264dcb4974c7..0bfb7b8aad20d 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -34,6 +34,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions("-D_DEBUG")
 endif()
 
+add_compile_options("-Werror=extra")
 
 # Default to C++17
 set(CMAKE_CXX_STANDARD 17)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 0f0d612d04ba5..99386e89847ea 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -31,7 +31,7 @@ function(_get_common_test_compile_options output_var c_test flags)
     endif()
 
     # list(APPEND compile_options "-Wall")
-    # list(APPEND compile_options "-Wextra")
+    list(APPEND compile_options "-Wextra")
     # -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.
     if(NOT LIBC_WNO_ERROR)
       # list(APPEND compile_options "-Werror")

>From 555a99f80c490140e55354612950212be5218571 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 14:57:24 -0400
Subject: [PATCH 02/19] unused

---
 libc/test/UnitTest/LibcTest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h
index fbeafd0bacb75..b65271dd84b4a 100644
--- a/libc/test/UnitTest/LibcTest.h
+++ b/libc/test/UnitTest/LibcTest.h
@@ -81,7 +81,7 @@ struct Message {
 // A trivial object to catch the Message, this enables custom logging and
 // returning from the test function, see LIBC_TEST_SCAFFOLDING_ below.
 struct Failure {
-  void operator=(Message msg) {}
+  void operator=(Message /*msg*/) {}
 };
 
 struct RunContext {

>From 21530d53cb9811f462e11ee4cf8ccfed85ba7a5c Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 15:09:55 -0400
Subject: [PATCH 03/19] unused

---
 libc/test/UnitTest/LibcDeathTestExecutors.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
index 943e2c23c5fde..f2b048864b556 100644
--- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp
+++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
@@ -22,7 +22,7 @@ namespace LIBC_NAMESPACE_DECL {
 namespace testing {
 
 bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
-                             const char *LHSStr, const char *RHSStr,
+                             const char *LHSStr, const char * /*RHSStr*/,
                              internal::Location Loc) {
   testutils::ProcessStatus Result =
       testutils::invoke_in_subprocess(Func, TIMEOUT_MS);

>From 283dac9b1ee35d2275f967984f0b1807020c0ca1 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 15:47:39 -0400
Subject: [PATCH 04/19] unused

---
 libc/test/UnitTest/HermeticTestUtils.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index a9494af746d52..54be9e92bf10b 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -29,7 +29,7 @@ int atexit(void (*func)(void));
 // add_libc_hermetic_test properly. Such that they won't get correct linkage
 // against the object containing this function. We create a dummy function that
 // always returns 0 to indicate a failure.
-[[gnu::weak]] unsigned long getauxval(unsigned long id) { return 0; }
+[[gnu::weak]] unsigned long getauxval(unsigned long /*id*/) { return 0; }
 
 } // namespace LIBC_NAMESPACE_DECL
 
@@ -124,7 +124,7 @@ unsigned long __getauxval(unsigned long id) {
 
 } // extern "C"
 
-void *operator new(size_t size, void *ptr) { return ptr; }
+void *operator new(size_t /*size*/, void *ptr) { return ptr; }
 
 void *operator new(size_t size) { return malloc(size); }
 
@@ -136,7 +136,7 @@ void operator delete(void *) {
   __builtin_trap();
 }
 
-void operator delete(void *ptr, size_t size) { __builtin_trap(); }
+void operator delete(void * /*ptr*/, size_t /*size*/) { __builtin_trap(); }
 
 // Defining members in the std namespace is not preferred. But, we do it here
 // so that we can use it to define the operator new which takes std::align_val_t
@@ -145,8 +145,10 @@ namespace std {
 enum class align_val_t : size_t {};
 } // namespace std
 
-void operator delete(void *mem, std::align_val_t) noexcept { __builtin_trap(); }
+void operator delete(void * /*mem*/, std::align_val_t) noexcept {
+  __builtin_trap();
+}
 
-void operator delete(void *mem, unsigned int, std::align_val_t) noexcept {
+void operator delete(void * /*mem*/, unsigned int, std::align_val_t) noexcept {
   __builtin_trap();
 }

>From 05ef005b91a98f754ff16578a8fc1a4bdccf5939 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 15:56:40 -0400
Subject: [PATCH 05/19] unused

---
 libc/test/src/__support/CPP/integer_sequence_test.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/test/src/__support/CPP/integer_sequence_test.cpp b/libc/test/src/__support/CPP/integer_sequence_test.cpp
index fe378522b446b..56e75f496255f 100644
--- a/libc/test/src/__support/CPP/integer_sequence_test.cpp
+++ b/libc/test/src/__support/CPP/integer_sequence_test.cpp
@@ -23,7 +23,8 @@ TEST(LlvmLibcIntegerSequencetTest, Basic) {
       (is_same_v<ULLSeq, make_integer_sequence<unsigned long long, 4>>));
 }
 
-template <typename T, T... Ts> bool checkArray(integer_sequence<T, Ts...> seq) {
+template <typename T, T... Ts>
+bool checkArray(integer_sequence<T, Ts...> /*seq*/) {
   T arr[sizeof...(Ts)]{Ts...};
 
   for (T i = 0; i < static_cast<T>(sizeof...(Ts)); i++)

>From cf7aeba5dae2f53f02a84acbb40cfca57bcb0bbd Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:15:25 -0400
Subject: [PATCH 06/19] unused

---
 libc/test/UnitTest/FPExceptMatcher.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/UnitTest/FPExceptMatcher.h b/libc/test/UnitTest/FPExceptMatcher.h
index 978501df7e3ed..50ebdbd0ce204 100644
--- a/libc/test/UnitTest/FPExceptMatcher.h
+++ b/libc/test/UnitTest/FPExceptMatcher.h
@@ -43,7 +43,7 @@ class FPExceptMatcher : public Matcher<bool> {
   // Takes ownership of func.
   explicit FPExceptMatcher(FunctionCaller *func);
 
-  bool match(bool unused) { return exceptionRaised; }
+  bool match(bool /*unused*/) { return exceptionRaised; }
 
   void explainError() override {
     tlog << "A floating point exception should have been raised but it "

>From bf8471d65c6b2b1ac61d9b4966d1a2be0ef723e8 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:16:29 -0400
Subject: [PATCH 07/19] unused

---
 libc/test/UnitTest/FPExceptMatcher.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/UnitTest/FPExceptMatcher.cpp b/libc/test/UnitTest/FPExceptMatcher.cpp
index d66066023984e..868c5f8e27dbc 100644
--- a/libc/test/UnitTest/FPExceptMatcher.cpp
+++ b/libc/test/UnitTest/FPExceptMatcher.cpp
@@ -31,7 +31,7 @@ namespace testing {
 static thread_local sigjmp_buf jumpBuffer;
 static thread_local bool caughtExcept;
 
-static void sigfpeHandler(int sig) {
+static void sigfpeHandler(int /*sig*/) {
   caughtExcept = true;
   siglongjmp(jumpBuffer, -1);
 }

>From 6244b9f6b013ad0c0f76bbdf22eabda4ab04d377 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:32:07 -0400
Subject: [PATCH 08/19] [[maybe_unused]]

---
 libc/test/src/__support/freelist_heap_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/src/__support/freelist_heap_test.cpp b/libc/test/src/__support/freelist_heap_test.cpp
index 0623272dd5b9f..be6bb25e96e4a 100644
--- a/libc/test/src/__support/freelist_heap_test.cpp
+++ b/libc/test/src/__support/freelist_heap_test.cpp
@@ -48,7 +48,7 @@ using LIBC_NAMESPACE::cpp::span;
     RunTest(*freelist_heap, freelist_heap->region().size());                   \
   }                                                                            \
   void LlvmLibcFreeListHeapTest##TestCase::RunTest(FreeListHeap &allocator,    \
-                                                   size_t N)
+                                                   [[maybe_unused]] size_t N)
 
 TEST_FOR_EACH_ALLOCATOR(CanAllocate, 2048) {
   constexpr size_t ALLOC_SIZE = 512;

>From 7ae6b90bddeb704ea6a69d93d9129764cfdd9ec7 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:40:35 -0400
Subject: [PATCH 09/19] unused

---
 libc/utils/MPFRWrapper/MPFRUtils.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h
index bc65f87c6b5ab..e8f253afad3ba 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.h
+++ b/libc/utils/MPFRWrapper/MPFRUtils.h
@@ -352,7 +352,7 @@ template <Operation op, typename InputType, typename OutputType>
 __attribute__((no_sanitize("address"))) cpp::enable_if_t<
     is_valid_operation<op, InputType, OutputType>(),
     internal::MPFRMatcher<op, /*is_silent*/ false, InputType, OutputType>>
-get_mpfr_matcher(InputType input, OutputType output_unused,
+get_mpfr_matcher(InputType input, OutputType /*output_unused*/,
                  double ulp_tolerance, RoundingMode rounding) {
   return internal::MPFRMatcher<op, /*is_silent*/ false, InputType, OutputType>(
       input, ulp_tolerance, rounding);
@@ -362,7 +362,7 @@ template <Operation op, typename InputType, typename OutputType>
 __attribute__((no_sanitize("address"))) cpp::enable_if_t<
     is_valid_operation<op, InputType, OutputType>(),
     internal::MPFRMatcher<op, /*is_silent*/ true, InputType, OutputType>>
-get_silent_mpfr_matcher(InputType input, OutputType output_unused,
+get_silent_mpfr_matcher(InputType input, OutputType /*output_unused*/,
                         double ulp_tolerance, RoundingMode rounding) {
   return internal::MPFRMatcher<op, /*is_silent*/ true, InputType, OutputType>(
       input, ulp_tolerance, rounding);

>From 6447e76209ff68826bcd75a8aaaaf625eb968402 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:46:36 -0400
Subject: [PATCH 10/19] unused

---
 libc/test/src/string/memory_utils/op_tests.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp
index 2057ab3eaaded..26d1350a36f22 100644
--- a/libc/test/src/string/memory_utils/op_tests.cpp
+++ b/libc/test/src/string/memory_utils/op_tests.cpp
@@ -72,7 +72,8 @@ void CopyAdaptor(cpp::span<char> dst, cpp::span<char> src, size_t size) {
   FnImpl(as_byte(dst), as_byte(src), size);
 }
 template <size_t Size, auto FnImpl>
-void CopyBlockAdaptor(cpp::span<char> dst, cpp::span<char> src, size_t size) {
+void CopyBlockAdaptor(cpp::span<char> dst, cpp::span<char> src,
+                      size_t /*size*/) {
   FnImpl(as_byte(dst), as_byte(src));
 }
 
@@ -153,7 +154,7 @@ void SetAdaptor(cpp::span<char> dst, uint8_t value, size_t size) {
   FnImpl(as_byte(dst), value, size);
 }
 template <size_t Size, auto FnImpl>
-void SetBlockAdaptor(cpp::span<char> dst, uint8_t value, size_t size) {
+void SetBlockAdaptor(cpp::span<char> dst, uint8_t value, size_t /*size*/) {
   FnImpl(as_byte(dst), value);
 }
 
@@ -242,7 +243,7 @@ int CmpAdaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) {
   return (int)FnImpl(as_byte(p1), as_byte(p2), size);
 }
 template <size_t Size, auto FnImpl>
-int CmpBlockAdaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) {
+int CmpBlockAdaptor(cpp::span<char> p1, cpp::span<char> p2, size_t /*size*/) {
   return (int)FnImpl(as_byte(p1), as_byte(p2));
 }
 

>From 3a2968d77ebf75b2f386c4a755544e5f67fd0b0f Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 20:53:09 -0400
Subject: [PATCH 11/19] unused

---
 libc/test/src/strings/bzero_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/src/strings/bzero_test.cpp b/libc/test/src/strings/bzero_test.cpp
index 4d4112f4be8ee..e3091556da276 100644
--- a/libc/test/src/strings/bzero_test.cpp
+++ b/libc/test/src/strings/bzero_test.cpp
@@ -14,7 +14,7 @@
 namespace LIBC_NAMESPACE_DECL {
 
 // Adapt CheckMemset signature to bzero.
-static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) {
+static inline void Adaptor(cpp::span<char> p1, uint8_t /*value*/, size_t size) {
   LIBC_NAMESPACE::bzero(p1.begin(), size);
 }
 

>From a2cd02af5ada16b6ff23e6f94bc7f8f9c1ddbaaf Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 21:00:18 -0400
Subject: [PATCH 12/19] unused

---
 libc/test/src/stdlib/StrfromTest.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/src/stdlib/StrfromTest.h b/libc/test/src/stdlib/StrfromTest.h
index 197165c68d587..4a7f0eca80644 100644
--- a/libc/test/src/stdlib/StrfromTest.h
+++ b/libc/test/src/stdlib/StrfromTest.h
@@ -357,7 +357,7 @@ class StrfromTest : public LIBC_NAMESPACE::testing::Test {
     ASSERT_STREQ_LEN(written, buff, "1.0e+01");
   }
 
-  void floatDecimalExpLongDoublePrec(FunctionT func) {
+  void floatDecimalExpLongDoublePrec(FunctionT /*func*/) {
     // Mark as maybe_unused to silence unused variable
     // warning when long double is not 80-bit
     [[maybe_unused]] char buff[100];
@@ -422,7 +422,7 @@ class StrfromTest : public LIBC_NAMESPACE::testing::Test {
     ASSERT_STREQ_LEN(written, buff, "1.2340000000000000814e-10");
   }
 
-  void floatDecimalAutoLongDoublePrec(FunctionT func) {
+  void floatDecimalAutoLongDoublePrec(FunctionT /*func*/) {
     // Mark as maybe_unused to silence unused variable
     // warning when long double is not 80-bit
     [[maybe_unused]] char buff[100];

>From c01ad0b5d594a151b9af86f50f3b9a939c15daff Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 21:31:37 -0400
Subject: [PATCH 13/19] [[maybe_unused]]

---
 libc/test/include/stdbit_stub.h | 70 +++++++++++++++++++++++----------
 1 file changed, 49 insertions(+), 21 deletions(-)

diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index 3d2e0fb60334e..e08c86271332e 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,11 +17,21 @@
 #include <stdbool.h> // bool in C
 
 #define STDBIT_STUB_FUNCTION(FUNC_NAME, LEADING_VAL)                           \
-  unsigned FUNC_NAME##_uc(unsigned char x) { return LEADING_VAL##AU; }         \
-  unsigned FUNC_NAME##_us(unsigned short x) { return LEADING_VAL##BU; }        \
-  unsigned FUNC_NAME##_ui(unsigned int x) { return LEADING_VAL##CU; }          \
-  unsigned FUNC_NAME##_ul(unsigned long x) { return LEADING_VAL##DU; }         \
-  unsigned FUNC_NAME##_ull(unsigned long long x) { return LEADING_VAL##EU; }
+  unsigned FUNC_NAME##_uc([[maybe_unused]] unsigned char x) {                  \
+    return LEADING_VAL##AU;                                                    \
+  }                                                                            \
+  unsigned FUNC_NAME##_us([[maybe_unused]] unsigned short x) {                 \
+    return LEADING_VAL##BU;                                                    \
+  }                                                                            \
+  unsigned FUNC_NAME##_ui([[maybe_unused]] unsigned int x) {                   \
+    return LEADING_VAL##CU;                                                    \
+  }                                                                            \
+  unsigned FUNC_NAME##_ul([[maybe_unused]] unsigned long x) {                  \
+    return LEADING_VAL##DU;                                                    \
+  }                                                                            \
+  unsigned FUNC_NAME##_ull([[maybe_unused]] unsigned long long x) {            \
+    return LEADING_VAL##EU;                                                    \
+  }
 
 __BEGIN_C_DECLS
 
@@ -36,24 +46,42 @@ STDBIT_STUB_FUNCTION(stdc_first_trailing_one, 0x1)
 STDBIT_STUB_FUNCTION(stdc_count_zeros, 0x2)
 STDBIT_STUB_FUNCTION(stdc_count_ones, 0x3)
 
-bool stdc_has_single_bit_uc(unsigned char x) { return false; }
-bool stdc_has_single_bit_us(unsigned short x) { return false; }
-bool stdc_has_single_bit_ui(unsigned x) { return false; }
-bool stdc_has_single_bit_ul(unsigned long x) { return false; }
-bool stdc_has_single_bit_ull(unsigned long long x) { return false; }
+bool stdc_has_single_bit_uc([[maybe_unused]] unsigned char x) { return false; }
+bool stdc_has_single_bit_us([[maybe_unused]] unsigned short x) { return false; }
+bool stdc_has_single_bit_ui([[maybe_unused]] unsigned x) { return false; }
+bool stdc_has_single_bit_ul([[maybe_unused]] unsigned long x) { return false; }
+bool stdc_has_single_bit_ull([[maybe_unused]] unsigned long long x) {
+  return false;
+}
 
 STDBIT_STUB_FUNCTION(stdc_bit_width, 0x4)
 
-unsigned char stdc_bit_floor_uc(unsigned char x) { return 0x5AU; }
-unsigned short stdc_bit_floor_us(unsigned short x) { return 0x5BU; }
-unsigned stdc_bit_floor_ui(unsigned x) { return 0x5CU; }
-unsigned long stdc_bit_floor_ul(unsigned long x) { return 0x5DUL; }
-unsigned long long stdc_bit_floor_ull(unsigned long long x) { return 0x5EULL; }
-
-unsigned char stdc_bit_ceil_uc(unsigned char x) { return 0x6AU; }
-unsigned short stdc_bit_ceil_us(unsigned short x) { return 0x6BU; }
-unsigned stdc_bit_ceil_ui(unsigned x) { return 0x6CU; }
-unsigned long stdc_bit_ceil_ul(unsigned long x) { return 0x6DUL; }
-unsigned long long stdc_bit_ceil_ull(unsigned long long x) { return 0x6EULL; }
+unsigned char stdc_bit_floor_uc([[maybe_unused]] unsigned char x) {
+  return 0x5AU;
+}
+unsigned short stdc_bit_floor_us([[maybe_unused]] unsigned short x) {
+  return 0x5BU;
+}
+unsigned stdc_bit_floor_ui([[maybe_unused]] unsigned x) { return 0x5CU; }
+unsigned long stdc_bit_floor_ul([[maybe_unused]] unsigned long x) {
+  return 0x5DUL;
+}
+unsigned long long stdc_bit_floor_ull([[maybe_unused]] unsigned long long x) {
+  return 0x5EULL;
+}
+
+unsigned char stdc_bit_ceil_uc([[maybe_unused]] unsigned char x) {
+  return 0x6AU;
+}
+unsigned short stdc_bit_ceil_us([[maybe_unused]] unsigned short x) {
+  return 0x6BU;
+}
+unsigned stdc_bit_ceil_ui([[maybe_unused]] unsigned x) { return 0x6CU; }
+unsigned long stdc_bit_ceil_ul([[maybe_unused]] unsigned long x) {
+  return 0x6DUL;
+}
+unsigned long long stdc_bit_ceil_ull([[maybe_unused]] unsigned long long x) {
+  return 0x6EULL;
+}
 
 __END_C_DECLS

>From c018d53cca07cc0fbb172d018bfb9f772cd88241 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 21:38:16 -0400
Subject: [PATCH 14/19] unused

---
 libc/test/integration/startup/linux/main_without_envp.cpp | 2 +-
 libc/test/integration/startup/linux/tls_test.cpp          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/integration/startup/linux/main_without_envp.cpp b/libc/test/integration/startup/linux/main_without_envp.cpp
index d2c24f4bd9f14..0e4171879aa85 100644
--- a/libc/test/integration/startup/linux/main_without_envp.cpp
+++ b/libc/test/integration/startup/linux/main_without_envp.cpp
@@ -8,4 +8,4 @@
 
 #include "test/IntegrationTest/test.h"
 
-TEST_MAIN(int argc, char **argv) { return 0; }
+TEST_MAIN(int /*argc*/, char ** /*argv*/) { return 0; }
diff --git a/libc/test/integration/startup/linux/tls_test.cpp b/libc/test/integration/startup/linux/tls_test.cpp
index ef9fd9fcb7ff4..b1f9aff112c75 100644
--- a/libc/test/integration/startup/linux/tls_test.cpp
+++ b/libc/test/integration/startup/linux/tls_test.cpp
@@ -15,7 +15,7 @@
 constexpr int threadLocalDataSize = 101;
 _Thread_local int a[threadLocalDataSize] = {123};
 
-TEST_MAIN(int argc, char **argv, char **envp) {
+TEST_MAIN(int /*argc*/, char ** /*argv*/, char ** /*envp*/) {
   ASSERT_TRUE(a[0] == 123);
 
   for (int i = 1; i < threadLocalDataSize; ++i)

>From 92d1f5fe1d2eac3bf28a292144ca9f8745afdf43 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 21:44:04 -0400
Subject: [PATCH 15/19] unused

---
 libc/test/integration/src/pthread/pthread_mutex_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/integration/src/pthread/pthread_mutex_test.cpp b/libc/test/integration/src/pthread/pthread_mutex_test.cpp
index 137daed6bd283..b9a0991255040 100644
--- a/libc/test/integration/src/pthread/pthread_mutex_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_mutex_test.cpp
@@ -25,7 +25,7 @@ constexpr int MAX = 10000;
 pthread_mutex_t mutex;
 static int shared_int = START;
 
-void *counter(void *arg) {
+void *counter(void * /*arg*/) {
   int last_count = START;
   while (true) {
     LIBC_NAMESPACE::pthread_mutex_lock(&mutex);
@@ -74,7 +74,7 @@ void relay_counter() {
 pthread_mutex_t start_lock, step_lock;
 bool started, step;
 
-void *stepper(void *arg) {
+void *stepper(void * /*arg*/) {
   LIBC_NAMESPACE::pthread_mutex_lock(&start_lock);
   started = true;
   LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock);

>From aa69cb22e9ac878a82dc6c8d36aace2b1233cc06 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 21:53:41 -0400
Subject: [PATCH 16/19] unused

---
 libc/test/integration/src/spawn/posix_spawn_test_binary.cpp | 2 +-
 libc/test/integration/src/stdio/sprintf_size_test.cpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp b/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp
index c1b0cd671da71..aeacf817dc445 100644
--- a/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp
+++ b/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp
@@ -2,7 +2,7 @@
 #include <string.h>
 #include <unistd.h>
 
-int main(int argc, char **argv) {
+int main(int argc, char ** /*argv*/) {
   if (argc != 1)
     return 5;
   constexpr size_t bufsize = sizeof(TEXT);
diff --git a/libc/test/integration/src/stdio/sprintf_size_test.cpp b/libc/test/integration/src/stdio/sprintf_size_test.cpp
index 833159436d49c..f69681228dcb2 100644
--- a/libc/test/integration/src/stdio/sprintf_size_test.cpp
+++ b/libc/test/integration/src/stdio/sprintf_size_test.cpp
@@ -38,7 +38,7 @@ static int my_strlen(const char *str) {
   return static_cast<int>(other - str);
 }
 
-TEST_MAIN(int argc, char **argv, char **envp) {
+TEST_MAIN(int argc, char **argv, char ** /*envp*/) {
   ASSERT_EQ(argc, 5);
   ASSERT_TRUE(my_streq(argv[1], "%s %c %d"));
   ASSERT_EQ(my_strlen(argv[1]), 8);

>From 768cb89dc6f9be449a7d6dbf571e5580ec83912a Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 22:04:20 -0400
Subject: [PATCH 17/19] unused

---
 libc/test/integration/src/spawn/posix_spawn_test.cpp | 2 +-
 libc/test/integration/src/stdlib/getenv_test.cpp     | 2 +-
 libc/test/integration/src/threads/mtx_test.cpp       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/test/integration/src/spawn/posix_spawn_test.cpp b/libc/test/integration/src/spawn/posix_spawn_test.cpp
index 104096c40c3ab..6192ac2448685 100644
--- a/libc/test/integration/src/spawn/posix_spawn_test.cpp
+++ b/libc/test/integration/src/spawn/posix_spawn_test.cpp
@@ -45,7 +45,7 @@ void spawn_and_wait_for_normal_exit(char **envp) {
   ASSERT_EQ(exit_status, 0);
 }
 
-TEST_MAIN(int argc, char **argv, char **envp) {
+TEST_MAIN(int /*argc*/, char ** /*argv*/, char **envp) {
   spawn_and_wait_for_normal_exit(envp);
   return 0;
 }
diff --git a/libc/test/integration/src/stdlib/getenv_test.cpp b/libc/test/integration/src/stdlib/getenv_test.cpp
index 82a9b89533d2e..d18e0453e1968 100644
--- a/libc/test/integration/src/stdlib/getenv_test.cpp
+++ b/libc/test/integration/src/stdlib/getenv_test.cpp
@@ -27,7 +27,7 @@ static bool my_streq(const char *lhs, const char *rhs) {
   return *l == '\0' && *r == '\0';
 }
 
-TEST_MAIN(int argc, char **argv, char **envp) {
+TEST_MAIN(int /*argc*/, char ** /*argv*/, char ** /*envp*/) {
   ASSERT_TRUE(
       my_streq(LIBC_NAMESPACE::getenv(""), static_cast<char *>(nullptr)));
   ASSERT_TRUE(
diff --git a/libc/test/integration/src/threads/mtx_test.cpp b/libc/test/integration/src/threads/mtx_test.cpp
index 82b0350af97af..7596ce31990ff 100644
--- a/libc/test/integration/src/threads/mtx_test.cpp
+++ b/libc/test/integration/src/threads/mtx_test.cpp
@@ -23,7 +23,7 @@ constexpr int MAX = 10000;
 mtx_t mutex;
 static int shared_int = START;
 
-int counter(void *arg) {
+int counter(void * /*arg*/) {
   int last_count = START;
   while (true) {
     LIBC_NAMESPACE::mtx_lock(&mutex);

>From 1e82924e6005ec8d2072bad24523fbb73bf1e2a6 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 22:18:18 -0400
Subject: [PATCH 18/19] unused

---
 libc/test/integration/src/threads/mtx_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/integration/src/threads/mtx_test.cpp b/libc/test/integration/src/threads/mtx_test.cpp
index 7596ce31990ff..421137878ed1e 100644
--- a/libc/test/integration/src/threads/mtx_test.cpp
+++ b/libc/test/integration/src/threads/mtx_test.cpp
@@ -74,7 +74,7 @@ void relay_counter() {
 mtx_t start_lock, step_lock;
 bool started, step;
 
-int stepper(void *arg) {
+int stepper(void * /*arg*/) {
   LIBC_NAMESPACE::mtx_lock(&start_lock);
   started = true;
   LIBC_NAMESPACE::mtx_unlock(&start_lock);

>From 43da992493e95fb899e0863571c520575cea9c0f Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Tue, 1 Apr 2025 22:27:27 -0400
Subject: [PATCH 19/19] unused

---
 libc/test/integration/src/unistd/getcwd_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp
index 551768187bf01..6d76fc8e030f9 100644
--- a/libc/test/integration/src/unistd/getcwd_test.cpp
+++ b/libc/test/integration/src/unistd/getcwd_test.cpp
@@ -17,7 +17,7 @@
 
 using LIBC_NAMESPACE::cpp::string_view;
 
-TEST_MAIN(int argc, char **argv, char **envp) {
+TEST_MAIN(int /*argc*/, char ** /*argv*/, char ** /*envp*/) {
   char buffer[1024];
   ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) ==
               LIBC_NAMESPACE::getcwd(buffer, 1024));



More information about the libc-commits mailing list