Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,18 @@ function(_get_common_test_compile_options output_var c_test flags)
list(APPEND compile_options "-ffixed-point")
endif()

# list(APPEND compile_options "-Wall")
# list(APPEND compile_options "-Wextra")
list(APPEND compile_options "-Wall")
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")
list(APPEND compile_options "-Werror")
list(APPEND compile_options "-Wno-global-constructors")
endif()
# 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 "-Wextra-semi")
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 "-Wextra-semi")
# Silence this warning because _Complex is a part of C99.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(NOT c_test)
Expand All @@ -262,13 +263,13 @@ function(_get_common_test_compile_options output_var c_test flags)
list(APPEND compile_options "-Wno-gnu-imaginary-constant")
endif()
list(APPEND compile_options "-Wno-pedantic")
# if(NOT CMAKE_COMPILER_IS_GNUCXX)
# list(APPEND compile_options "-Wnewline-eof")
# list(APPEND compile_options "-Wnonportable-system-include-path")
# list(APPEND compile_options "-Wstrict-prototypes")
# list(APPEND compile_options "-Wthread-safety")
# list(APPEND compile_options "-Wglobal-constructors")
# endif()
if(NOT CMAKE_COMPILER_IS_GNUCXX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://cmake.org/cmake/help/latest/variable/CMAKE_COMPILER_IS_GNUCXX.html mentions that this is deprecated and that CMAKE_CXX_COMPILER_ID should be used instead.

It looks fishy to me because "not gcc" isn't necessarily clang, and yet -Wthread-safety is very much so currently a clang specific diagnostic. Instead, the conditional should be phrased as "if clang" rather than "if not gcc."

So if anything this looks like it should be folded into the above else clause that's already testing CMAKE_CXX_COMPILER_ID, or rather a new clause that's `elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

Copy link
Contributor Author

@vinay-deshmukh vinay-deshmukh Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this change, instead of STREQUAL, I used MATCHES so all Clang-like compilers also fall into this case.

list(APPEND compile_options "-Wnewline-eof")
list(APPEND compile_options "-Wnonportable-system-include-path")
list(APPEND compile_options "-Wstrict-prototypes")
list(APPEND compile_options "-Wthread-safety")
# list(APPEND compile_options "-Wglobal-constructors") # triggered in TEST_F implementation
endif()
endif()
set(${output_var} ${compile_options} PARENT_SCOPE)
endfunction()
Expand Down
4 changes: 2 additions & 2 deletions libc/src/__support/CPP/bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ rotl(T value, int rotate) {
return value;
if (rotate < 0)
return cpp::rotr<T>(value, -rotate);
return (value << rotate) | (value >> (N - rotate));
return static_cast<T>((value << rotate) | (value >> (N - rotate)));
}

template <typename T>
Expand All @@ -244,7 +244,7 @@ rotr(T value, int rotate) {
return value;
if (rotate < 0)
return cpp::rotl<T>(value, -rotate);
return (value >> rotate) | (value << (N - rotate));
return static_cast<T>((value >> rotate) | (value << (N - rotate)));
}

// TODO: Do we need this function at all? How is it different from
Expand Down
2 changes: 1 addition & 1 deletion libc/src/string/memory_utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ LIBC_INLINE void store_aligned(ValueType value, Ptr dst) {
static_assert(sizeof(ValueType) >= (sizeof(T) + ... + sizeof(TS)));
constexpr size_t SHIFT = sizeof(T) * 8;
if constexpr (Endian::IS_LITTLE) {
store<T>(assume_aligned<sizeof(T)>(dst), value & ~T(0));
store<T>(assume_aligned<sizeof(T)>(dst), static_cast<T>(value & ~T(0)));
if constexpr (sizeof...(TS) > 0)
store_aligned<ValueType, TS...>(value >> SHIFT, dst + sizeof(T));
} else if constexpr (Endian::IS_BIG) {
Expand Down
10 changes: 5 additions & 5 deletions libc/test/UnitTest/HermeticTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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); }

Expand All @@ -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
Expand All @@ -145,8 +145,8 @@ 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 *, std::align_val_t) noexcept { __builtin_trap(); }

void operator delete(void *mem, unsigned int, std::align_val_t) noexcept {
void operator delete(void *, unsigned int, std::align_val_t) noexcept {
__builtin_trap();
}
2 changes: 1 addition & 1 deletion libc/test/UnitTest/LibcDeathTestExecutors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libc/test/UnitTest/LibcTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used this style to disable "unused-parameter".

let me know if LLVM prefers [[maybe_unused]] over this instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the llvm style guide doesn't say. So I'm ok with what you've chosen.

};

struct RunContext {
Expand Down
42 changes: 21 additions & 21 deletions libc/test/include/stdbit_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion libc/test/src/__support/CPP/bit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TYPED_TEST(LlvmLibcBitTest, HasSingleBit, UnsignedTypes) {
constexpr auto LSB = T(1);
constexpr auto MSB = T(~(ALL_ONES >> 1));
for (T value = 1; value; value <<= 1) {
auto two_bits_value = value | ((value <= MIDPOINT) ? MSB : LSB);
T two_bits_value = value | ((value <= MIDPOINT) ? MSB : LSB);
EXPECT_FALSE(has_single_bit<T>(two_bits_value));
}
}
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/__support/CPP/integer_sequence_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
9 changes: 5 additions & 4 deletions libc/test/src/__support/arg_list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ long int check_primitives(int first, ...) {
count += args.next_var<unsigned long>();
count += args.next_var<long long>();
count += args.next_var<unsigned long long>();
count += args.next_var<double>();
count += args.next_var<double>();
count += args.next_var<long double>();
count += static_cast<long>(args.next_var<double>());
count += static_cast<long>(args.next_var<double>());
count += static_cast<long>(args.next_var<long double>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind changing the return type and type of count to just long? int is implied, and isn't specified generally throughout llvm.

Same for check_struct_type below.

count += *args.next_var<int *>();
return count;
}
Expand Down Expand Up @@ -112,7 +112,8 @@ long int check_struct_type(int first, ...) {

S s = args.next_var<S>();
int last = args.next_var<int>();
return s.c + s.s + s.i + s.l + s.f + s.d + last;
return s.c + s.s + s.i + s.l + static_cast<long>(s.f) +
static_cast<long>(s.d) + last;
}

TEST(LlvmLibcArgListTest, TestStructTypes) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/big_int_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ TYPED_TEST(LlvmLibcUIntClassTest, CountBits, Types) {
for (size_t i = 0; i < T::BITS; ++i) {
const auto l_one = T::all_ones() << i; // 0b111...000
const auto r_one = T::all_ones() >> i; // 0b000...111
const int zeros = i;
const int zeros = static_cast<int>(i);
const int ones = T::BITS - zeros;
ASSERT_EQ(cpp::countr_one(r_one), ones);
ASSERT_EQ(cpp::countl_one(l_one), ones);
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/hash_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST(LlvmLibcHashTest, Avalanche) {
}
for (size_t i = 0; i < sz; ++i) {
for (size_t j = 0; j < 8; ++j) {
uint8_t mask = 1 << j;
uint8_t mask = static_cast<uint8_t>(1 << j);
mem.data[i] ^= mask;
{
LIBC_NAMESPACE::internal::HashState state{0xabcdef1234567890};
Expand Down
8 changes: 4 additions & 4 deletions libc/test/src/__support/math_extras_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,27 @@ TEST(LlvmLibcBlockMathExtrasTest, mask_trailing_ones) {
TYPED_TEST(LlvmLibcBitTest, FirstLeadingZero, UnsignedTypesNoBigInt) {
EXPECT_EQ(first_leading_zero<T>(cpp::numeric_limits<T>::max()), 0);
for (int i = 0U; i != cpp::numeric_limits<T>::digits; ++i)
EXPECT_EQ(first_leading_zero<T>(~(T(1) << i)),
EXPECT_EQ(first_leading_zero<T>(static_cast<T>(~(T(1) << i))),
cpp::numeric_limits<T>::digits - i);
}

TYPED_TEST(LlvmLibcBitTest, FirstLeadingOne, UnsignedTypesNoBigInt) {
EXPECT_EQ(first_leading_one<T>(static_cast<T>(0)), 0);
for (int i = 0U; i != cpp::numeric_limits<T>::digits; ++i)
EXPECT_EQ(first_leading_one<T>(T(1) << i),
EXPECT_EQ(first_leading_one<T>(static_cast<T>(T(1) << i)),
cpp::numeric_limits<T>::digits - i);
}

TYPED_TEST(LlvmLibcBitTest, FirstTrailingZero, UnsignedTypesNoBigInt) {
EXPECT_EQ(first_trailing_zero<T>(cpp::numeric_limits<T>::max()), 0);
for (int i = 0U; i != cpp::numeric_limits<T>::digits; ++i)
EXPECT_EQ(first_trailing_zero<T>(~(T(1) << i)), i + 1);
EXPECT_EQ(first_trailing_zero<T>(static_cast<T>(~(T(1) << i))), i + 1);
}

TYPED_TEST(LlvmLibcBitTest, FirstTrailingOne, UnsignedTypesNoBigInt) {
EXPECT_EQ(first_trailing_one<T>(cpp::numeric_limits<T>::max()), 0);
for (int i = 0U; i != cpp::numeric_limits<T>::digits; ++i)
EXPECT_EQ(first_trailing_one<T>(T(1) << i), i + 1);
EXPECT_EQ(first_trailing_one<T>(static_cast<T>(T(1) << i)), i + 1);
}

TYPED_TEST(LlvmLibcBitTest, CountZeros, UnsignedTypesNoBigInt) {
Expand Down
8 changes: 4 additions & 4 deletions libc/test/src/math/FModTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

// fmod (+inf, y) == aNaN plus invalid exception.
TEST_SPECIAL(inf, 3.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, -1.1L, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, static_cast<T>(-1.1L), aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, min_denormal, aNaN, true, FE_INVALID);
Expand All @@ -65,7 +65,7 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

// fmod (-inf, y) == aNaN plus invalid exception.
TEST_SPECIAL(neg_inf, 3.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, -1.1L, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, static_cast<T>(-1.1L), aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, min_denormal, aNaN, true, FE_INVALID);
Expand All @@ -76,7 +76,7 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

// fmod (x, +0) == aNaN plus invalid exception.
TEST_SPECIAL(3.0, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(-1.1L, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(static_cast<T>(-1.1L), 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(0.0, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_zero, 0.0, aNaN, true, FE_INVALID);
TEST_SPECIAL(min_denormal, 0.0, aNaN, true, FE_INVALID);
Expand All @@ -85,7 +85,7 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

// fmod (x, -0) == aNaN plus invalid exception.
TEST_SPECIAL(3.0, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(-1.1L, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(static_cast<T>(-1.1L), neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(0.0, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_zero, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(min_denormal, neg_zero, aNaN, true, FE_INVALID);
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/nan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LlvmLibcNanTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<double>(result);
auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<double>(bits);
EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
};
}
};

TEST_F(LlvmLibcNanTest, NCharSeq) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/nanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LlvmLibcNanfTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<float>(result);
auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<float>(bits);
EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
};
}
};

TEST_F(LlvmLibcNanfTest, NCharSeq) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/nanl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class LlvmLibcNanlTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(result);
auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(bits);
EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
};
}
};

TEST_F(LlvmLibcNanlTest, NCharSeq) {
Expand Down
7 changes: 4 additions & 3 deletions libc/test/src/string/memory_utils/op_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/strings/bzero_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions libc/utils/MPFRWrapper/MPFRUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Loading