[compiler-rt][scudo] Fix sign-compare warnings

Fix buildbot failure
https://lab.llvm.org/buildbot/#/builders/57/builds/6542/steps/6/logs/stdio

/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:1629:28:
error: comparison of integers of different signs: 'const unsigned long'
and 'const int' [-Werror,-Wsign-compare]
GTEST_IMPL_CMP_HELPER_(GT, >);
~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:1609:12:
note: expanded from macro 'GTEST_IMPL_CMP_HELPER_'
  if (val1 op val2) {\
      ~~~~ ^  ~~~~
/llvm-project/compiler-rt/lib/scudo/standalone/tests/common_test.cpp:30:3:
note: in instantiation of function template specialization
'testing::internal::CmpHelperGT<unsigned long, int>' requested here
  EXPECT_GT(OnStart, 0);
  ^

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D103029
This commit is contained in:
Jinsong Ji 2021-05-24 21:32:50 +00:00
parent fc9248877d
commit bec6b02252
1 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ static uptr getResidentMemorySize() {
// Fuchsia needs getResidentMemorySize implementation.
TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
uptr OnStart = getResidentMemorySize();
EXPECT_GT(OnStart, 0);
EXPECT_GT(OnStart, 0UL);
const uptr Size = 1ull << 30;
const uptr Threshold = Size >> 3;
@ -37,9 +37,9 @@ TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
MapPlatformData Data = {};
uptr *P = reinterpret_cast<uptr *>(
map(nullptr, Size, "ResidentMemorySize", 0, &Data));
const uptr N = Size / sizeof(*P);
const size_t N = Size / sizeof(*P);
ASSERT_NE(nullptr, P);
EXPECT_EQ(std::count(P, P + N, 0), N);
EXPECT_EQ((size_t)std::count(P, P + N, 0), N);
EXPECT_LT(getResidentMemorySize() - OnStart, Threshold);
memset(P, 1, Size);
@ -47,7 +47,7 @@ TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
EXPECT_LT(getResidentMemorySize() - Size, Threshold);
releasePagesToOS((uptr)P, 0, Size, &Data);
EXPECT_EQ(std::count(P, P + N, 0), N);
EXPECT_EQ((size_t)std::count(P, P + N, 0), N);
// FIXME: does not work with QEMU-user.
// EXPECT_LT(getResidentMemorySize() - OnStart, Threshold);