From: Jim Meyering Date: Wed, 7 Jan 2015 04:54:29 +0000 (-0800) Subject: folly/test/ForeachTest.cpp: avoid -Wsign-compare error X-Git-Tag: v0.22.0~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8cae10aa7399b37ef15a85f9afbf485cf57a5135;p=folly.git folly/test/ForeachTest.cpp: avoid -Wsign-compare error Summary: * folly/test/ForeachTest.cpp: Change a "1" to "1U", so it matches the signedness of the size_t upper bound. Otherwise, gcc-4.9 fails with e.g., folly/Foreach.h:194:16: 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: andrei.alexandrescu@fb.com Subscribers: folly-diffs@ FB internal diff: D1770603 Tasks: 5941250 Signature: t1:1770603:1420679246:56ef62ac7fa4413a4ad6310c3381a12bdc59e64c --- diff --git a/folly/test/ForeachTest.cpp b/folly/test/ForeachTest.cpp index bff6b502..aa765a8b 100644 --- a/folly/test/ForeachTest.cpp +++ b/folly/test/ForeachTest.cpp @@ -266,7 +266,7 @@ BENCHMARK(ForEachDescendingManual, iters) { BENCHMARK(ForEachRangeR, iters) { int sum = 1; - FOR_EACH_RANGE_R (i, 1, iters) { + FOR_EACH_RANGE_R (i, 1U, iters) { sum *= i; } doNotOptimizeAway(sum);