From 6176fda3f992b5086302b3826aa0636135cc4cc0 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sat, 16 Oct 2021 22:43:57 -0700 Subject: [PATCH] Fix a few warnings (signed/unsigned comparison in gtest, and missing field initializers) --- compiler-rt/lib/gwp_asan/tests/alignment.cpp | 42 +++++++++---------- .../tests/sanitizer_stackdepot_test.cpp | 20 ++++----- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/compiler-rt/lib/gwp_asan/tests/alignment.cpp b/compiler-rt/lib/gwp_asan/tests/alignment.cpp index 5f24a9a1bd8ac..6d1e912a11eeb 100644 --- a/compiler-rt/lib/gwp_asan/tests/alignment.cpp +++ b/compiler-rt/lib/gwp_asan/tests/alignment.cpp @@ -34,81 +34,81 @@ class AlignmentTestGPA : public gwp_asan::GuardedPoolAllocator { // numerics of the testing. TEST(AlignmentTest, LeftAlignedAllocs) { // Alignment < Page Size. - EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp( /* Ptr */ 0x4000, /* Alignment */ 0x1)); // Alignment == Page Size. - EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp( /* Ptr */ 0x4000, /* Alignment */ 0x1000)); // Alignment > Page Size. - EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp( /* Ptr */ 0x4000, /* Alignment */ 0x4000)); } TEST(AlignmentTest, SingleByteAllocs) { // Alignment < Page Size. - EXPECT_EQ(0x1, + EXPECT_EQ(0x1u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1, /* Alignment */ 0x1, /* PageSize */ 0x1000)); - EXPECT_EQ(0x7fff, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x7fffu, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x1)); // Alignment == Page Size. - EXPECT_EQ(0x1, + EXPECT_EQ(0x1u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1, /* Alignment */ 0x1000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x1000)); // Alignment > Page Size. - EXPECT_EQ(0x3001, + EXPECT_EQ(0x3001u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1, /* Alignment */ 0x4000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x4000)); } TEST(AlignmentTest, PageSizedAllocs) { // Alignment < Page Size. - EXPECT_EQ(0x1000, + EXPECT_EQ(0x1000u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1000, /* Alignment */ 0x1, /* PageSize */ 0x1000)); - EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x1)); // Alignment == Page Size. - EXPECT_EQ(0x1000, AlignmentTestGPA::getRequiredBackingSize( + EXPECT_EQ(0x1000u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1000, /* Alignment */ 0x1000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x1000)); // Alignment > Page Size. - EXPECT_EQ(0x4000, AlignmentTestGPA::getRequiredBackingSize( + EXPECT_EQ(0x4000u, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x1000, /* Alignment */ 0x4000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x4000)); } TEST(AlignmentTest, MoreThanPageAllocs) { // Alignment < Page Size. - EXPECT_EQ(0x2fff, + EXPECT_EQ(0x2fffu, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x2fff, /* Alignment */ 0x1, /* PageSize */ 0x1000)); - EXPECT_EQ(0x5001, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x5001u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x1)); // Alignment == Page Size. - EXPECT_EQ(0x2fff, AlignmentTestGPA::getRequiredBackingSize( + EXPECT_EQ(0x2fffu, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x2fff, /* Alignment */ 0x1000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x5000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x5000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x1000)); // Alignment > Page Size. - EXPECT_EQ(0x5fff, AlignmentTestGPA::getRequiredBackingSize( + EXPECT_EQ(0x5fffu, AlignmentTestGPA::getRequiredBackingSize( /* Size */ 0x2fff, /* Alignment */ 0x4000, /* PageSize */ 0x1000)); - EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown( + EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown( /* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x4000)); } diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stackdepot_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stackdepot_test.cpp index df9cadad97767..3835ce26c4d54 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stackdepot_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stackdepot_test.cpp @@ -130,22 +130,22 @@ static struct StackDepotBenchmarkParams { bool UseCount; } params[] = { // All traces are unique, very unusual. - {10000000, 1, 1}, - {8000000, 1, 4}, - {8000000, 1, 16}, + {10000000, 1, 1, false, false}, + {8000000, 1, 4, false, false}, + {8000000, 1, 16, false, false}, // Probably most realistic sets. - {3000000, 10, 1}, - {3000000, 10, 4}, - {3000000, 10, 16}, + {3000000, 10, 1, false, false}, + {3000000, 10, 4, false, false}, + {3000000, 10, 16, false, false}, // Update use count as msan/dfsan. {3000000, 10, 1, false, true}, {3000000, 10, 4, false, true}, {3000000, 10, 16, false, true}, // Unrealistic, as above, but traces are unique inside of thread. - {4000000, 1, 4, true}, - {2000000, 1, 16, true}, - {2000000, 10, 4, true}, - {500000, 10, 16, true}, + {4000000, 1, 4, true, false}, + {2000000, 1, 16, true, false}, + {2000000, 10, 4, true, false}, + {500000, 10, 16, true, false}, {1500000, 10, 4, true, true}, {800000, 10, 16, true, true}, };