Skip to content

Commit

Permalink
fix compilation with g++ option -Wsuggest-override (facebook#4272)
Browse files Browse the repository at this point in the history
Summary:
Fixes compilation warnings (which are turned into compilation errors by default) when compiling with g++ option `-Wsuggest-override`.
Pull Request resolved: facebook#4272

Differential Revision: D9322556

Pulled By: siying

fbshipit-source-id: abd57a29ec8f544bee77c0bb438f31be830b7244
  • Loading branch information
jsteemann authored and facebook-github-bot committed Aug 14, 2018
1 parent bf07e90 commit 33ad906
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
24 changes: 12 additions & 12 deletions db/range_del_aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class UncollapsedRangeDelMap : public RangeDelMap {
: rep_(TombstoneStartKeyComparator(ucmp)), ucmp_(ucmp) {}

bool ShouldDelete(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) {
RangeDelPositioningMode mode) override {
(void)mode;
assert(mode == RangeDelPositioningMode::kFullScan);
for (const auto& tombstone : rep_) {
Expand All @@ -65,7 +65,7 @@ class UncollapsedRangeDelMap : public RangeDelMap {
return false;
}

bool IsRangeOverlapped(const Slice& start, const Slice& end) {
bool IsRangeOverlapped(const Slice& start, const Slice& end) override {
for (const auto& tombstone : rep_) {
if (ucmp_->Compare(start, tombstone.end_key_) < 0 &&
ucmp_->Compare(tombstone.start_key_, end) <= 0 &&
Expand All @@ -76,13 +76,13 @@ class UncollapsedRangeDelMap : public RangeDelMap {
return false;
}

void AddTombstone(RangeTombstone tombstone) { rep_.emplace(tombstone); }
void AddTombstone(RangeTombstone tombstone) override { rep_.emplace(tombstone); }

size_t Size() const { return rep_.size(); }
size_t Size() const override { return rep_.size(); }

void InvalidatePosition() {} // no-op
void InvalidatePosition() override {} // no-op

std::unique_ptr<RangeDelIterator> NewIterator() {
std::unique_ptr<RangeDelIterator> NewIterator() override {
return std::unique_ptr<RangeDelIterator>(new Iterator(this->rep_));
}
};
Expand Down Expand Up @@ -176,7 +176,7 @@ class CollapsedRangeDelMap : public RangeDelMap {
}

bool ShouldDelete(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) {
RangeDelPositioningMode mode) override {
if (iter_ == rep_.end() &&
(mode == RangeDelPositioningMode::kForwardTraversal ||
mode == RangeDelPositioningMode::kBackwardTraversal)) {
Expand Down Expand Up @@ -227,14 +227,14 @@ class CollapsedRangeDelMap : public RangeDelMap {
return parsed.sequence < iter_->second;
}

bool IsRangeOverlapped(const Slice&, const Slice&) {
bool IsRangeOverlapped(const Slice&, const Slice&) override {
// Unimplemented because the only client of this method, file ingestion,
// uses uncollapsed maps.
fprintf(stderr, "CollapsedRangeDelMap::IsRangeOverlapped unimplemented");
abort();
}

void AddTombstone(RangeTombstone t) {
void AddTombstone(RangeTombstone t) override {
if (ucmp_->Compare(t.start_key_, t.end_key_) >= 0 || t.seq_ == 0) {
// The tombstone covers no keys. Nothing to do.
return;
Expand Down Expand Up @@ -344,11 +344,11 @@ class CollapsedRangeDelMap : public RangeDelMap {
}
}

size_t Size() const { return rep_.size() - 1; }
size_t Size() const override { return rep_.size() - 1; }

void InvalidatePosition() { iter_ = rep_.end(); }
void InvalidatePosition() override { iter_ = rep_.end(); }

std::unique_ptr<RangeDelIterator> NewIterator() {
std::unique_ptr<RangeDelIterator> NewIterator() override {
return std::unique_ptr<RangeDelIterator>(new Iterator(this->rep_));
}
};
Expand Down
2 changes: 1 addition & 1 deletion db/snapshot_checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DisableGCSnapshotChecker : public SnapshotChecker {
public:
virtual ~DisableGCSnapshotChecker() {}
virtual bool IsInSnapshot(SequenceNumber /*sequence*/,
SequenceNumber /*snapshot_sequence*/) const {
SequenceNumber /*snapshot_sequence*/) const override {
// By returning false, we prevent all the values from being GCed
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions util/testutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class RandomRWStringSink : public RandomRWFile {
public:
explicit RandomRWStringSink(StringSink* ss) : ss_(ss) {}

Status Write(uint64_t offset, const Slice& data) {
Status Write(uint64_t offset, const Slice& data) override {
if (offset + data.size() > ss_->contents_.size()) {
ss_->contents_.resize(offset + data.size(), '\0');
}
Expand All @@ -258,7 +258,7 @@ class RandomRWStringSink : public RandomRWFile {
}

Status Read(uint64_t offset, size_t n, Slice* result,
char* /*scratch*/) const {
char* /*scratch*/) const override {
*result = Slice(nullptr, 0);
if (offset < ss_->contents_.size()) {
size_t str_res_sz =
Expand All @@ -268,11 +268,11 @@ class RandomRWStringSink : public RandomRWFile {
return Status::OK();
}

Status Flush() { return Status::OK(); }
Status Flush() override { return Status::OK(); }

Status Sync() { return Status::OK(); }
Status Sync() override { return Status::OK(); }

Status Close() { return Status::OK(); }
Status Close() override { return Status::OK(); }

const std::string& contents() const { return ss_->contents(); }

Expand Down
10 changes: 5 additions & 5 deletions utilities/env_mirror.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SequentialFileMirror : public SequentialFile {
std::string fname;
explicit SequentialFileMirror(std::string f) : fname(f) {}

Status Read(size_t n, Slice* result, char* scratch) {
Status Read(size_t n, Slice* result, char* scratch) override {
Slice aslice;
Status as = a_->Read(n, &aslice, scratch);
if (as == Status::OK()) {
Expand All @@ -44,13 +44,13 @@ class SequentialFileMirror : public SequentialFile {
return as;
}

Status Skip(uint64_t n) {
Status Skip(uint64_t n) override {
Status as = a_->Skip(n);
Status bs = b_->Skip(n);
assert(as == bs);
return as;
}
Status InvalidateCache(size_t offset, size_t length) {
Status InvalidateCache(size_t offset, size_t length) override {
Status as = a_->InvalidateCache(offset, length);
Status bs = b_->InvalidateCache(offset, length);
assert(as == bs);
Expand All @@ -64,7 +64,7 @@ class RandomAccessFileMirror : public RandomAccessFile {
std::string fname;
explicit RandomAccessFileMirror(std::string f) : fname(f) {}

Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const {
Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const override {
Status as = a_->Read(offset, n, result, scratch);
if (as == Status::OK()) {
char* bscratch = new char[n];
Expand All @@ -86,7 +86,7 @@ class RandomAccessFileMirror : public RandomAccessFile {
return as;
}

size_t GetUniqueId(char* id, size_t max_size) const {
size_t GetUniqueId(char* id, size_t max_size) const override {
// NOTE: not verified
return a_->GetUniqueId(id, max_size);
}
Expand Down
10 changes: 5 additions & 5 deletions utilities/persistent_cache/persistent_cache_tier.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,20 @@ class PersistentCacheTier : public PersistentCache {
// Print stats to string recursively
virtual std::string PrintStats();

virtual PersistentCache::StatsType Stats();
virtual PersistentCache::StatsType Stats() override;

// Insert to page cache
virtual Status Insert(const Slice& page_key, const char* data,
const size_t size) = 0;
const size_t size) override = 0;

// Lookup page cache by page identifier
virtual Status Lookup(const Slice& page_key, std::unique_ptr<char[]>* data,
size_t* size) = 0;
size_t* size) override = 0;

// Does it store compressed data ?
virtual bool IsCompressed() = 0;
virtual bool IsCompressed() override = 0;

virtual std::string GetPrintableOptions() const = 0;
virtual std::string GetPrintableOptions() const override = 0;

// Return a reference to next tier
virtual Tier& next_tier() { return next_tier_; }
Expand Down

0 comments on commit 33ad906

Please sign in to comment.