[libc-commits] [PATCH] D127989: [libc][obvious] fix address test on windows

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 16 10:52:29 PDT 2022


michaelrj created this revision.
michaelrj added reviewers: sivachandra, gchatelet, lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.

On windows size_t != unsigned long.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127989

Files:
  libc/test/src/string/memory_utils/address_test.cpp


Index: libc/test/src/string/memory_utils/address_test.cpp
===================================================================
--- libc/test/src/string/memory_utils/address_test.cpp
+++ libc/test/src/string/memory_utils/address_test.cpp
@@ -31,21 +31,21 @@
 
 TEST(LlvmLibcAddress, NarrowAlignment) {
   // Address 8-byte aligned, offset by 8.
-  ASSERT_EQ(offsetAddr<8>(SrcAddr<8>(nullptr)).ALIGNMENT, 8UL);
+  ASSERT_EQ(offsetAddr<8>(SrcAddr<8>(nullptr)).ALIGNMENT, size_t(8));
   // Address 16-byte aligned, offset by 4.
-  ASSERT_EQ(offsetAddr<4>(SrcAddr<16>(nullptr)).ALIGNMENT, 4UL);
+  ASSERT_EQ(offsetAddr<4>(SrcAddr<16>(nullptr)).ALIGNMENT, size_t(4));
   // Address 4-byte aligned, offset by 16.
-  ASSERT_EQ(offsetAddr<16>(SrcAddr<4>(nullptr)).ALIGNMENT, 4UL);
+  ASSERT_EQ(offsetAddr<16>(SrcAddr<4>(nullptr)).ALIGNMENT, size_t(4));
   // Address 4-byte aligned, offset by 1.
-  ASSERT_EQ(offsetAddr<1>(SrcAddr<4>(nullptr)).ALIGNMENT, 1UL);
+  ASSERT_EQ(offsetAddr<1>(SrcAddr<4>(nullptr)).ALIGNMENT, size_t(1));
   // Address 4-byte aligned, offset by 2.
-  ASSERT_EQ(offsetAddr<2>(SrcAddr<4>(nullptr)).ALIGNMENT, 2UL);
+  ASSERT_EQ(offsetAddr<2>(SrcAddr<4>(nullptr)).ALIGNMENT, size_t(2));
   // Address 4-byte aligned, offset by 6.
-  ASSERT_EQ(offsetAddr<6>(SrcAddr<4>(nullptr)).ALIGNMENT, 2UL);
+  ASSERT_EQ(offsetAddr<6>(SrcAddr<4>(nullptr)).ALIGNMENT, size_t(2));
   // Address 4-byte aligned, offset by 10.
-  ASSERT_EQ(offsetAddr<10>(SrcAddr<4>(nullptr)).ALIGNMENT, 2UL);
+  ASSERT_EQ(offsetAddr<10>(SrcAddr<4>(nullptr)).ALIGNMENT, size_t(2));
   // Address 8-byte aligned, offset by 6.
-  ASSERT_EQ(offsetAddr<6>(SrcAddr<8>(nullptr)).ALIGNMENT, 2UL);
+  ASSERT_EQ(offsetAddr<6>(SrcAddr<8>(nullptr)).ALIGNMENT, size_t(2));
 }
 
 TEST(LlvmLibcAddress, OffsetAddr) {
@@ -57,10 +57,10 @@
 
 TEST(LlvmLibcAddress, AssumeAligned) {
   SrcAddr<16> addr(nullptr);
-  ASSERT_EQ(offsetAddrAssumeAligned<8>(addr, 0).ALIGNMENT, 8UL);
-  ASSERT_EQ(offsetAddrAssumeAligned<1>(addr, 0).ALIGNMENT, 1UL);
-  ASSERT_EQ(offsetAddrMultiplesOf<4>(addr, 0).ALIGNMENT, 4UL);
-  ASSERT_EQ(offsetAddrMultiplesOf<32>(addr, 0).ALIGNMENT, 16UL);
+  ASSERT_EQ(offsetAddrAssumeAligned<8>(addr, 0).ALIGNMENT, size_t(8));
+  ASSERT_EQ(offsetAddrAssumeAligned<1>(addr, 0).ALIGNMENT, size_t(1));
+  ASSERT_EQ(offsetAddrMultiplesOf<4>(addr, 0).ALIGNMENT, size_t(4));
+  ASSERT_EQ(offsetAddrMultiplesOf<32>(addr, 0).ALIGNMENT, size_t(16));
 }
 
 TEST(LlvmLibcAddress, offsetAddrAssumeAligned) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127989.437604.patch
Type: text/x-patch
Size: 2478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220616/68b7267a/attachment.bin>


More information about the libc-commits mailing list