From: Jos Collin Date: Fri, 21 Apr 2017 06:07:41 +0000 (+0530) Subject: test: warning: comparison between signed and unsigned integer expressions X-Git-Tag: v12.0.3~280^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F14705%2Fhead;p=ceph.git test: warning: comparison between signed and unsigned integer expressions The following warning appears during make: [ 61%] Building CXX object src/test/CMakeFiles/unittest_simple_spin.dir/simple_spin.cc.o In file included from ./src/test/simple_spin.cc:1:0: ./src/googletest/googletest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = unsigned int; T2 = int]’: ./src/googletest/googletest/include/gtest/gtest.h:1421:23: required from ‘static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = unsigned int; T2 = int; bool lhs_is_null_literal = false]’ ./src/test/simple_spin.cc:49:3: required from here ./src/googletest/googletest/include/gtest/gtest.h:1392:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (lhs == rhs) { ~~~~^~~~~~ Signed-off-by: Jos Collin --- diff --git a/src/test/simple_spin.cc b/src/test/simple_spin.cc index 9fd850f7bb24..6857a51ef366 100644 --- a/src/test/simple_spin.cc +++ b/src/test/simple_spin.cc @@ -46,7 +46,8 @@ TEST(SimpleSpin, Test1) // Should also work with pass-by-reference: // (Note that we don't care about cross-threading here as-such.) counter = 0; - ASSERT_EQ(counter, 0); + uint32_t urhs = 0; + ASSERT_EQ(counter, urhs); async(std::launch::async, []() { for(int i = 0; n != i; ++i) { simple_spin_lock(lock);