folly/experimental: avoid shadowing warnings
authorJim Meyering <meyering@fb.com>
Wed, 19 Oct 2016 16:00:05 +0000 (09:00 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 19 Oct 2016 16:08:40 +0000 (09:08 -0700)
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
folly/experimental/io/AsyncIO.cpp
folly/experimental/test/AutoTimerTest.cpp
folly/experimental/test/DynamicParserTest.cpp

index 8508f3298a88b77fc34cff9b5a14901605d2de41..8c0e4ca12b86945a23777b9d046ba0be89ff6942 100644 (file)
@@ -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;
       }
     }
 
index 7095d84909b1a0d5bb10f140a23c40323e88e2a1..c3bde31ec668f0c15fb81a25dfa956508d59b1c6 100644 (file)
@@ -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);
index f4c71c5189294fe2cd87397f18022a02125a0222..d652acca900917950753382606a7e655cd84f987 100644 (file)
@@ -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<double>::zero(),
-      [](StringPiece msg, auto sec) {
-        GoogleLogger<GoogleLoggerStyle::PRETTY>()(msg, sec);
+      [](StringPiece mesg, auto sec) {
+        GoogleLogger<GoogleLoggerStyle::PRETTY>()(mesg, sec);
       });
   t.log("First message");
   t.log("Second message");
index 38db3030357f9571ea88333eb4b83fc08b78a9c1..3c18f47ba40906646227b348f30f37fd80f4657d 100644 (file)
@@ -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);
       });
     });
   });