[libc-commits] [libc] [libc] Fix arm32 tests (PR #74457)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Tue Dec 5 04:17:30 PST 2023
https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/74457
`ASSERT_EQ` requires that both operands have the same type but on arm32 `size_t` is `unsigned int` instead of `unsigned long`. Using `size_t` explicitely to avoid "conflicting types for parameter 'ValType'"
>From 5fcd3b1b012c9c1e7ae5bb2698031eb4101f14e3 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Tue, 5 Dec 2023 12:14:40 +0000
Subject: [PATCH] [libc] Fix arm32 tests
---
libc/test/src/__support/memory_size_test.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libc/test/src/__support/memory_size_test.cpp b/libc/test/src/__support/memory_size_test.cpp
index 3cfddeb499d48..80cb195185126 100644
--- a/libc/test/src/__support/memory_size_test.cpp
+++ b/libc/test/src/__support/memory_size_test.cpp
@@ -83,13 +83,13 @@ TEST(LlvmLibcMemSizeTest, AlignUp) {
}
TEST(LlvmLibcBlockBitTest, OffsetTo) {
- ASSERT_EQ(SafeMemSize::offset_to(0, 512), 0UL);
- ASSERT_EQ(SafeMemSize::offset_to(1, 512), 511UL);
- ASSERT_EQ(SafeMemSize::offset_to(2, 512), 510UL);
- ASSERT_EQ(SafeMemSize::offset_to(13, 1), 0UL);
- ASSERT_EQ(SafeMemSize::offset_to(13, 4), 3UL);
+ ASSERT_EQ(SafeMemSize::offset_to(0, 512), size_t(0));
+ ASSERT_EQ(SafeMemSize::offset_to(1, 512), size_t(511));
+ ASSERT_EQ(SafeMemSize::offset_to(2, 512), size_t(510));
+ ASSERT_EQ(SafeMemSize::offset_to(13, 1), size_t(0));
+ ASSERT_EQ(SafeMemSize::offset_to(13, 4), size_t(3));
for (unsigned int i = 0; i < 31; ++i) {
- ASSERT_EQ((SafeMemSize::offset_to(i, 1u << i) + i) % (1u << i), 0UL);
+ ASSERT_EQ((SafeMemSize::offset_to(i, 1u << i) + i) % (1u << i), size_t(0));
}
}
} // namespace internal
More information about the libc-commits
mailing list