[libc-commits] [libc] [libc] Fix arm32 tests (PR #74457)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Dec 5 04:19:12 PST 2023


https://github.com/gchatelet updated https://github.com/llvm/llvm-project/pull/74457

>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 1/2] [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

>From dabe6e8937995baadc6774a49586b0968359062f Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Tue, 5 Dec 2023 12:18:57 +0000
Subject: [PATCH 2/2] Use consistent construction throughout the file

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

diff --git a/libc/test/src/__support/memory_size_test.cpp b/libc/test/src/__support/memory_size_test.cpp
index 80cb195185126..93ef3711d40e0 100644
--- a/libc/test/src/__support/memory_size_test.cpp
+++ b/libc/test/src/__support/memory_size_test.cpp
@@ -75,7 +75,7 @@ TEST(LlvmLibcMemSizeTest, AlignUp) {
       auto safe_size = SafeMemSize{size};
       auto safe_aligned_size = safe_size.align_up(alignment);
       ASSERT_TRUE(safe_aligned_size.valid());
-      ASSERT_EQ(static_cast<size_t>(safe_aligned_size) % alignment, size_t{0});
+      ASSERT_EQ(static_cast<size_t>(safe_aligned_size) % alignment, size_t(0));
     }
   }
   auto max = SafeMemSize{SAFE_MEM_SIZE_TEST_LIMIT};



More information about the libc-commits mailing list