folly/test/SpinLockTest.cpp: avoid -Wsign-compare error (trivial)
authorJim Meyering <meyering@fb.com>
Wed, 7 Jan 2015 05:15:27 +0000 (21:15 -0800)
committerViswanath Sivakumar <viswanath@fb.com>
Tue, 13 Jan 2015 19:01:04 +0000 (11:01 -0800)
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

folly/test/SpinLockTest.cpp

index 9f8b279cb82cd3518c9102f1d39ea26aa3c088b4..847efcf5147447cab89eb9b8416fb9fc85992dbb 100644 (file)
@@ -60,7 +60,7 @@ struct TryLockState {
 };
 
 template <typename LOCK>
-void trylockTestThread(TryLockState<LOCK>* state, int count) {
+void trylockTestThread(TryLockState<LOCK>* state, size_t count) {
   while (true) {
     asm("pause");
     SpinLockGuardImpl<LOCK> g(state->lock1);
@@ -111,7 +111,7 @@ void trylockTest() {
   int nthrs = sysconf(_SC_NPROCESSORS_ONLN) + 4;
   std::vector<std::thread> threads;
   TryLockState<LOCK> state;
-  int count = 100;
+  size_t count = 100;
   for (int i = 0; i < nthrs; ++i) {
     threads.push_back(std::thread(trylockTestThread<LOCK>, &state, count));
   }