Skip to content

Commit

Permalink
Fix MyRocks compile warnings-treated-as-errors on Fedora 30, gcc 9.1.1 (
Browse files Browse the repository at this point in the history
facebook#5553)

Summary:
- Provide assignment operator in CompactionStats
- Provide a copy constructor for FileDescriptor
- Remove std::move from "return std::move(t)" in BoundedQueue
Pull Request resolved: facebook#5553

Differential Revision: D16230170

fbshipit-source-id: fd7c6e52390b2db1be24141e25649cf62424d078
  • Loading branch information
spetrunia authored and facebook-github-bot committed Jul 13, 2019
1 parent 3e9c5a3 commit 6187661
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
22 changes: 22 additions & 0 deletions db/internal_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,28 @@ class InternalStats {
}
}

CompactionStats& operator=(const CompactionStats& c) {
micros = c.micros;
cpu_micros = c.cpu_micros;
bytes_read_non_output_levels = c.bytes_read_non_output_levels;
bytes_read_output_level = c.bytes_read_output_level;
bytes_written = c.bytes_written;
bytes_moved = c.bytes_moved;
num_input_files_in_non_output_levels =
c.num_input_files_in_non_output_levels;
num_input_files_in_output_level = c.num_input_files_in_output_level;
num_output_files = c.num_output_files;
num_input_records = c.num_input_records;
num_dropped_records = c.num_dropped_records;
count = c.count;

int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
for (int i = 0; i < num_of_reasons; i++) {
counts[i] = c.counts[i];
}
return *this;
}

void Clear() {
this->micros = 0;
this->cpu_micros = 0;
Expand Down
2 changes: 2 additions & 0 deletions db/version_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct FileDescriptor {
smallest_seqno(_smallest_seqno),
largest_seqno(_largest_seqno) {}

FileDescriptor(const FileDescriptor& fd) { *this=fd; }

FileDescriptor& operator=(const FileDescriptor& fd) {
table_reader = fd.table_reader;
packed_number_and_path_id = fd.packed_number_and_path_id;
Expand Down
2 changes: 1 addition & 1 deletion utilities/persistent_cache/persistent_cache_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BoundedQueue {
T t = std::move(q_.front());
size_ -= t.Size();
q_.pop_front();
return std::move(t);
return t;
}

size_t Size() const {
Expand Down

0 comments on commit 6187661

Please sign in to comment.