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
main
Daniel Black 8 years ago committed by Facebook Github Bot
parent a084b26a5a
commit f4fce4751e
  1. 2
      db/db_test.cc
  2. 4
      db/version_set.cc

@ -2980,7 +2980,7 @@ TEST_F(DBTest, DynamicMemtableOptions) {
options.level0_stop_writes_trigger = 1024; options.level0_stop_writes_trigger = 1024;
DestroyAndReopen(options); DestroyAndReopen(options);
auto gen_l0_kb = [this, kNumPutsBeforeWaitForFlush](int size) { auto gen_l0_kb = [this](int size) {
Random rnd(301); Random rnd(301);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
ASSERT_OK(Put(Key(i), RandomString(&rnd, 1024))); ASSERT_OK(Put(Key(i), RandomString(&rnd, 1024)));

@ -1537,13 +1537,13 @@ void VersionStorageInfo::UpdateFilesByCompactionPri(
break; break;
case kOldestLargestSeqFirst: case kOldestLargestSeqFirst:
std::sort(temp.begin(), temp.end(), 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; return f1.file->largest_seqno < f2.file->largest_seqno;
}); });
break; break;
case kOldestSmallestSeqFirst: case kOldestSmallestSeqFirst:
std::sort(temp.begin(), temp.end(), 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; return f1.file->smallest_seqno < f2.file->smallest_seqno;
}); });
break; break;

Loading…
Cancel
Save