From 81a037df2469933f147f3b15d6ab9a77976c8995 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 19 Oct 2016 09:00:05 -0700 Subject: [PATCH] folly/experimental: avoid shadowing warnings Summary: Fix warnings exposed by the upstream-proposed -Wshadow-compatible-local option. Reviewed By: philippv Differential Revision: D4041749 fbshipit-source-id: 9e0dcec3b35c60e5588a2e53dfdb8605e74721c4 --- folly/experimental/EliasFanoCoding.h | 4 ++-- folly/experimental/io/AsyncIO.cpp | 6 +++--- folly/experimental/test/AutoTimerTest.cpp | 8 ++++---- folly/experimental/test/DynamicParserTest.cpp | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/folly/experimental/EliasFanoCoding.h b/folly/experimental/EliasFanoCoding.h index 8508f329..8c0e4ca1 100644 --- a/folly/experimental/EliasFanoCoding.h +++ b/folly/experimental/EliasFanoCoding.h @@ -167,9 +167,9 @@ struct EliasFanoEncoderV2 { /* static */ if (forwardQuantum != 0) { if ((size_ + 1) % forwardQuantum == 0) { - const auto pos = size_ / forwardQuantum; + const auto k = size_ / forwardQuantum; // Store the number of preceding 0-bits. - forwardPointers_[pos] = upperBits; + forwardPointers_[k] = upperBits; } } diff --git a/folly/experimental/io/AsyncIO.cpp b/folly/experimental/io/AsyncIO.cpp index 7095d849..c3bde31e 100644 --- a/folly/experimental/io/AsyncIO.cpp +++ b/folly/experimental/io/AsyncIO.cpp @@ -287,9 +287,9 @@ void AsyncIOQueue::maybeDequeue() { // Interpose our completion callback auto& nextCb = op->notificationCallback(); - op->setNotificationCallback([this, nextCb](AsyncIOOp* op) { - this->onCompleted(op); - if (nextCb) nextCb(op); + op->setNotificationCallback([this, nextCb](AsyncIOOp* op2) { + this->onCompleted(op2); + if (nextCb) nextCb(op2); }); asyncIO_->submit(op); diff --git a/folly/experimental/test/AutoTimerTest.cpp b/folly/experimental/test/AutoTimerTest.cpp index f4c71c51..d652acca 100644 --- a/folly/experimental/test/AutoTimerTest.cpp +++ b/folly/experimental/test/AutoTimerTest.cpp @@ -45,8 +45,8 @@ struct StubClock { int StubClock::t = 0; TEST(TestAutoTimer, HandleBasicClosure) { - auto logger = [](StringPiece msg, auto sec) { - return StubLogger()(msg, sec); + auto logger = [](StringPiece mesg, auto sec) { + return StubLogger()(mesg, sec); }; StubClock::t = 1; // Here decltype is needed. But since most users are expected to use this @@ -93,8 +93,8 @@ TEST(TestAutoTimer, HandleRealTimerClosure) { auto t = makeAutoTimer( "Third message on destruction", std::chrono::duration::zero(), - [](StringPiece msg, auto sec) { - GoogleLogger()(msg, sec); + [](StringPiece mesg, auto sec) { + GoogleLogger()(mesg, sec); }); t.log("First message"); t.log("Second message"); diff --git a/folly/experimental/test/DynamicParserTest.cpp b/folly/experimental/test/DynamicParserTest.cpp index 38db3030..3c18f47b 100644 --- a/folly/experimental/test/DynamicParserTest.cpp +++ b/folly/experimental/test/DynamicParserTest.cpp @@ -192,15 +192,15 @@ TEST(TestDynamicParser, AllParserFeaturesSuccess) { p.required(4, [&](const dynamic& v) { EXPECT_EQ(4, p.key().getInt()); EXPECT_EQ(v, p.value()); - p.optional("bools", [&](const std::string& k, const dynamic& v) { + p.optional("bools", [&](const std::string& k, const dynamic& v2) { EXPECT_EQ(std::string("bools"), k); EXPECT_EQ(k, p.key().getString()); - EXPECT_EQ(v, p.value()); - p.arrayItems([&](int64_t k, bool v) { + EXPECT_EQ(v2, p.value()); + p.arrayItems([&](int64_t k, bool v3) { EXPECT_EQ(bools.size(), k); EXPECT_EQ(k, p.key().getInt()); - EXPECT_EQ(v, p.value().asBool()); - bools.push_back(v); + EXPECT_EQ(v3, p.value().asBool()); + bools.push_back(v3); }); }); }); -- 2.34.1