From: Jim Meyering Date: Wed, 7 Jan 2015 05:15:27 +0000 (-0800) Subject: folly/test/SpinLockTest.cpp: avoid -Wsign-compare error (trivial) X-Git-Tag: v0.22.0~31 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3d4f7737d0b4142530501c0d9f4a18e51b0ffaa7;p=folly.git folly/test/SpinLockTest.cpp: avoid -Wsign-compare error (trivial) Summary: * folly/test/SpinLockTest.cpp (trylockTestThread): Change parameter type from int to size_t, to fix these: folly/test/SpinLockTest.cpp:67:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] folly/test/SpinLockTest.cpp:82:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] Test Plan: Run this and note there are fewer errors than before: fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo Reviewed By: philipp@fb.com Subscribers: net-systems@, folly-diffs@ FB internal diff: D1770564 Tasks: 5941250 Signature: t1:1770564:1420674373:fa3020398e2df66590eb71f798419b6f555d07c4 --- diff --git a/folly/test/SpinLockTest.cpp b/folly/test/SpinLockTest.cpp index 9f8b279c..847efcf5 100644 --- a/folly/test/SpinLockTest.cpp +++ b/folly/test/SpinLockTest.cpp @@ -60,7 +60,7 @@ struct TryLockState { }; template -void trylockTestThread(TryLockState* state, int count) { +void trylockTestThread(TryLockState* state, size_t count) { while (true) { asm("pause"); SpinLockGuardImpl g(state->lock1); @@ -111,7 +111,7 @@ void trylockTest() { int nthrs = sysconf(_SC_NPROCESSORS_ONLN) + 4; std::vector threads; TryLockState state; - int count = 100; + size_t count = 100; for (int i = 0; i < nthrs; ++i) { threads.push_back(std::thread(trylockTestThread, &state, count)); }