From f4fce4751e16e5789bc7db60b88996298b97e47c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 22 Mar 2017 18:03:58 -0700 Subject: [PATCH] Fix clang compile error - [-Werror,-Wunused-lambda-capture] Summary: Errors where: db/version_set.cc:1535:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture] [this](const Fsize& f1, const Fsize& f2) -> bool { ^ db/version_set.cc:1541:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture] [this](const Fsize& f1, const Fsize& f2) -> bool { ^ db/db_test.cc:2983:27: error: lambda capture 'kNumPutsBeforeWaitForFlush' is not required to be captured for this use [-Werror,-Wunused-lambda-capture] auto gen_l0_kb = [this, kNumPutsBeforeWaitForFlush](int size) { ^ Closes https://github.com/facebook/rocksdb/pull/1972 Differential Revision: D4685991 Pulled By: siying fbshipit-source-id: 9125379 --- db/db_test.cc | 2 +- db/version_set.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index 0e7dcd03f..538f42f9a 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -2980,7 +2980,7 @@ TEST_F(DBTest, DynamicMemtableOptions) { options.level0_stop_writes_trigger = 1024; DestroyAndReopen(options); - auto gen_l0_kb = [this, kNumPutsBeforeWaitForFlush](int size) { + auto gen_l0_kb = [this](int size) { Random rnd(301); for (int i = 0; i < size; i++) { ASSERT_OK(Put(Key(i), RandomString(&rnd, 1024))); diff --git a/db/version_set.cc b/db/version_set.cc index bce380123..546fce8ad 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1537,13 +1537,13 @@ void VersionStorageInfo::UpdateFilesByCompactionPri( break; case kOldestLargestSeqFirst: std::sort(temp.begin(), temp.end(), - [this](const Fsize& f1, const Fsize& f2) -> bool { + [](const Fsize& f1, const Fsize& f2) -> bool { return f1.file->largest_seqno < f2.file->largest_seqno; }); break; case kOldestSmallestSeqFirst: std::sort(temp.begin(), temp.end(), - [this](const Fsize& f1, const Fsize& f2) -> bool { + [](const Fsize& f1, const Fsize& f2) -> bool { return f1.file->smallest_seqno < f2.file->smallest_seqno; }); break;