This is an automated email from the ASF dual-hosted git repository.

jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new fe55625  add a lot of override
fe55625 is described below

commit fe55625086f3b197c3a6d82dce6389324cd7dbcd
Author: gejun <ge...@bilibili.com>
AuthorDate: Wed Jun 12 16:31:37 2019 +0800

    add a lot of override
---
 src/brpc/acceptor.h                              |  2 +-
 src/brpc/callback.h                              |  2 +-
 src/brpc/cluster_recover_policy.h                |  6 +++---
 src/brpc/controller.h                            | 14 +++++++-------
 src/brpc/describable.h                           |  2 +-
 src/brpc/details/method_status.h                 |  2 +-
 src/brpc/policy/consul_naming_service.h          |  8 ++++----
 src/brpc/policy/domain_naming_service.h          |  8 ++++----
 src/brpc/policy/file_naming_service.h            |  8 ++++----
 src/brpc/policy/list_naming_service.h            | 10 +++++-----
 src/brpc/policy/remote_file_naming_service.h     |  8 ++++----
 src/brpc/rpc_dump.h                              |  6 +++---
 src/bthread/mutex.cpp                            |  6 +++---
 src/bthread/task_group.h                         |  2 +-
 src/butil/iobuf.h                                | 10 +++++-----
 src/butil/logging.cc                             |  2 +-
 src/butil/logging.h                              |  6 +++---
 src/butil/third_party/snappy/snappy-sinksource.h | 18 +++++++++---------
 src/butil/zero_copy_stream_as_streambuf.h        |  6 +++---
 src/bvar/detail/sampler.h                        |  2 +-
 src/bvar/gflag.h                                 |  5 ++---
 src/bvar/latency_recorder.h                      |  4 ++--
 src/bvar/passive_status.h                        |  8 ++++----
 src/bvar/recorder.h                              |  2 +-
 src/bvar/reducer.h                               | 11 +++++------
 src/bvar/status.h                                | 14 ++++++--------
 src/bvar/variable.cpp                            |  8 ++++----
 src/bvar/window.h                                |  9 ++++-----
 src/mcpack2pb/generator.cpp                      |  2 +-
 29 files changed, 93 insertions(+), 98 deletions(-)

diff --git a/src/brpc/acceptor.h b/src/brpc/acceptor.h
index 9bfb2e7..c472e88 100644
--- a/src/brpc/acceptor.h
+++ b/src/brpc/acceptor.h
@@ -88,7 +88,7 @@ private:
     int Initialize();
 
     // Remove the accepted socket `sock' from inside
-    virtual void BeforeRecycle(Socket* sock);
+    void BeforeRecycle(Socket* sock) override;
 
     bthread_keytable_pool_t* _keytable_pool; // owned by Server
     Status _status;
diff --git a/src/brpc/callback.h b/src/brpc/callback.h
index eeff5cd..334bb5c 100644
--- a/src/brpc/callback.h
+++ b/src/brpc/callback.h
@@ -86,7 +86,7 @@ class FunctionClosure0 : public ::google::protobuf::Closure {
     : function_(function), self_deleting_(self_deleting) {}
   ~FunctionClosure0() {}
 
-  void Run() {
+  void Run() override {
     bool needs_delete = self_deleting_;  // read in case callback deletes
     function_();
     if (needs_delete) delete this;
diff --git a/src/brpc/cluster_recover_policy.h 
b/src/brpc/cluster_recover_policy.h
index 4d4df0d..438ff53 100644
--- a/src/brpc/cluster_recover_policy.h
+++ b/src/brpc/cluster_recover_policy.h
@@ -59,9 +59,9 @@ class DefaultClusterRecoverPolicy : public 
ClusterRecoverPolicy {
 public:
     DefaultClusterRecoverPolicy(int64_t min_working_instances, int64_t 
hold_seconds);
 
-    void StartRecover();
-    bool DoReject(const std::vector<ServerId>& server_list);
-    bool StopRecoverIfNecessary();
+    void StartRecover() override;
+    bool DoReject(const std::vector<ServerId>& server_list) override;
+    bool StopRecoverIfNecessary() override;
 
 private:
     uint64_t GetUsableServerCount(int64_t now_ms, const std::vector<ServerId>& 
server_list);
diff --git a/src/brpc/controller.h b/src/brpc/controller.h
index 6e89681..9654ba1 100755
--- a/src/brpc/controller.h
+++ b/src/brpc/controller.h
@@ -336,7 +336,7 @@ public:
     // call the final "done" callback.
     // Note: Reaching deadline of the RPC would not affect this function, 
which means
     // even if deadline has been reached, this function may still return false.
-    bool IsCanceled() const;
+    bool IsCanceled() const override;
 
     // Asks that the given callback be called when the RPC is canceled or the
     // connection has broken.  The callback will always be called exactly once.
@@ -345,7 +345,7 @@ public:
     // when NotifyOnCancel() is called, the callback will be called 
immediately.
     //
     // NotifyOnCancel() must be called no more than once per request.
-    void NotifyOnCancel(google::protobuf::Closure* callback);
+    void NotifyOnCancel(google::protobuf::Closure* callback) override;
 
     // Returns the authenticated result. NULL if there is no authentication
     const AuthContext* auth_context() const { return _auth_context; }
@@ -437,7 +437,7 @@ public:
 
     // Resets the Controller to its initial state so that it may be reused in
     // a new call.  Must NOT be called while an RPC is in progress.
-    void Reset() {
+    void Reset() override {
         ResetNonPods();
         ResetPods();
     }
@@ -448,18 +448,18 @@ public:
     // as well if the protocol is HTTP. If you want to overwrite the 
     // status_code, call http_response().set_status_code() after SetFailed()
     // (rather than before SetFailed)
-    void SetFailed(const std::string& reason);
+    void SetFailed(const std::string& reason) override;
     void SetFailed(int error_code, const char* reason_fmt, ...)
         __attribute__ ((__format__ (__printf__, 3, 4)));
     
     // After a call has finished, returns true if the RPC call failed.
     // The response to Channel is undefined when Failed() is true.
     // Calling Failed() before a call has finished is undefined.
-    bool Failed() const;
+    bool Failed() const override;
 
     // If Failed() is true, return description of the errors.
     // NOTE: ErrorText() != berror(ErrorCode()). 
-    std::string ErrorText() const;
+    std::string ErrorText() const override;
 
     // Last error code. Equals 0 iff Failed() is false.
     // If there's retry, latter code overwrites former one.
@@ -557,7 +557,7 @@ private:
     void ResetPods();
     void ResetNonPods();
 
-    void StartCancel();
+    void StartCancel() override;
 
     // Using fixed start_realtime_us (microseconds since the Epoch) gives
     // more accurate deadline.
diff --git a/src/brpc/describable.h b/src/brpc/describable.h
index 5dbb397..07b5514 100644
--- a/src/brpc/describable.h
+++ b/src/brpc/describable.h
@@ -93,7 +93,7 @@ public:
         , _indent(indent, ' ')
     {}
 protected:
-    virtual int overflow(int ch) {
+    int overflow(int ch) override {
         if (_is_at_start_of_line && ch != '\n' ) {
             _dest->sputn(_indent.data(), _indent.size());
         }
diff --git a/src/brpc/details/method_status.h b/src/brpc/details/method_status.h
index a00e71f..8003a61 100644
--- a/src/brpc/details/method_status.h
+++ b/src/brpc/details/method_status.h
@@ -51,7 +51,7 @@ public:
     int Expose(const butil::StringPiece& prefix);
 
     // Describe internal vars, used by /status
-    void Describe(std::ostream &os, const DescribeOptions&) const;
+    void Describe(std::ostream &os, const DescribeOptions&) const override;
 
     // Current max_concurrency of the method.
     int MaxConcurrency() const { return _cl ? _cl->MaxConcurrency() : 0; }
diff --git a/src/brpc/policy/consul_naming_service.h 
b/src/brpc/policy/consul_naming_service.h
index 798ac5b..067a266 100644
--- a/src/brpc/policy/consul_naming_service.h
+++ b/src/brpc/policy/consul_naming_service.h
@@ -28,19 +28,19 @@ namespace policy {
 class ConsulNamingService : public NamingService {
 private:
     int RunNamingService(const char* service_name,
-                         NamingServiceActions* actions);
+                         NamingServiceActions* actions) override;
 
     int GetServers(const char* service_name,
                    std::vector<ServerNode>* servers);
 
-    void Describe(std::ostream& os, const DescribeOptions&) const;
+    void Describe(std::ostream& os, const DescribeOptions&) const override;
 
-    NamingService* New() const;
+    NamingService* New() const override;
 
     int DegradeToOtherServiceIfNeeded(const char* service_name,
                                       std::vector<ServerNode>* servers);
 
-    void Destroy();
+    void Destroy() override;
 
 private:
     Channel _channel;
diff --git a/src/brpc/policy/domain_naming_service.h 
b/src/brpc/policy/domain_naming_service.h
index 45b3e91..99195f4 100644
--- a/src/brpc/policy/domain_naming_service.h
+++ b/src/brpc/policy/domain_naming_service.h
@@ -30,13 +30,13 @@ public:
 
 private:
     int GetServers(const char *service_name,
-                   std::vector<ServerNode>* servers);
+                   std::vector<ServerNode>* servers) override;
 
-    void Describe(std::ostream& os, const DescribeOptions&) const;
+    void Describe(std::ostream& os, const DescribeOptions&) const override;
 
-    NamingService* New() const;
+    NamingService* New() const override;
     
-    void Destroy();
+    void Destroy() override;
 
 private:
     std::unique_ptr<char[]> _aux_buf;
diff --git a/src/brpc/policy/file_naming_service.h 
b/src/brpc/policy/file_naming_service.h
index 20616b6..2d2f4e1 100644
--- a/src/brpc/policy/file_naming_service.h
+++ b/src/brpc/policy/file_naming_service.h
@@ -27,16 +27,16 @@ class FileNamingService : public NamingService {
 friend class ConsulNamingService;
 private:
     int RunNamingService(const char* service_name,
-                         NamingServiceActions* actions);
+                         NamingServiceActions* actions) override;
 
     int GetServers(const char *service_name,
                    std::vector<ServerNode>* servers);
 
-    void Describe(std::ostream& os, const DescribeOptions&) const;
+    void Describe(std::ostream& os, const DescribeOptions&) const override;
 
-    NamingService* New() const;
+    NamingService* New() const override;
 
-    void Destroy();
+    void Destroy() override;
 };
 
 }  // namespace policy
diff --git a/src/brpc/policy/list_naming_service.h 
b/src/brpc/policy/list_naming_service.h
index a03ba08..d55196d 100644
--- a/src/brpc/policy/list_naming_service.h
+++ b/src/brpc/policy/list_naming_service.h
@@ -26,19 +26,19 @@ namespace policy {
 class ListNamingService : public NamingService {
 private:
     int RunNamingService(const char* service_name,
-                         NamingServiceActions* actions);
+                         NamingServiceActions* actions) override;
 
     // We don't need a dedicated bthread to run this static NS.
-    bool RunNamingServiceReturnsQuickly() { return true; }
+    bool RunNamingServiceReturnsQuickly() override { return true; }
     
     int GetServers(const char *service_name,
                    std::vector<ServerNode>* servers);
 
-    void Describe(std::ostream& os, const DescribeOptions& options) const;
+    void Describe(std::ostream& os, const DescribeOptions& options) const 
override;
 
-    NamingService* New() const;
+    NamingService* New() const override;
     
-    void Destroy();
+    void Destroy() override;
 };
 
 }  // namespace policy
diff --git a/src/brpc/policy/remote_file_naming_service.h 
b/src/brpc/policy/remote_file_naming_service.h
index 03bfdf1..be391c5 100644
--- a/src/brpc/policy/remote_file_naming_service.h
+++ b/src/brpc/policy/remote_file_naming_service.h
@@ -29,13 +29,13 @@ namespace policy {
 class RemoteFileNamingService : public PeriodicNamingService {
 private:
     int GetServers(const char* service_name,
-                   std::vector<ServerNode>* servers);
+                   std::vector<ServerNode>* servers) override;
 
-    void Describe(std::ostream& os, const DescribeOptions&) const;
+    void Describe(std::ostream& os, const DescribeOptions&) const override;
 
-    NamingService* New() const;
+    NamingService* New() const override;
     
-    void Destroy();
+    void Destroy() override;
     
 private:
     std::unique_ptr<Channel> _channel;
diff --git a/src/brpc/rpc_dump.h b/src/brpc/rpc_dump.h
index c7fd7d8..e17213b 100644
--- a/src/brpc/rpc_dump.h
+++ b/src/brpc/rpc_dump.h
@@ -51,9 +51,9 @@ struct SampledRequest : public bvar::Collected
     butil::IOBuf request;
 
     // Implement methods of Sampled.
-    void dump_and_destroy(size_t round);
-    void destroy();
-    bvar::CollectorSpeedLimit* speed_limit() {
+    void dump_and_destroy(size_t round) override;
+    void destroy() override;
+    bvar::CollectorSpeedLimit* speed_limit() override {
         extern bvar::CollectorSpeedLimit g_rpc_dump_sl;
         return &g_rpc_dump_sl;
     }
diff --git a/src/bthread/mutex.cpp b/src/bthread/mutex.cpp
index 0de00b2..e8660ae 100644
--- a/src/bthread/mutex.cpp
+++ b/src/bthread/mutex.cpp
@@ -65,9 +65,9 @@ struct SampledContention : public bvar::Collected {
     void* stack[26];      // backtrace.
 
     // Implement bvar::Collected
-    void dump_and_destroy(size_t round);
-    void destroy();
-    bvar::CollectorSpeedLimit* speed_limit() { return &g_cp_sl; }
+    void dump_and_destroy(size_t round) override;
+    void destroy() override;
+    bvar::CollectorSpeedLimit* speed_limit() override { return &g_cp_sl; }
 
     // For combining samples with hashmap.
     size_t hash_code() const {
diff --git a/src/bthread/task_group.h b/src/bthread/task_group.h
index 2a068f4..201472d 100644
--- a/src/bthread/task_group.h
+++ b/src/bthread/task_group.h
@@ -34,7 +34,7 @@ class ExitException : public std::exception {
 public:
     explicit ExitException(void* value) : _value(value) {}
     ~ExitException() throw() {}
-    const char* what() const throw() {
+    const char* what() const throw() override {
         return "ExitException";
     }
     void* value() const {
diff --git a/src/butil/iobuf.h b/src/butil/iobuf.h
index 40f015a..e376f7c 100644
--- a/src/butil/iobuf.h
+++ b/src/butil/iobuf.h
@@ -588,14 +588,14 @@ public:
     virtual ~IOBufAsSnappySource() {}
 
     // Return the number of bytes left to read from the source
-    virtual size_t Available() const;
+    size_t Available() const override;
 
     // Peek at the next flat region of the source.
-    virtual const char* Peek(size_t* len); 
+    const char* Peek(size_t* len) override; 
 
     // Skip the next n bytes.  Invalidates any buffer returned by
     // a previous call to Peek().
-    virtual void Skip(size_t n);
+    void Skip(size_t n) override;
     
 private:
     const butil::IOBuf* _buf;
@@ -609,10 +609,10 @@ public:
     virtual ~IOBufAsSnappySink() {}
 
     // Append "bytes[0,n-1]" to this.
-    virtual void Append(const char* bytes, size_t n);
+    void Append(const char* bytes, size_t n) override;
     
     // Returns a writable buffer of the specified length for appending.
-    virtual char* GetAppendBuffer(size_t length, char* scratch);
+    char* GetAppendBuffer(size_t length, char* scratch) override;
     
 private:
     char* _cur_buf;
diff --git a/src/butil/logging.cc b/src/butil/logging.cc
index b9e2b23..8a9b269 100644
--- a/src/butil/logging.cc
+++ b/src/butil/logging.cc
@@ -764,7 +764,7 @@ public:
     }
 
     bool OnLogMessage(int severity, const char* file, int line,
-                      const butil::StringPiece& content) {
+                      const butil::StringPiece& content) override {
         // There's a copy here to concatenate prefix and content. Since
         // DefaultLogSink is hardly used right now, the copy is irrelevant.
         // A LogSink focused on performance should also be able to handle
diff --git a/src/butil/logging.h b/src/butil/logging.h
index 998ee95..4f8b71c 100644
--- a/src/butil/logging.h
+++ b/src/butil/logging.h
@@ -321,7 +321,7 @@ BUTIL_EXPORT LogSink* SetLogSink(LogSink* sink);
 class StringSink : public LogSink, public std::string {
 public:
     bool OnLogMessage(int severity, const char* file, int line,
-                 const butil::StringPiece& log_content);
+                 const butil::StringPiece& log_content) override;
 private:
     butil::Lock _lock;
 };
@@ -857,8 +857,8 @@ public:
     explicit CharArrayStreamBuf() : _data(NULL), _size(0) {}
     ~CharArrayStreamBuf();
 
-    virtual int overflow(int ch);
-    virtual int sync();
+    int overflow(int ch) override;
+    int sync() override;
     void reset();
 
 private:
diff --git a/src/butil/third_party/snappy/snappy-sinksource.h 
b/src/butil/third_party/snappy/snappy-sinksource.h
index be0e74a..b34fb4c 100644
--- a/src/butil/third_party/snappy/snappy-sinksource.h
+++ b/src/butil/third_party/snappy/snappy-sinksource.h
@@ -148,9 +148,9 @@ class ByteArraySource : public Source {
  public:
   ByteArraySource(const char* p, size_t n) : ptr_(p), left_(n) { }
   virtual ~ByteArraySource();
-  virtual size_t Available() const;
-  virtual const char* Peek(size_t* len);
-  virtual void Skip(size_t n);
+  size_t Available() const override;
+  const char* Peek(size_t* len) override;
+  void Skip(size_t n) override;
  private:
   const char* ptr_;
   size_t left_;
@@ -161,14 +161,14 @@ class UncheckedByteArraySink : public Sink {
  public:
   explicit UncheckedByteArraySink(char* dest) : dest_(dest) { }
   virtual ~UncheckedByteArraySink();
-  virtual void Append(const char* data, size_t n);
-  virtual char* GetAppendBuffer(size_t len, char* scratch);
-  virtual char* GetAppendBufferVariable(
+  void Append(const char* data, size_t n) override;
+  char* GetAppendBuffer(size_t len, char* scratch) override;
+  char* GetAppendBufferVariable(
       size_t min_size, size_t desired_size_hint, char* scratch,
-      size_t scratch_size, size_t* allocated_size);
-  virtual void AppendAndTakeOwnership(
+      size_t scratch_size, size_t* allocated_size) override;
+  void AppendAndTakeOwnership(
       char* bytes, size_t n, void (*deleter)(void*, const char*, size_t),
-      void *deleter_arg);
+      void *deleter_arg) override;
 
   // Return the current output pointer so that a caller can see how
   // many bytes were produced.
diff --git a/src/butil/zero_copy_stream_as_streambuf.h 
b/src/butil/zero_copy_stream_as_streambuf.h
index c32f066..581e3e8 100644
--- a/src/butil/zero_copy_stream_as_streambuf.h
+++ b/src/butil/zero_copy_stream_as_streambuf.h
@@ -37,11 +37,11 @@ public:
     void shrink();
     
 protected:
-    virtual int overflow(int ch);
-    virtual int sync();
+    int overflow(int ch) override;
+    int sync() override;
     std::streampos seekoff(std::streamoff off,
                            std::ios_base::seekdir way,
-                           std::ios_base::openmode which);
+                           std::ios_base::openmode which) override;
 
 private:
     google::protobuf::io::ZeroCopyOutputStream* _zero_copy_stream;
diff --git a/src/bvar/detail/sampler.h b/src/bvar/detail/sampler.h
index eca55be..4dd809d 100644
--- a/src/bvar/detail/sampler.h
+++ b/src/bvar/detail/sampler.h
@@ -97,7 +97,7 @@ public:
     }
     ~ReducerSampler() {}
 
-    void take_sample() {
+    void take_sample() override {
         // Make _q ready.
         // If _window_size is larger than what _q can hold, e.g. a larger
         // Window<> is created after running of sampler, make _q larger.
diff --git a/src/bvar/gflag.h b/src/bvar/gflag.h
index c699226..bd2fb9d 100644
--- a/src/bvar/gflag.h
+++ b/src/bvar/gflag.h
@@ -34,11 +34,10 @@ public:
     // Calling hide() in dtor manually is a MUST required by Variable.
     ~GFlag() { hide(); }
 
-    // Implement Variable::describe() and Variable::get_value().
-    void describe(std::ostream& os, bool quote_string) const;
+    void describe(std::ostream& os, bool quote_string) const override;
 
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const;
+    void get_value(boost::any* value) const override;
 #endif
 
     // Get value of the gflag.
diff --git a/src/bvar/latency_recorder.h b/src/bvar/latency_recorder.h
index 75d21ac..09c40c4 100644
--- a/src/bvar/latency_recorder.h
+++ b/src/bvar/latency_recorder.h
@@ -37,8 +37,8 @@ class CDF : public Variable {
 public:
     explicit CDF(PercentileWindow* w);
     ~CDF();
-    void describe(std::ostream& os, bool quote_string) const;
-    int describe_series(std::ostream& os, const SeriesOptions& options) const;
+    void describe(std::ostream& os, bool quote_string) const override;
+    int describe_series(std::ostream& os, const SeriesOptions& options) const 
override;
 private:
     PercentileWindow* _w; 
 };
diff --git a/src/bvar/passive_status.h b/src/bvar/passive_status.h
index 9f5a3be..b37a713 100644
--- a/src/bvar/passive_status.h
+++ b/src/bvar/passive_status.h
@@ -57,7 +57,7 @@ public:
         ~SeriesSampler() {
             delete _vector_names;
         }
-        void take_sample() { _series.append(_owner->get_value()); }
+        void take_sample() override { _series.append(_owner->get_value()); }
         void describe(std::ostream& os) { _series.describe(os, _vector_names); 
}
         void set_vector_names(const std::string& names) {
             if (_vector_names == NULL) {
@@ -120,12 +120,12 @@ public:
         return -1;
     }
 
-    void describe(std::ostream& os, bool /*quote_string*/) const {
+    void describe(std::ostream& os, bool /*quote_string*/) const override {
         os << get_value();
     }
 
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const {
+    void get_value(boost::any* value) const override {
         if (_getfn) {
             *value = _getfn(_arg);
         } else {
@@ -217,7 +217,7 @@ public:
         hide();
     }
 
-    void describe(std::ostream& os, bool quote_string) const {
+    void describe(std::ostream& os, bool quote_string) const override {
         if (quote_string) {
             if (_print) {
                 os << '"';
diff --git a/src/bvar/recorder.h b/src/bvar/recorder.h
index 6ef63c5..2c858a7 100644
--- a/src/bvar/recorder.h
+++ b/src/bvar/recorder.h
@@ -154,7 +154,7 @@ public:
     AddStat op() const { return AddStat(); }
     MinusStat inv_op() const { return MinusStat(); }
     
-    void describe(std::ostream& os, bool /*quote_string*/) const {
+    void describe(std::ostream& os, bool /*quote_string*/) const override {
         os << get_value();
     }
 
diff --git a/src/bvar/reducer.h b/src/bvar/reducer.h
index cba8335..0756216 100644
--- a/src/bvar/reducer.h
+++ b/src/bvar/reducer.h
@@ -74,7 +74,7 @@ public:
         SeriesSampler(Reducer* owner, const Op& op)
             : _owner(owner), _series(op) {}
         ~SeriesSampler() {}
-        void take_sample() { _series.append(_owner->get_value()); }
+        void take_sample() override { _series.append(_owner->get_value()); }
         void describe(std::ostream& os) { _series.describe(os, NULL); }
     private:
         Reducer* _owner;
@@ -125,8 +125,7 @@ public:
     // Returns the reduced value before reset.
     T reset() { return _combiner.reset_all_agents(); }
 
-    // Implement Variable::describe() and Variable::get_value().
-    void describe(std::ostream& os, bool quote_string) const {
+    void describe(std::ostream& os, bool quote_string) const override {
         if (butil::is_same<T, std::string>::value && quote_string) {
             os << '"' << get_value() << '"';
         } else {
@@ -135,7 +134,7 @@ public:
     }
     
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const { *value = get_value(); }
+    void get_value(boost::any* value) const override { *value = get_value(); }
 #endif
 
     // True if this reducer is constructed successfully.
@@ -153,7 +152,7 @@ public:
         return _sampler;
     }
 
-    int describe_series(std::ostream& os, const SeriesOptions& options) const {
+    int describe_series(std::ostream& os, const SeriesOptions& options) const 
override {
         if (_series_sampler == NULL) {
             return 1;
         }
@@ -166,7 +165,7 @@ public:
 protected:
     int expose_impl(const butil::StringPiece& prefix,
                     const butil::StringPiece& name,
-                    DisplayFilter display_filter) {
+                    DisplayFilter display_filter) override {
         const int rc = Variable::expose_impl(prefix, name, display_filter);
         if (rc == 0 &&
             _series_sampler == NULL &&
diff --git a/src/bvar/status.h b/src/bvar/status.h
index 568fa87..64096b6 100644
--- a/src/bvar/status.h
+++ b/src/bvar/status.h
@@ -52,13 +52,12 @@ public:
     // Calling hide() manually is a MUST required by Variable.
     ~Status() { hide(); }
 
-    // Implement Variable::describe() and Variable::get_value().
-    void describe(std::ostream& os, bool /*quote_string*/) const {
+    void describe(std::ostream& os, bool /*quote_string*/) const override {
         os << get_value();
     }
     
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const {
+    void get_value(boost::any* value) const override {
         butil::AutoLock guard(_lock);
         *value = _value;
     }
@@ -122,13 +121,12 @@ public:
         }
     }
 
-    // Implement Variable::describe() and Variable::get_value().
-    void describe(std::ostream& os, bool /*quote_string*/) const {
+    void describe(std::ostream& os, bool /*quote_string*/) const override {
         os << get_value();
     }
     
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const {
+    void get_value(boost::any* value) const override {
         *value = get_value();
     }
 #endif
@@ -197,7 +195,7 @@ public:
 
     ~Status() { hide(); }
 
-    void describe(std::ostream& os, bool quote_string) const {
+    void describe(std::ostream& os, bool quote_string) const override {
         if (quote_string) {
             os << '"' << get_value() << '"';
         } else {
@@ -211,7 +209,7 @@ public:
     }
 
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const {
+    void get_value(boost::any* value) const override {
         *value = get_value();
     }
 #endif
diff --git a/src/bvar/variable.cpp b/src/bvar/variable.cpp
index da53833..deb6245 100644
--- a/src/bvar/variable.cpp
+++ b/src/bvar/variable.cpp
@@ -315,8 +315,8 @@ public:
     explicit CharArrayStreamBuf() : _data(NULL), _size(0) {}
     ~CharArrayStreamBuf();
 
-    virtual int overflow(int ch);
-    virtual int sync();
+    int overflow(int ch) override;
+    int sync() override;
     void reset();
     butil::StringPiece data() {
         return butil::StringPiece(pbase(), pptr() - pbase());
@@ -586,7 +586,7 @@ public:
             _fp = NULL;
         }
     }
-    bool dump(const std::string& name, const butil::StringPiece& desc) {
+    bool dump(const std::string& name, const butil::StringPiece& desc) 
override {
         if (_fp == NULL) {
             butil::File::Error error;
             butil::FilePath dir = butil::FilePath(_filename).DirName();
@@ -647,7 +647,7 @@ public:
         dumpers.clear();
     }
 
-    bool dump(const std::string& name, const butil::StringPiece& desc) {
+    bool dump(const std::string& name, const butil::StringPiece& desc) 
override {
         for (size_t i = 0; i < dumpers.size() - 1; ++i) {
             if (dumpers[i].second->match(name)) {
                 return dumpers[i].first->dump(name, desc);
diff --git a/src/bvar/window.h b/src/bvar/window.h
index f67a8e9..bf3c001 100644
--- a/src/bvar/window.h
+++ b/src/bvar/window.h
@@ -56,7 +56,7 @@ public:
         SeriesSampler(WindowBase* owner, R* var)
             : _owner(owner), _series(Op(var)) {}
         ~SeriesSampler() {}
-        void take_sample() {
+        void take_sample() override {
             if (series_freq == SERIES_IN_SECOND) {
                 // Get one-second window value for PerSecond<>, otherwise the
                 // "smoother" plot may hide peaks.
@@ -108,8 +108,7 @@ public:
 
     value_type get_value() const { return get_value(_window_size); }
     
-    // Implement Variable::describe() and Variable::get_value().
-    void describe(std::ostream& os, bool quote_string) const {
+    void describe(std::ostream& os, bool quote_string) const override {
         if (butil::is_same<value_type, std::string>::value && quote_string) {
             os << '"' << get_value() << '"';
         } else {
@@ -118,7 +117,7 @@ public:
     }
     
 #ifdef BAIDU_INTERNAL
-    void get_value(boost::any* value) const { *value = get_value(); }
+    void get_value(boost::any* value) const override { *value = get_value(); }
 #endif
 
     time_t window_size() const { return _window_size; }
@@ -219,7 +218,7 @@ public:
         this->expose_as(prefix, name);
     }
 
-    virtual value_type get_value(time_t window_size) const {
+    value_type get_value(time_t window_size) const override {
         detail::Sample<value_type> s;
         this->get_span(window_size, &s);
         // We may test if the multiplication overflows and use integral ops
diff --git a/src/mcpack2pb/generator.cpp b/src/mcpack2pb/generator.cpp
index 2e6799d..ce7fbfd 100644
--- a/src/mcpack2pb/generator.cpp
+++ b/src/mcpack2pb/generator.cpp
@@ -1345,7 +1345,7 @@ public:
     bool Generate(const google::protobuf::FileDescriptor* file,
                   const std::string& parameter,
                   google::protobuf::compiler::GeneratorContext*,
-                  std::string* error) const;
+                  std::string* error) const override;
 };
 
 bool McpackToProtobuf::Generate(const google::protobuf::FileDescriptor* file,


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to