[Lldb-commits] [lldb] 0ae342f - [lldb][test] Fix -Wsign-compare in RegisterFlagsTest.cpp (NFC)

Jie Fu via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 13 18:48:20 PDT 2023


Author: Jie Fu
Date: 2023-04-14T09:47:21+08:00
New Revision: 0ae342f45bedd29e34690de087011a9da4db6a65

URL: https://github.com/llvm/llvm-project/commit/0ae342f45bedd29e34690de087011a9da4db6a65
DIFF: https://github.com/llvm/llvm-project/commit/0ae342f45bedd29e34690de087011a9da4db6a65.diff

LOG: [lldb][test] Fix -Wsign-compare in RegisterFlagsTest.cpp (NFC)

/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: error: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Werror,-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long long, int>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
/data/llvm-project/lldb/unittests/Target/RegisterFlagsTest.cpp:128:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<unsigned long long, int, nullptr>' requested here
  ASSERT_EQ(0x12345678ULL, rf.ReverseFieldOrder(0x12345678));
  ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2056:32: note: expanded from macro 'ASSERT_EQ'
                               ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2040:54: note: expanded from macro 'GTEST_ASSERT_EQ'
  ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
                                                     ^
1 error generated.

Added: 
    

Modified: 
    lldb/unittests/Target/RegisterFlagsTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Target/RegisterFlagsTest.cpp b/lldb/unittests/Target/RegisterFlagsTest.cpp
index 3819c6fda6ceb..c24a6d9bf6c32 100644
--- a/lldb/unittests/Target/RegisterFlagsTest.cpp
+++ b/lldb/unittests/Target/RegisterFlagsTest.cpp
@@ -125,11 +125,11 @@ TEST(RegisterFlagsTest, RegisterFlagsPadding) {
 TEST(RegisterFieldsTest, ReverseFieldOrder) {
   // Unchanged
   RegisterFlags rf("", 4, {make_field(0, 31)});
-  ASSERT_EQ(0x12345678ULL, rf.ReverseFieldOrder(0x12345678));
+  ASSERT_EQ(0x12345678ULL, (unsigned long long)rf.ReverseFieldOrder(0x12345678));
 
   // Swap the two halves around.
   RegisterFlags rf2("", 4, {make_field(16, 31), make_field(0, 15)});
-  ASSERT_EQ(0x56781234ULL, rf2.ReverseFieldOrder(0x12345678));
+  ASSERT_EQ(0x56781234ULL, (unsigned long long)rf2.ReverseFieldOrder(0x12345678));
 
   // Many small fields.
   RegisterFlags rf3("", 4,


        


More information about the lldb-commits mailing list