You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wk...@apache.org on 2022/03/17 00:19:19 UTC

[trafficserver] branch force-override created (now 5ad76b9)

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

wkaras pushed a change to branch force-override
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


      at 5ad76b9  Require use of 'override' keyword when valid.

This branch includes the following new commits:

     new 5ad76b9  Require use of 'override' keyword when valid.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[trafficserver] 01/01: Require use of 'override' keyword when valid.

Posted by wk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a commit to branch force-override
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 5ad76b97ee9db2aa3197a4824d44e4cd5b2b5810
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Wed Mar 16 19:18:17 2022 -0500

    Require use of 'override' keyword when valid.
---
 configure.ac                                  |  2 +-
 include/tscore/PluginUserArgs.h               |  4 ++--
 iocore/cache/CacheTest.cc                     | 31 ++++++++++++++-------------
 iocore/cache/P_CacheTest.h                    |  4 ++--
 plugins/esi/esi.cc                            |  4 ++--
 plugins/esi/test/StubIncludeHandler.h         |  8 +++----
 plugins/esi/test/TestHttpDataFetcher.h        |  8 +++----
 plugins/experimental/parent_select/strategy.h | 30 +++++++++++++-------------
 proxy/http/remap/PluginDso.h                  |  4 ++--
 9 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/configure.ac b/configure.ac
index 98d9b33..474f661 100644
--- a/configure.ac
+++ b/configure.ac
@@ -863,7 +863,7 @@ case $host_os_def in
       common_opt="-pipe -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-format-truncation -Wno-cast-function-type -Wno-stringop-overflow"
       debug_opt="-ggdb3 $common_opt"
       release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing"
-      cxx_opt="-Wno-invalid-offsetof -Wno-noexcept-type"
+      cxx_opt="-Wno-invalid-offsetof -Wno-noexcept-type -Wsuggest-override"
       # Special options for flex generated .c files
       flex_cflags="-Wno-unused-parameter"
     ])
diff --git a/include/tscore/PluginUserArgs.h b/include/tscore/PluginUserArgs.h
index 4dd637b..b466829 100644
--- a/include/tscore/PluginUserArgs.h
+++ b/include/tscore/PluginUserArgs.h
@@ -86,7 +86,7 @@ template <TSUserArgType I> class PluginUserArgs : public virtual PluginUserArgsM
 {
 public:
   void *
-  get_user_arg(size_t ix) const
+  get_user_arg(size_t ix) const override
   {
     ink_release_assert(SanityCheckUserIndex(I, ix));
     ix -= get_user_arg_offset(I);
@@ -95,7 +95,7 @@ public:
   };
 
   void
-  set_user_arg(size_t ix, void *arg)
+  set_user_arg(size_t ix, void *arg) override
   {
     ink_release_assert(SanityCheckUserIndex(I, ix));
     ix -= get_user_arg_offset(I);
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index 97f1301..f1d50fd 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -334,7 +334,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
 
   CACHE_SM(
     t, replace_write_test,
-    { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); } int open_write_callout() {
+    { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); } int open_write_callout() override {
       header.serial = 10;
       cache_vc->set_header(&header, sizeof(header));
       cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
@@ -347,18 +347,19 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
 
   CACHE_SM(
     t, replace_test,
-    { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_OVERWRITE_SYNC); } int open_write_callout() {
-      CacheTestHeader *h = nullptr;
-      int hlen           = 0;
-      if (cache_vc->get_header((void **)&h, &hlen) < 0)
-        return -1;
-      if (h->serial != 10)
-        return -1;
-      header.serial = 11;
-      cache_vc->set_header(&header, sizeof(header));
-      cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
-      return 1;
-    });
+    { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_OVERWRITE_SYNC); } int open_write_callout()
+      override {
+        CacheTestHeader *h = nullptr;
+        int hlen           = 0;
+        if (cache_vc->get_header((void **)&h, &hlen) < 0)
+          return -1;
+        if (h->serial != 10)
+          return -1;
+        header.serial = 11;
+        cache_vc->set_header(&header, sizeof(header));
+        cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
+        return 1;
+      });
   replace_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   replace_test.expect_event         = VC_EVENT_WRITE_COMPLETE;
   replace_test.nbytes               = 100;
@@ -366,7 +367,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
   replace_test.content_salt         = 1;
 
   CACHE_SM(
-    t, replace_read_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
+    t, replace_read_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() override {
       CacheTestHeader *h = nullptr;
       int hlen           = 0;
       if (cache_vc->get_header((void **)&h, &hlen) < 0)
@@ -389,7 +390,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
   rand_CacheKey(&large_write_test.key, thread->mutex);
 
   CACHE_SM(
-    t, pread_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
+    t, pread_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() override {
       cvio = cache_vc->do_io_pread(this, nbytes, buffer, 7000000);
       return 1;
     });
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index 47f0cfd..40d797c 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -130,7 +130,7 @@ struct CacheTestSM : public RegressionSM {
 #define CACHE_SM(_t, _sm, _f)                                               \
   struct CacheTestSM__##_sm : public CacheTestSM {                          \
     void                                                                    \
-    make_request_internal() _f                                              \
+    make_request_internal() override _f                                     \
                                                                             \
       CacheTestSM__##_sm(RegressionTest *t)                                 \
       : CacheTestSM(t, #_sm)                                                \
@@ -139,7 +139,7 @@ struct CacheTestSM : public RegressionSM {
                                                                             \
     CacheTestSM__##_sm(const CacheTestSM__##_sm &xsm) : CacheTestSM(xsm) {} \
     RegressionSM *                                                          \
-    clone()                                                                 \
+    clone() override                                                        \
     {                                                                       \
       return new CacheTestSM__##_sm(*this);                                 \
     }                                                                       \
diff --git a/plugins/esi/esi.cc b/plugins/esi/esi.cc
index 3b29f83..3eb18d2 100644
--- a/plugins/esi/esi.cc
+++ b/plugins/esi/esi.cc
@@ -169,13 +169,13 @@ class TSStatSystem : public StatSystem
 {
 public:
   void
-  create(int handle)
+  create(int handle) override
   {
     g_stat_indices[handle] = TSStatCreate(Stats::STAT_NAMES[handle], TS_RECORDDATATYPE_INT, TS_STAT_PERSISTENT, TS_STAT_SYNC_COUNT);
   }
 
   void
-  increment(int handle, int step = 1)
+  increment(int handle, int step = 1) override
   {
     TSStatIntIncrement(g_stat_indices[handle], step);
   }
diff --git a/plugins/esi/test/StubIncludeHandler.h b/plugins/esi/test/StubIncludeHandler.h
index 1b22e29..918ee46 100644
--- a/plugins/esi/test/StubIncludeHandler.h
+++ b/plugins/esi/test/StubIncludeHandler.h
@@ -34,14 +34,14 @@ public:
   {
   }
 
-  int handleInclude(const char *data, int data_len);
+  int handleInclude(const char *data, int data_len) override;
 
   bool parseCompleteCalled;
-  void handleParseComplete();
+  void handleParseComplete() override;
 
-  bool getData(int include_id, const char *&data, int &data_len);
+  bool getData(int include_id, const char *&data, int &data_len) override;
 
-  void getFooter(const char *&footer, int &footer_len);
+  void getFooter(const char *&footer, int &footer_len) override;
 
   ~StubIncludeHandler();
 
diff --git a/plugins/esi/test/TestHttpDataFetcher.h b/plugins/esi/test/TestHttpDataFetcher.h
index cd2ee59..49f7d00 100644
--- a/plugins/esi/test/TestHttpDataFetcher.h
+++ b/plugins/esi/test/TestHttpDataFetcher.h
@@ -32,14 +32,14 @@ class TestHttpDataFetcher : public HttpDataFetcher
 public:
   TestHttpDataFetcher() {}
   bool
-  addFetchRequest(const std::string &url, FetchedDataProcessor *callback_obj = nullptr)
+  addFetchRequest(const std::string &url, FetchedDataProcessor *callback_obj = nullptr) override
   {
     ++_n_pending_requests;
     return true;
   }
 
   DataStatus
-  getRequestStatus(const std::string &url) const
+  getRequestStatus(const std::string &url) const override
   {
     if (_return_data) {
       return STATUS_DATA_AVAILABLE;
@@ -49,13 +49,13 @@ public:
   }
 
   int
-  getNumPendingRequests() const
+  getNumPendingRequests() const override
   {
     return _n_pending_requests;
   };
 
   bool
-  getContent(const std::string &url, const char *&content, int &content_len) const
+  getContent(const std::string &url, const char *&content, int &content_len) const override
   {
     TestHttpDataFetcher &curr_obj = const_cast<TestHttpDataFetcher &>(*this);
     --curr_obj._n_pending_requests;
diff --git a/plugins/experimental/parent_select/strategy.h b/plugins/experimental/parent_select/strategy.h
index 6a8a6b6..844e75a 100644
--- a/plugins/experimental/parent_select/strategy.h
+++ b/plugins/experimental/parent_select/strategy.h
@@ -245,24 +245,24 @@ public:
   virtual ~PLNextHopSelectionStrategy(){};
   bool Init(const YAML::Node &n);
 
-  virtual void next(TSHttpTxn txnp, void *strategyTxn, const char *exclude_hostname, size_t exclude_hostname_len,
-                    in_port_t exclude_port, const char **out_hostname, size_t *out_hostname_len, in_port_t *out_port,
-                    bool *out_retry, bool *out_no_cache, time_t now = 0) = 0;
-  virtual void mark(TSHttpTxn txnp, void *strategyTxn, const char *hostname, const size_t hostname_len, const in_port_t port,
-                    const PLNHCmd status, const time_t now = 0)          = 0;
-  virtual bool nextHopExists(TSHttpTxn txnp);
-  virtual bool codeIsFailure(TSHttpStatus response_code);
-  virtual bool responseIsRetryable(unsigned int current_retry_attempts, TSHttpStatus response_code);
-  virtual bool onFailureMarkParentDown(TSHttpStatus response_code);
-  virtual bool goDirect();
-  virtual bool parentIsProxy();
-  virtual const char *
-  name()
+  void next(TSHttpTxn txnp, void *strategyTxn, const char *exclude_hostname, size_t exclude_hostname_len, in_port_t exclude_port,
+            const char **out_hostname, size_t *out_hostname_len, in_port_t *out_port, bool *out_retry, bool *out_no_cache,
+            time_t now = 0) override                             = 0;
+  void mark(TSHttpTxn txnp, void *strategyTxn, const char *hostname, const size_t hostname_len, const in_port_t port,
+            const PLNHCmd status, const time_t now = 0) override = 0;
+  bool nextHopExists(TSHttpTxn txnp) override;
+  bool codeIsFailure(TSHttpStatus response_code) override;
+  bool responseIsRetryable(unsigned int current_retry_attempts, TSHttpStatus response_code) override;
+  bool onFailureMarkParentDown(TSHttpStatus response_code) override;
+  bool goDirect() override;
+  bool parentIsProxy() override;
+  const char *
+  name() override
   {
     return strategy_name.c_str();
   };
-  virtual void *newTxn()              = 0;
-  virtual void deleteTxn(void *state) = 0;
+  void *newTxn() override              = 0;
+  void deleteTxn(void *state) override = 0;
 
 protected:
   std::string strategy_name;
diff --git a/proxy/http/remap/PluginDso.h b/proxy/http/remap/PluginDso.h
index 9e6df2d..96e9dd8 100644
--- a/proxy/http/remap/PluginDso.h
+++ b/proxy/http/remap/PluginDso.h
@@ -87,8 +87,8 @@ public:
   virtual bool init(std::string &error)                             = 0;
   virtual void done()                                               = 0;
 
-  void acquire();
-  void release();
+  void acquire() override;
+  void release() override;
 
   void incInstanceCount();
   void decInstanceCount();