[compiler-rt] 6176fda - Fix a few warnings (signed/unsigned comparison in gtest, and missing field initializers)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 16 22:44:55 PDT 2021
Author: David Blaikie
Date: 2021-10-16T22:43:57-07:00
New Revision: 6176fda3f992b5086302b3826aa0636135cc4cc0
URL: https://github.com/llvm/llvm-project/commit/6176fda3f992b5086302b3826aa0636135cc4cc0
DIFF: https://github.com/llvm/llvm-project/commit/6176fda3f992b5086302b3826aa0636135cc4cc0.diff
LOG: Fix a few warnings (signed/unsigned comparison in gtest, and missing field initializers)
Added:
Modified:
compiler-rt/lib/gwp_asan/tests/alignment.cpp
compiler-rt/lib/sanitizer_common/tests/sanitizer_stackdepot_test.cpp
Removed:
################################################################################
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},
};
More information about the llvm-commits
mailing list