[libc-commits] [libc] [libc] `-Wunused-parameter` and few NOOPs (PR #124036)
Vinay Deshmukh via libc-commits
libc-commits at lists.llvm.org
Wed Jan 22 17:48:32 PST 2025
https://github.com/vinay-deshmukh updated https://github.com/llvm/llvm-project/pull/124036
>From d600a01005748fba46bea3d52f170dc535496f47 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 18:42:55 -0500
Subject: [PATCH 1/9] -Wwrite-strings
---
libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 96fa6c3a707e47..8f78d3a4e9c8a6 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -34,7 +34,7 @@ function(_get_common_test_compile_options output_var c_test flags)
# list(APPEND compile_options "-Wconversion")
# list(APPEND compile_options "-Wno-sign-conversion")
# list(APPEND compile_options "-Wimplicit-fallthrough")
- # list(APPEND compile_options "-Wwrite-strings")
+ list(APPEND compile_options "-Wwrite-strings")
list(APPEND compile_options "-Wextra-semi")
# Silence this warning because _Complex is a part of C99.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
>From 1c5c871c2a71ead4553f5c418856c51e168ca1c0 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 18:44:56 -0500
Subject: [PATCH 2/9] -Wimplicit-fallthrough
---
libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 8f78d3a4e9c8a6..29b9eddfe5244f 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -33,7 +33,7 @@ function(_get_common_test_compile_options output_var c_test flags)
endif()
# list(APPEND compile_options "-Wconversion")
# list(APPEND compile_options "-Wno-sign-conversion")
- # list(APPEND compile_options "-Wimplicit-fallthrough")
+ list(APPEND compile_options "-Wimplicit-fallthrough")
list(APPEND compile_options "-Wwrite-strings")
list(APPEND compile_options "-Wextra-semi")
# Silence this warning because _Complex is a part of C99.
>From dfb1fbbae39e3ee0c10bac16b5c8192f93ab8a72 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 19:17:19 -0500
Subject: [PATCH 3/9] -Wextra -> -Wunused-parameter
---
libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
libc/test/UnitTest/LibcDeathTestExecutors.cpp | 2 +-
libc/test/UnitTest/LibcTest.h | 2 +-
libc/test/src/__support/CPP/integer_sequence_test.cpp | 2 +-
libc/test/src/string/memory_utils/op_tests.cpp | 6 +++---
libc/test/src/strings/bzero_test.cpp | 2 +-
libc/utils/MPFRWrapper/MPFRUtils.h | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 29b9eddfe5244f..82d2f0a4f83e9a 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -26,7 +26,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")
diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
index 943e2c23c5fde9..f2b048864b556c 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);
diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h
index b4e3819ea958de..124748ba343270 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 {
diff --git a/libc/test/src/__support/CPP/integer_sequence_test.cpp b/libc/test/src/__support/CPP/integer_sequence_test.cpp
index fe378522b446b9..3a5ad77c9e8747 100644
--- a/libc/test/src/__support/CPP/integer_sequence_test.cpp
+++ b/libc/test/src/__support/CPP/integer_sequence_test.cpp
@@ -23,7 +23,7 @@ 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++)
diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp
index c6197d1afa266b..0b12c7da003f3c 100644
--- a/libc/test/src/string/memory_utils/op_tests.cpp
+++ b/libc/test/src/string/memory_utils/op_tests.cpp
@@ -72,7 +72,7 @@ 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 +153,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 +242,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));
}
diff --git a/libc/test/src/strings/bzero_test.cpp b/libc/test/src/strings/bzero_test.cpp
index 4d4112f4be8ee1..e3091556da2762 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);
}
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h
index c7a57819f68b79..791936d78cb67d 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 278d665b38a74034591f35e642c6dbff84e9ff73 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 19:28:41 -0500
Subject: [PATCH 4/9] format
---
libc/test/src/__support/CPP/integer_sequence_test.cpp | 3 ++-
libc/test/src/string/memory_utils/op_tests.cpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/test/src/__support/CPP/integer_sequence_test.cpp b/libc/test/src/__support/CPP/integer_sequence_test.cpp
index 3a5ad77c9e8747..56e75f496255f5 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++)
diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp
index 0b12c7da003f3c..dd7619240417ef 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));
}
>From cdce8de37b935882ff0b500482aaaabac36e478d Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:01:49 -0500
Subject: [PATCH 5/9] unused parameter x
---
libc/test/include/stdbit_stub.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index 3d2e0fb60334eb..fc80dc40438158 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,11 +17,11 @@
#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(unsigned char) { return LEADING_VAL##AU; } \
+ unsigned FUNC_NAME##_us(unsigned short) { return LEADING_VAL##BU; } \
+ unsigned FUNC_NAME##_ui(unsigned int) { return LEADING_VAL##CU; } \
+ unsigned FUNC_NAME##_ul(unsigned long) { return LEADING_VAL##DU; } \
+ unsigned FUNC_NAME##_ull(unsigned long long) { return LEADING_VAL##EU; }
__BEGIN_C_DECLS
>From fc4c55acd696b5e0d65c08d272aef3969ff5e3ac Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:32:14 -0500
Subject: [PATCH 6/9] format
---
libc/test/include/stdbit_stub.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index fc80dc40438158..e5bdb79d95c99e 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,10 +17,10 @@
#include <stdbool.h> // bool in C
#define STDBIT_STUB_FUNCTION(FUNC_NAME, LEADING_VAL) \
- unsigned FUNC_NAME##_uc(unsigned char) { return LEADING_VAL##AU; } \
- unsigned FUNC_NAME##_us(unsigned short) { return LEADING_VAL##BU; } \
- unsigned FUNC_NAME##_ui(unsigned int) { return LEADING_VAL##CU; } \
- unsigned FUNC_NAME##_ul(unsigned long) { return LEADING_VAL##DU; } \
+ unsigned FUNC_NAME##_uc(unsigned char) { return LEADING_VAL##AU; } \
+ unsigned FUNC_NAME##_us(unsigned short) { return LEADING_VAL##BU; } \
+ unsigned FUNC_NAME##_ui(unsigned int) { return LEADING_VAL##CU; } \
+ unsigned FUNC_NAME##_ul(unsigned long) { return LEADING_VAL##DU; } \
unsigned FUNC_NAME##_ull(unsigned long long) { return LEADING_VAL##EU; }
__BEGIN_C_DECLS
>From 91fd323f8f990dd2081af4ef5cb98e89bd04419b Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:33:55 -0500
Subject: [PATCH 7/9] more unused
---
libc/test/include/stdbit_stub.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index e5bdb79d95c99e..e7b887cf4f3734 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -36,24 +36,24 @@ 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(unsigned char) { return false; }
+bool stdc_has_single_bit_us(unsigned short) { return false; }
+bool stdc_has_single_bit_ui(unsigned) { return false; }
+bool stdc_has_single_bit_ul(unsigned long) { return false; }
+bool stdc_has_single_bit_ull(unsigned long long) { 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(unsigned char) { return 0x5AU; }
+unsigned short stdc_bit_floor_us(unsigned short) { return 0x5BU; }
+unsigned stdc_bit_floor_ui(unsigned) { return 0x5CU; }
+unsigned long stdc_bit_floor_ul(unsigned long) { return 0x5DUL; }
+unsigned long long stdc_bit_floor_ull(unsigned long long) { return 0x5EULL; }
+
+unsigned char stdc_bit_ceil_uc(unsigned char) { return 0x6AU; }
+unsigned short stdc_bit_ceil_us(unsigned short) { return 0x6BU; }
+unsigned stdc_bit_ceil_ui(unsigned) { return 0x6CU; }
+unsigned long stdc_bit_ceil_ul(unsigned long) { return 0x6DUL; }
+unsigned long long stdc_bit_ceil_ull(unsigned long long) { return 0x6EULL; }
__END_C_DECLS
>From 18f587d69b6a7167322561f33138a915e7b8e94b Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:42:27 -0500
Subject: [PATCH 8/9] error: omitting the parameter name in a function
definition is a C23 extension [-Werror,-Wc23-extensions]
---
libc/test/include/stdbit_stub.h | 42 ++++++++++++++++-----------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index e7b887cf4f3734..7436f70710719d 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,11 +17,11 @@
#include <stdbool.h> // bool in C
#define STDBIT_STUB_FUNCTION(FUNC_NAME, LEADING_VAL) \
- unsigned FUNC_NAME##_uc(unsigned char) { return LEADING_VAL##AU; } \
- unsigned FUNC_NAME##_us(unsigned short) { return LEADING_VAL##BU; } \
- unsigned FUNC_NAME##_ui(unsigned int) { return LEADING_VAL##CU; } \
- unsigned FUNC_NAME##_ul(unsigned long) { return LEADING_VAL##DU; } \
- unsigned FUNC_NAME##_ull(unsigned long long) { return LEADING_VAL##EU; }
+ 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; }
__BEGIN_C_DECLS
@@ -36,24 +36,24 @@ 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) { return false; }
-bool stdc_has_single_bit_us(unsigned short) { return false; }
-bool stdc_has_single_bit_ui(unsigned) { return false; }
-bool stdc_has_single_bit_ul(unsigned long) { return false; }
-bool stdc_has_single_bit_ull(unsigned long long) { return false; }
+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; }
STDBIT_STUB_FUNCTION(stdc_bit_width, 0x4)
-unsigned char stdc_bit_floor_uc(unsigned char) { return 0x5AU; }
-unsigned short stdc_bit_floor_us(unsigned short) { return 0x5BU; }
-unsigned stdc_bit_floor_ui(unsigned) { return 0x5CU; }
-unsigned long stdc_bit_floor_ul(unsigned long) { return 0x5DUL; }
-unsigned long long stdc_bit_floor_ull(unsigned long long) { return 0x5EULL; }
-
-unsigned char stdc_bit_ceil_uc(unsigned char) { return 0x6AU; }
-unsigned short stdc_bit_ceil_us(unsigned short) { return 0x6BU; }
-unsigned stdc_bit_ceil_ui(unsigned) { return 0x6CU; }
-unsigned long stdc_bit_ceil_ul(unsigned long) { return 0x6DUL; }
-unsigned long long stdc_bit_ceil_ull(unsigned long long) { return 0x6EULL; }
+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; }
__END_C_DECLS
>From ca5a280af1494e3f12cae296d0225bdd533f5d30 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:48:14 -0500
Subject: [PATCH 9/9] format
---
libc/test/include/stdbit_stub.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index 7436f70710719d..1c8da750797c5c 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,10 +17,10 @@
#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##_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; }
__BEGIN_C_DECLS
@@ -48,12 +48,16 @@ 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 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 long long stdc_bit_ceil_ull(unsigned long long /*x*/) {
+ return 0x6EULL;
+}
__END_C_DECLS
More information about the libc-commits
mailing list