diff --git a/compiler-rt/lib/scudo/standalone/tests/chunk_test.cpp b/compiler-rt/lib/scudo/standalone/tests/chunk_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/chunk_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/chunk_test.cpp @@ -55,7 +55,8 @@ scudo::Chunk::compareExchangeHeader(Cookie, P, &NewHeader, &OldHeader); NewHeader = {}; EXPECT_TRUE(scudo::Chunk::isValid(Cookie, P, &NewHeader)); - EXPECT_EQ(NewHeader.State, scudo::Chunk::State::Quarantined); + EXPECT_EQ(NewHeader.State, + static_cast(scudo::Chunk::State::Quarantined)); EXPECT_FALSE(scudo::Chunk::isValid(InvalidCookie, P, &NewHeader)); free(Block); } diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -139,7 +139,7 @@ StackBuffer[I] = 0x42U; EXPECT_FALSE(Allocator->isOwned(&StackBuffer[scudo::Chunk::getHeaderSize()])); for (scudo::uptr I = 0; I < sizeof(StackBuffer); I++) - EXPECT_EQ(StackBuffer[I], 0x42U); + EXPECT_EQ(StackBuffer[I], static_cast(0x42U)); } template @@ -204,7 +204,7 @@ void *P = Allocator->allocate(Size, Origin, 1U << MinAlignLog, true); EXPECT_NE(P, nullptr); for (scudo::uptr I = 0; I < Size; I++) - ASSERT_EQ((reinterpret_cast(P))[I], 0); + ASSERT_EQ((reinterpret_cast(P))[I], static_cast(0)); memset(P, 0xaa, Size); Allocator->deallocate(P, Origin, Size); } @@ -222,7 +222,7 @@ void *P = Allocator->allocate(Size, Origin, 1U << MinAlignLog, false); EXPECT_NE(P, nullptr); for (scudo::uptr I = 0; I < Size; I++) - ASSERT_EQ((reinterpret_cast(P))[I], 0); + ASSERT_EQ((reinterpret_cast(P))[I], static_cast(0)); memset(P, 0xaa, Size); Allocator->deallocate(P, Origin, Size); } @@ -592,7 +592,7 @@ V.pop_back(); } } - EXPECT_EQ(FailedAllocationsCount, 0U); + EXPECT_EQ(FailedAllocationsCount, 0UL); } // Ensure that releaseToOS can be called prior to any other allocator @@ -673,7 +673,7 @@ for (unsigned I = 0; I != Ptrs.size(); ++I) { Ptrs[I] = Allocator->allocate(Size, Origin, 1U << MinAlignLog, true); for (scudo::uptr J = 0; J < Size; ++J) - ASSERT_EQ((reinterpret_cast(Ptrs[I]))[J], 0); + ASSERT_EQ((reinterpret_cast(Ptrs[I]))[J], static_cast(0)); } } diff --git a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp @@ -61,7 +61,7 @@ EXPECT_EQ(std::count(P, P + N, 0), N); memset(P, 1, Size); - EXPECT_EQ(std::count(P, P + N, 0), 0); + EXPECT_EQ(std::count(P, P + N, 0), 0L); releasePagesToOS((uptr)P, 0, Size, &Data); EXPECT_EQ(std::count(P, P + N, 0), N); diff --git a/compiler-rt/lib/scudo/standalone/tests/list_test.cpp b/compiler-rt/lib/scudo/standalone/tests/list_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/list_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/list_test.cpp @@ -73,9 +73,9 @@ ListT L; L.clear(); - EXPECT_EQ(L.size(), 0U); + EXPECT_EQ(L.size(), 0UL); L.push_back(X); - EXPECT_EQ(L.size(), 1U); + EXPECT_EQ(L.size(), 1UL); EXPECT_EQ(L.back(), X); EXPECT_EQ(L.front(), X); L.pop_front(); @@ -83,7 +83,7 @@ L.checkConsistency(); L.push_front(X); - EXPECT_EQ(L.size(), 1U); + EXPECT_EQ(L.size(), 1UL); EXPECT_EQ(L.back(), X); EXPECT_EQ(L.front(), X); L.pop_front(); @@ -93,13 +93,13 @@ L.push_front(X); L.push_front(Y); L.push_front(Z); - EXPECT_EQ(L.size(), 3U); + EXPECT_EQ(L.size(), 3UL); EXPECT_EQ(L.front(), Z); EXPECT_EQ(L.back(), X); L.checkConsistency(); L.pop_front(); - EXPECT_EQ(L.size(), 2U); + EXPECT_EQ(L.size(), 2UL); EXPECT_EQ(L.front(), Y); EXPECT_EQ(L.back(), X); L.pop_front(); @@ -110,13 +110,13 @@ L.push_back(X); L.push_back(Y); L.push_back(Z); - EXPECT_EQ(L.size(), 3U); + EXPECT_EQ(L.size(), 3UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), Z); L.checkConsistency(); L.pop_front(); - EXPECT_EQ(L.size(), 2U); + EXPECT_EQ(L.size(), 2UL); EXPECT_EQ(L.front(), Y); EXPECT_EQ(L.back(), Z); L.pop_front(); @@ -138,12 +138,12 @@ L.push_back(Y); L.push_back(Z); L.extract(X, Y); - EXPECT_EQ(L.size(), 2U); + EXPECT_EQ(L.size(), 2UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), Z); L.checkConsistency(); L.extract(X, Z); - EXPECT_EQ(L.size(), 1U); + EXPECT_EQ(L.size(), 1UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), X); L.checkConsistency(); @@ -173,7 +173,7 @@ L1.append_back(&L2); EXPECT_EQ(L1.back(), X); EXPECT_EQ(L1.front(), X); - EXPECT_EQ(L1.size(), 1U); + EXPECT_EQ(L1.size(), 1UL); } TEST(ScudoListTest, DoublyLinkedList) { @@ -184,12 +184,12 @@ L.push_back(Y); L.push_back(Z); L.remove(Y); - EXPECT_EQ(L.size(), 2U); + EXPECT_EQ(L.size(), 2UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), Z); L.checkConsistency(); L.remove(Z); - EXPECT_EQ(L.size(), 1U); + EXPECT_EQ(L.size(), 1UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), X); L.checkConsistency(); @@ -198,12 +198,12 @@ L.push_back(X); L.insert(Y, X); - EXPECT_EQ(L.size(), 2U); + EXPECT_EQ(L.size(), 2UL); EXPECT_EQ(L.front(), Y); EXPECT_EQ(L.back(), X); L.checkConsistency(); L.remove(Y); - EXPECT_EQ(L.size(), 1U); + EXPECT_EQ(L.size(), 1UL); EXPECT_EQ(L.front(), X); EXPECT_EQ(L.back(), X); L.checkConsistency(); diff --git a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp @@ -66,7 +66,7 @@ using MemtagDeathTest = MemtagTest; TEST_F(MemtagTest, ArchMemoryTagGranuleSize) { - EXPECT_GT(archMemoryTagGranuleSize(), 1u); + EXPECT_GT(archMemoryTagGranuleSize(), 1ul); EXPECT_TRUE(isPowerOfTwo(archMemoryTagGranuleSize())); } @@ -76,11 +76,11 @@ // expected range. for (u64 Top = 0; Top < 0x100; ++Top) Tags = Tags | (1u << extractTag(Addr | (Top << 56))); - EXPECT_EQ(0xffffull, Tags); + EXPECT_EQ(0xfffful, Tags); } TEST_F(MemtagDeathTest, AddFixedTag) { - for (uptr Tag = 0; Tag < 0x10; ++Tag) + for (uint8_t Tag = 0; Tag < 0x10; ++Tag) EXPECT_EQ(Tag, extractTag(addFixedTag(Addr, Tag))); if (SCUDO_DEBUG) { EXPECT_DEBUG_DEATH(addFixedTag(Addr, 16), ""); @@ -111,12 +111,12 @@ uptr Tags = 0; for (uptr I = 0; I < 100000; ++I) Tags = Tags | (1u << extractTag(selectRandomTag(Ptr, 0))); - EXPECT_EQ(0xfffeull, Tags); + EXPECT_EQ(0xfffeul, Tags); } } TEST_F(MemtagTest, SelectRandomTagWithMask) { - for (uptr j = 0; j < 32; ++j) { + for (uint8_t j = 0; j < 32; ++j) { for (uptr i = 0; i < 1000; ++i) EXPECT_NE(j, extractTag(selectRandomTag(Addr, 1ull << j))); } diff --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp @@ -292,5 +292,5 @@ EXPECT_NE(P, nullptr); Cache.deallocate(ClassId, P); Cache.destroy(nullptr); - EXPECT_GT(Allocator->releaseToOS(), 0U); + EXPECT_GT(Allocator->releaseToOS(), 0UL); } diff --git a/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp b/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp @@ -42,13 +42,13 @@ Into.merge(&From); - EXPECT_EQ(Into.Count, 2UL); + EXPECT_EQ(Into.Count, 2U); EXPECT_EQ(Into.Batch[0], FakePtr); EXPECT_EQ(Into.Batch[1], FakePtr); EXPECT_EQ(Into.Size, 12UL + sizeof(scudo::QuarantineBatch)); EXPECT_EQ(Into.getQuarantinedSize(), 12UL); - EXPECT_EQ(From.Count, 0UL); + EXPECT_EQ(From.Count, 0U); EXPECT_EQ(From.Size, sizeof(scudo::QuarantineBatch)); EXPECT_EQ(From.getQuarantinedSize(), 0UL); diff --git a/compiler-rt/lib/scudo/standalone/tests/stats_test.cpp b/compiler-rt/lib/scudo/standalone/tests/stats_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/stats_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/stats_test.cpp @@ -14,13 +14,13 @@ scudo::LocalStats LStats; LStats.init(); for (scudo::uptr I = 0; I < scudo::StatCount; I++) - EXPECT_EQ(LStats.get(static_cast(I)), 0U); + EXPECT_EQ(LStats.get(static_cast(I)), 0UL); LStats.add(scudo::StatAllocated, 4096U); - EXPECT_EQ(LStats.get(scudo::StatAllocated), 4096U); + EXPECT_EQ(LStats.get(scudo::StatAllocated), 4096UL); LStats.sub(scudo::StatAllocated, 4096U); - EXPECT_EQ(LStats.get(scudo::StatAllocated), 0U); + EXPECT_EQ(LStats.get(scudo::StatAllocated), 0UL); LStats.set(scudo::StatAllocated, 4096U); - EXPECT_EQ(LStats.get(scudo::StatAllocated), 4096U); + EXPECT_EQ(LStats.get(scudo::StatAllocated), 4096UL); } TEST(ScudoStatsTest, GlobalStats) { @@ -29,18 +29,18 @@ scudo::uptr Counters[scudo::StatCount] = {}; GStats.get(Counters); for (scudo::uptr I = 0; I < scudo::StatCount; I++) - EXPECT_EQ(Counters[I], 0U); + EXPECT_EQ(Counters[I], 0UL); scudo::LocalStats LStats; LStats.init(); GStats.link(&LStats); for (scudo::uptr I = 0; I < scudo::StatCount; I++) - LStats.add(static_cast(I), 4096U); + LStats.add(static_cast(I), 4096UL); GStats.get(Counters); for (scudo::uptr I = 0; I < scudo::StatCount; I++) - EXPECT_EQ(Counters[I], 4096U); + EXPECT_EQ(Counters[I], 4096UL); // Unlinking the local stats move numbers to the global stats. GStats.unlink(&LStats); GStats.get(Counters); for (scudo::uptr I = 0; I < scudo::StatCount; I++) - EXPECT_EQ(Counters[I], 4096U); + EXPECT_EQ(Counters[I], 4096UL); } diff --git a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp @@ -230,7 +230,7 @@ T.join(); // The initial number of TSDs we get will be the minimum of the default count // and the number of CPUs. - EXPECT_LE(Pointers.size(), 8U); + EXPECT_LE(Pointers.size(), 8UL); Pointers.clear(); auto Registry = Allocator->getTSDRegistry(); // Increase the number of TSDs to 16. @@ -246,5 +246,5 @@ for (auto &T : Threads) T.join(); // We should get 16 distinct TSDs back. - EXPECT_EQ(Pointers.size(), 16U); + EXPECT_EQ(Pointers.size(), 16UL); } diff --git a/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp b/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp @@ -12,12 +12,12 @@ TEST(ScudoVectorTest, Basic) { scudo::Vector V; - EXPECT_EQ(V.size(), 0U); + EXPECT_EQ(V.size(), 0UL); V.push_back(42); - EXPECT_EQ(V.size(), 1U); + EXPECT_EQ(V.size(), 1UL); EXPECT_EQ(V[0], 42); V.push_back(43); - EXPECT_EQ(V.size(), 2U); + EXPECT_EQ(V.size(), 2UL); EXPECT_EQ(V[0], 42); EXPECT_EQ(V[1], 43); } @@ -26,7 +26,7 @@ scudo::Vector V; for (scudo::uptr I = 0; I < 1000; I++) { V.push_back(I); - EXPECT_EQ(V.size(), I + 1U); + EXPECT_EQ(V.size(), I + 1UL); EXPECT_EQ(V[I], I); } for (scudo::uptr I = 0; I < 1000; I++) @@ -37,7 +37,7 @@ scudo::Vector V; V.push_back(0); V.push_back(0); - EXPECT_EQ(V.size(), 2U); + EXPECT_EQ(V.size(), 2UL); V.resize(1); - EXPECT_EQ(V.size(), 1U); + EXPECT_EQ(V.size(), 1UL); } diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp @@ -46,7 +46,7 @@ void *P = malloc(Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); - EXPECT_EQ(reinterpret_cast(P) % FIRST_32_SECOND_64(8U, 16U), 0U); + EXPECT_EQ(reinterpret_cast(P) % FIRST_32_SECOND_64(8U, 16U), 0UL); // An update to this warning in Clang now triggers in this line, but it's ok // because the check is expecting a bad pointer and should fail. @@ -77,7 +77,7 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); for (size_t I = 0; I < Size; I++) - EXPECT_EQ((reinterpret_cast(P))[I], 0U); + EXPECT_EQ((reinterpret_cast(P))[I], static_cast(0U)); free(P); P = calloc(1U, 0U); @@ -119,14 +119,14 @@ P = memalign(Alignment, Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); - EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); + EXPECT_EQ(reinterpret_cast(P) % Alignment, 0UL); free(P); P = nullptr; EXPECT_EQ(posix_memalign(&P, Alignment, Size), 0); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); - EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); + EXPECT_EQ(reinterpret_cast(P) % Alignment, 0UL); free(P); } @@ -149,7 +149,7 @@ void *P = aligned_alloc(Alignment, Alignment * 4U); EXPECT_NE(P, nullptr); EXPECT_LE(Alignment * 4U, malloc_usable_size(P)); - EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); + EXPECT_EQ(reinterpret_cast(P) % Alignment, 0UL); free(P); errno = 0; @@ -178,13 +178,13 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Size * 2U, malloc_usable_size(P)); for (size_t I = 0; I < Size; I++) - EXPECT_EQ(0x42, (reinterpret_cast(P))[I]); + EXPECT_EQ(static_cast(0x42U), (reinterpret_cast(P))[I]); P = realloc(P, Size / 2U); EXPECT_NE(P, nullptr); EXPECT_LE(Size / 2U, malloc_usable_size(P)); for (size_t I = 0; I < Size / 2U; I++) - EXPECT_EQ(0x42, (reinterpret_cast(P))[I]); + EXPECT_EQ(static_cast(0x42U), (reinterpret_cast(P))[I]); free(P); EXPECT_DEATH(P = realloc(P, Size), ""); @@ -205,14 +205,14 @@ P = memalign(Alignment, Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); - EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); + EXPECT_EQ(reinterpret_cast(P) % Alignment, 0UL); memset(P, 0x42, Size); P = realloc(P, Size * 2U); EXPECT_NE(P, nullptr); EXPECT_LE(Size * 2U, malloc_usable_size(P)); for (size_t I = 0; I < Size; I++) - EXPECT_EQ(0x42, (reinterpret_cast(P))[I]); + EXPECT_EQ(static_cast(0x42U), (reinterpret_cast(P))[I]); free(P); } } @@ -245,7 +245,7 @@ void *P = pvalloc(Size); EXPECT_NE(P, nullptr); - EXPECT_EQ(reinterpret_cast(P) & (PageSize - 1), 0U); + EXPECT_EQ(reinterpret_cast(P) & (PageSize - 1), 0UL); EXPECT_LE(PageSize, malloc_usable_size(P)); free(P); @@ -253,7 +253,7 @@ P = pvalloc(Size); EXPECT_NE(P, nullptr); - EXPECT_EQ(reinterpret_cast(P) & (PageSize - 1), 0U); + EXPECT_EQ(reinterpret_cast(P) & (PageSize - 1), 0UL); free(P); #endif