remove redundant move (#11418)

Summary:
when I use g++-13 to exec the `make all` command,  the output throws the warnings.
```
db/compaction/compaction_job_test.cc: In member function ‘void rocksdb::CompactionJobTestBase::AddMockFile(const rocksdb::mock::KVVector&, int)’:
db/compaction/compaction_job_test.cc:376:57: error: redundant move in initialization [-Werror=redundant-move]
  376 |           env_, GenerateFileName(file_number), std::move(contents)));
      |                                                ~~~~~~~~~^~~~~~~~~~
db/compaction/compaction_job_test.cc:375:7: note: in expansion of macro ‘EXPECT_OK’
  375 |       EXPECT_OK(mock_table_factory_->CreateMockTable(
      |       ^~~~~~~~~
db/compaction/compaction_job_test.cc:376:57: note: remove ‘std::move’ call
  376 |           env_, GenerateFileName(file_number), std::move(contents)));
      |                                                ~~~~~~~~~^~~~~~~~~~
db/compaction/compaction_job_test.cc:375:7: note: in expansion of macro ‘EXPECT_OK’
  375 |       EXPECT_OK(mock_table_factory_->CreateMockTable(
      |       ^~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [Makefile:2507: db/compaction/compaction_job_test.o] Error 1
```

and I also add some `(void)unused_variable` statements because of the cmake argument `-Wunused-but-set-variable -Wunused-but-set-variable`

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11418

Reviewed By: akankshamahajan15

Differential Revision: D45528223

Pulled By: ajkr

fbshipit-source-id: fee1a77c30039a56b481de953f0a834cc788abbc
oxigraph-8.3.2
clundro 2 years ago committed by Facebook GitHub Bot
parent a475e9f746
commit 50b33ebb1b
  1. 1
      .gitignore
  2. 2
      db/compaction/compaction_job_test.cc
  3. 1
      db/db_test.cc
  4. 2
      file/prefetch_test.cc
  5. 1
      memtable/inlineskiplist_test.cc
  6. 1
      memtable/skiplist_test.cc
  7. 2
      tools/db_bench_tool.cc

1
.gitignore vendored

@ -95,3 +95,4 @@ fuzz/crash-*
cmake-build-* cmake-build-*
third-party/folly/ third-party/folly/
.cache

@ -373,7 +373,7 @@ class CompactionJobTestBase : public testing::Test {
} else if (table_type_ == TableTypeForTest::kMockTable) { } else if (table_type_ == TableTypeForTest::kMockTable) {
file_size = 10; file_size = 10;
EXPECT_OK(mock_table_factory_->CreateMockTable( EXPECT_OK(mock_table_factory_->CreateMockTable(
env_, GenerateFileName(file_number), std::move(contents))); env_, GenerateFileName(file_number), contents));
} else { } else {
assert(false); assert(false);
} }

@ -3460,6 +3460,7 @@ static bool CompareIterators(int step, DB* model, DB* db,
ok = false; ok = false;
} }
} }
(void)count;
delete miter; delete miter;
delete dbiter; delete dbiter;
return ok; return ok;

@ -220,6 +220,7 @@ TEST_P(PrefetchTest, Basic) {
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
num_keys++; num_keys++;
} }
(void)num_keys;
} }
// Make sure prefetch is called only if file system support prefetch. // Make sure prefetch is called only if file system support prefetch.
@ -1803,6 +1804,7 @@ TEST_P(PrefetchTest, MultipleSeekWithPosixFS) {
} }
MoveFilesToLevel(2); MoveFilesToLevel(2);
} }
(void)total_keys;
int num_keys_first_batch = 0; int num_keys_first_batch = 0;
int num_keys_second_batch = 0; int num_keys_second_batch = 0;

@ -576,6 +576,7 @@ static void ConcurrentReader(void* arg) {
state->t_.ReadStep(&rnd); state->t_.ReadStep(&rnd);
++reads; ++reads;
} }
(void)reads;
state->Change(TestState::DONE); state->Change(TestState::DONE);
} }

@ -348,6 +348,7 @@ static void ConcurrentReader(void* arg) {
state->t_.ReadStep(&rnd); state->t_.ReadStep(&rnd);
++reads; ++reads;
} }
(void)reads;
state->Change(TestState::DONE); state->Change(TestState::DONE);
} }

@ -6984,6 +6984,8 @@ class Benchmark {
thread->stats.FinishedOps(&db_, db_.db, 1, kSeek); thread->stats.FinishedOps(&db_, db_.db, 1, kSeek);
} }
(void)num_seek_to_first;
(void)num_next;
delete iter; delete iter;
} }

Loading…
Cancel
Save