From: cuiming_yewu Date: Fri, 20 Oct 2023 04:59:05 +0000 (+0800) Subject: mon&test: resolve warning about inconsistent variable types X-Git-Tag: v19.3.0~203^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8028e2c5fce1cf000647b5214c05b32f38ae91b7;p=ceph.git mon&test: resolve warning about inconsistent variable types resolve a warning issue about inconsistent variable types with Building CXX object src/mon/CMakeFiles/mon.dir/Elector.cc.o ../src/mon/Elector.cc: In member function 'void Elector:: notify_rank_removed(int)': ../src/mon/Elector.cc:765:15: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] if (rank_removed < paxos_size()) { warning:comparison of integer expressions of different signedness: 'unsigned int' and 'const int' [-Wsign-compare] if (total < NR_ROUNDS) Fixes: https://tracker.ceph.com/issues/63917 Signed-off-by: cuiming --- diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index a7221ebfb19..5ad30ff225c 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -762,7 +762,7 @@ void Elector::notify_rank_removed(unsigned rank_removed, unsigned new_rank) In the case where we are removing the highest rank, we erase the removed rank from all sets. */ - if (rank_removed < paxos_size()) { + if (std::cmp_less(rank_removed, paxos_size())) { for (unsigned i = rank_removed + 1; i <= paxos_size() ; ++i) { if (live_pinging.count(i)) { dead_pinging.erase(i-1); diff --git a/src/test/common/test_fair_mutex.cc b/src/test/common/test_fair_mutex.cc index 10ba835a2dd..4b9997706ba 100644 --- a/src/test/common/test_fair_mutex.cc +++ b/src/test/common/test_fair_mutex.cc @@ -47,7 +47,7 @@ TEST(FairMutex, fair) scoreboard.end(), 0); for (unsigned score : scoreboard) { - if (total < NR_ROUNDS) { + if (std::cmp_less(total, NR_ROUNDS)) { // not quite statistically significant. to reduce the false positive, // just consider it fair continue;