Skip to content

Commit e262592

Browse files
authored
[ML] Fix warnings due to -Wsuggest-override compiler flag (#2119)
Adding the `override` keyword where necessary to subdue compiler warnings.
1 parent 0c07b85 commit e262592

File tree

73 files changed

+986
-1011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+986
-1011
lines changed

include/api/CAnomalyJobConfigReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class API_EXPORT CAnomalyJobConfigReader {
6565
public:
6666
explicit CParseError(const std::string& what)
6767
: std::runtime_error{what} {}
68-
virtual ~CParseError() noexcept = default;
68+
~CParseError() noexcept override = default;
6969
};
7070

7171
public:

include/api/CHierarchicalResultsWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class API_EXPORT CHierarchicalResultsWriter : public model::CHierarchicalResults
154154
const TPivotWriterFunc& pivotsWriterFunc);
155155

156156
//! Write \p node.
157-
virtual void visit(const model::CHierarchicalResults& results, const TNode& node, bool pivot);
157+
void visit(const model::CHierarchicalResults& results, const TNode& node, bool pivot) override;
158158

159159
private:
160160
//! Write out a population person result if \p node is a

include/api/CInferenceModelDefinition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class API_EXPORT CTrainedModel : public CSerializableToJsonStream {
164164
using TSizeInfoUPtr = std::unique_ptr<CSizeInfo>;
165165

166166
public:
167-
virtual ~CTrainedModel() override = default;
167+
~CTrainedModel() override = default;
168168
void addToJsonStream(TGenericLineWriter& writer) const override;
169169
//! Names of the features used by the model.
170170
virtual const TStringVec& featureNames() const;

include/api/CPersistenceManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class API_EXPORT CPersistenceManager : private core::CNonCopyable {
150150

151151
protected:
152152
//! Inherited virtual interface
153-
virtual void run();
154-
virtual void shutdown();
153+
void run() override;
154+
void shutdown() override;
155155

156156
private:
157157
//! Reference to the owning background persister

include/core/CBlockingCallCancellingTimer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class CORE_EXPORT CBlockingCallCancellingTimer : public CBlockingCallCancellerTh
5656
//! Derived classes must implement this such that it waits for the
5757
//! appropriate indication that the blocking call should be cancelled,
5858
//! or until it is told to stop waiting by stopWaitForCondition().
59-
virtual void waitForCondition();
59+
void waitForCondition() override;
6060

6161
//! Derived classes must implement this such that when called it causes
6262
//! the waitForCondition() method to return false immediately.
63-
virtual void stopWaitForCondition();
63+
void stopWaitForCondition() override;
6464

6565
private:
6666
using TMutexUniqueLock = std::unique_lock<std::mutex>;

include/core/CCompressOStream.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CORE_EXPORT CCompressOStream : public std::ostream {
3939
CCompressOStream(CStateCompressor::CChunkFilter& filter);
4040

4141
//! Destructor will close the stream
42-
virtual ~CCompressOStream();
42+
~CCompressOStream() override;
4343

4444
//! Close the stream
4545
void close();
@@ -53,8 +53,8 @@ class CORE_EXPORT CCompressOStream : public std::ostream {
5353

5454
protected:
5555
//! Implementation of inherited interface
56-
virtual void run();
57-
virtual void shutdown();
56+
void run() override;
57+
void shutdown() override;
5858

5959
public:
6060
//! Reference to the owning stream

include/core/CDualThreadStreamBuf.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,41 +88,41 @@ class CORE_EXPORT CDualThreadStreamBuf : public std::streambuf {
8888
//! Get an estimate of the number of characters still to read after an
8989
//! underflow. In the case of this class we return the amount of data
9090
//! in the intermediate buffer.
91-
virtual std::streamsize showmanyc();
91+
std::streamsize showmanyc() override;
9292

9393
//! Switch the buffers immediately. Effectively this flushes data
9494
//! through with lower latency but also less efficiently.
95-
virtual int sync();
95+
int sync() override;
9696

9797
//! Get up to n characters from the read buffer and store them in the
9898
//! array pointed to by s.
99-
virtual std::streamsize xsgetn(char* s, std::streamsize n);
99+
std::streamsize xsgetn(char* s, std::streamsize n) override;
100100

101101
//! Try to obtain more data for the write buffer. This is done by
102102
//! swapping it with the intermediate buffer. This may block if no data
103103
//! is available to read in the intermediate buffer.
104-
virtual int underflow();
104+
int underflow() override;
105105

106106
//! Put character back in the case of backup underflow.
107-
virtual int pbackfail(int c = traits_type::eof());
107+
int pbackfail(int c = traits_type::eof()) override;
108108

109109
//! Write up to n characters from the array pointed to by s into the
110110
//! write buffer.
111-
virtual std::streamsize xsputn(const char* s, std::streamsize n);
111+
std::streamsize xsputn(const char* s, std::streamsize n) override;
112112

113113
//! Try to obtain more space in the write buffer. This is done by
114114
//! swapping it with the intermediate buffer. This may block if no data
115115
//! is available to read in the intermediate buffer.
116-
virtual int overflow(int c = traits_type::eof());
116+
int overflow(int c = traits_type::eof()) override;
117117

118118
//! In a random access stream this would seek to the specified position.
119119
//! This class does not support such seeking, but implements this method
120120
//! allowing a zero byte seek in order to allow tellg() and tellp() to
121121
//! work on the connected stream.
122-
virtual std::streampos
123-
seekoff(std::streamoff off,
124-
std::ios_base::seekdir way,
125-
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
122+
std::streampos seekoff(std::streamoff off,
123+
std::ios_base::seekdir way,
124+
std::ios_base::openmode which = std::ios_base::in |
125+
std::ios_base::out) override;
126126

127127
private:
128128
//! Swap the intermediate buffer with the write buffer. Will block if

include/core/CJsonStatePersistInserter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ class CORE_EXPORT CJsonStatePersistInserter : public CStatePersistInserter {
4545
CJsonStatePersistInserter(std::ostream& outputStream);
4646

4747
//! Destructor flushes
48-
virtual ~CJsonStatePersistInserter();
48+
~CJsonStatePersistInserter() override;
4949

5050
//! Store a name/value
51-
virtual void insertValue(const std::string& name, const std::string& value);
51+
void insertValue(const std::string& name, const std::string& value) override;
5252

5353
//! Write as an integer avoiding the string conversion
5454
//! overloads
@@ -62,10 +62,10 @@ class CORE_EXPORT CJsonStatePersistInserter : public CStatePersistInserter {
6262

6363
protected:
6464
//! Start a new level with the given name
65-
virtual void newLevel(const std::string& name);
65+
void newLevel(const std::string& name) override;
6666

6767
//! End the current level
68-
virtual void endLevel();
68+
void endLevel() override;
6969

7070
private:
7171
//! JSON writer ostream wrapper

include/core/CRapidJsonConcurrentLineWriter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CORE_EXPORT CRapidJsonConcurrentLineWriter
5151
//! \p outStream reference to an wrapped output stream
5252
CRapidJsonConcurrentLineWriter(CJsonOutputStreamWrapper& outStream);
5353

54-
~CRapidJsonConcurrentLineWriter();
54+
~CRapidJsonConcurrentLineWriter() override;
5555

5656
//! Flush buffers, including the output stream.
5757
//! Note: flush still happens asynchronous
@@ -72,7 +72,7 @@ class CORE_EXPORT CRapidJsonConcurrentLineWriter
7272
//! are not virtual and we need to avoid "slicing" the writer to ensure that
7373
//! that the correct StartObject/EndObject functions are called when this is
7474
//! passed to \p doc Accept.
75-
void write(const rapidjson::Value& doc) { doc.Accept(*this); }
75+
void write(const rapidjson::Value& doc) override { doc.Accept(*this); }
7676

7777
private:
7878
//! The stream object

include/core/CRapidJsonLineWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CRapidJsonLineWriter
6464
//! are not virtual and we need to avoid "slicing" the writer to ensure that
6565
//! that the correct StartObject/EndObject functions are called when this is
6666
//! passed to \p doc Accept.
67-
void write(const rapidjson::Value& doc) { doc.Accept(*this); }
67+
void write(const rapidjson::Value& doc) override { doc.Accept(*this); }
6868

6969
private:
7070
size_t m_ObjectCount = 0;

0 commit comments

Comments
 (0)