From e320a4699e9c4efc3b2b0c0844dd6539eb5c3ff0 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Fri, 21 Apr 2017 11:37:41 +0530 Subject: [PATCH] test: warning: comparison between signed and unsigned integer expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/test/simple_spin.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/simple_spin.cc b/src/test/simple_spin.cc index 9fd850f7bb2..6857a51ef36 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); -- 2.47.3