From: Lucian Grijincu Date: Mon, 1 Jun 2015 05:58:40 +0000 (-0700) Subject: folly: -Wsign-compare X-Git-Tag: v0.42.0~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=45339b04458a02d445c680175d8daa53fb90b512;p=folly.git folly: -Wsign-compare Test Plan: runtests Reviewed By: philipp@fb.com Subscribers: folly-diffs@, jsedgwick, yfeldblum, tudort, chalfant FB internal diff: D2114063 Signature: t1:2114063:1433111051:6686508d78de39ea4ea5dc283189c472e23f8f42 --- diff --git a/folly/experimental/test/SharedMutexTest.cpp b/folly/experimental/test/SharedMutexTest.cpp index 2bf85b25..026284c3 100644 --- a/folly/experimental/test/SharedMutexTest.cpp +++ b/folly/experimental/test/SharedMutexTest.cpp @@ -486,7 +486,7 @@ static void runContendedReaders(size_t numOps, vector threads(numThreads); BENCHMARK_SUSPEND { - for (int t = 0; t < numThreads; ++t) { + for (size_t t = 0; t < numThreads; ++t) { threads[t] = DSched::thread([&, t, numThreads] { Lock privateLock; Lock* lock = useSeparateLocks ? &privateLock : &globalLock; @@ -583,7 +583,7 @@ static void runMixed(size_t numOps, vector threads(numThreads); BENCHMARK_SUSPEND { - for (int t = 0; t < numThreads; ++t) { + for (size_t t = 0; t < numThreads; ++t) { threads[t] = DSched::thread([&, t, numThreads] { struct drand48_data buffer; srand48_r(t, &buffer); @@ -712,7 +712,7 @@ static void runAllAndValidate(size_t numOps, size_t numThreads) { vector threads(numThreads); BENCHMARK_SUSPEND { - for (int t = 0; t < numThreads; ++t) { + for (size_t t = 0; t < numThreads; ++t) { threads[t] = DSched::thread([&, t, numThreads] { struct drand48_data buffer; srand48_r(t, &buffer); @@ -1098,7 +1098,7 @@ static void runRemoteUnlock(size_t numOps, vector threads(numSendingThreads + numReceivingThreads); BENCHMARK_SUSPEND { - for (int t = 0; t < threads.size(); ++t) { + for (size_t t = 0; t < threads.size(); ++t) { threads[t] = DSched::thread([&, t, numSendingThreads] { if (t >= numSendingThreads) { // we're a receiver @@ -1246,7 +1246,7 @@ static void runPingPong(size_t numRounds, size_t burnCount) { while (!goPtr->load()) { this_thread::yield(); } - for (int i = 0; i < numRounds; ++i) { + for (size_t i = 0; i < numRounds; ++i) { locks[i % 3].first.unlock(); locks[(i + 2) % 3].first.lock(); burn(burnCount); @@ -1257,7 +1257,7 @@ static void runPingPong(size_t numRounds, size_t burnCount) { while (!goPtr->load()) { this_thread::yield(); } - for (int i = 0; i < numRounds; ++i) { + for (size_t i = 0; i < numRounds; ++i) { locks[i % 3].first.lock_shared(); burn(burnCount); locks[(i + 2) % 3].first.unlock_shared(); diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index c33e5a8d..a63b2a80 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -688,7 +688,7 @@ collectN(InputIterator first, InputIterator last, size_t n) { }; auto ctx = std::make_shared(); - if (std::distance(first, last) < n) { + if (size_t(std::distance(first, last)) < n) { ctx->p.setException(std::runtime_error("Not enough futures")); } else { // for each completed Future, increase count and add to vector, until we