]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
gunit/001: fix sign compare build warning
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 12 Sep 2023 02:45:00 +0000 (08:15 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 25 Oct 2023 20:20:14 +0000 (14:20 -0600)
Fix the following sign compare build warning:

In file included from 001-path.cpp:9:
../../googletest/googletest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperLT(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]’:
001-path.cpp:53:4:   required from here
../../googletest/googletest/include/gtest/gtest.h:1526:28: warning: comparison of integer expressions of different signedness: ‘const int’ and ‘const long unsigned int’ [-Wsign-compare]
../../googletest/googletest/include/gtest/gtest.h:1510:7:
   if (val1 op val2) {\
       ~~~~~~~~~~~~
../../googletest/googletest/include/gtest/gtest.h:1526:28: GTEST_IMPL_CMP_HELPER_(LT, <);
../../googletest/googletest/include/gtest/gtest.h:1510:12: note: in
definition of macro ‘GTEST_IMPL_CMP_HELPER_’
   if (val1 op val2) {\
            ^~

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/gunit/001-path.cpp

index d95e1ad164066b9dd15b9239ee7d0671c3ac4d87..b48f06e6a728272888378c1f6f01cd740241edaa 100644 (file)
@@ -50,7 +50,7 @@ class BuildPathV1Test : public ::testing::Test {
 
                        ret = snprintf(cg_mount_table[i].mount.path, FILENAME_MAX,
                                 "/sys/fs/cgroup/%s", cg_mount_table[i].name);
-                       ASSERT_LT(ret, sizeof(cg_mount_table[i].mount.path));
+                       ASSERT_LT(ret, (int)sizeof(cg_mount_table[i].mount.path));
 
                        cg_mount_table[i].mount.next = NULL;
                }