build: disable `-Wnon-virtual-dtor` compiler warning
See also named-data/NFD@0a05f7aea6e56a32139a6271de1f98536153a86a
Change-Id: Id615459e8b9db20ae54851b3b4808b4c5e94d3b0
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 4aa9e9b..7746db9 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -158,7 +158,6 @@
'-Wpedantic',
'-Wenum-conversion',
'-Wextra-semi',
- '-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
__linkFlags = ['-Wl,-O1']
diff --git a/src/handles/command-base-handle.hpp b/src/handles/command-base-handle.hpp
index 520b7d0..584c6b6 100644
--- a/src/handles/command-base-handle.hpp
+++ b/src/handles/command-base-handle.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2023, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -41,13 +41,6 @@
using std::runtime_error::runtime_error;
};
-public:
- CommandBaseHandle(Face& face, RepoStorage& storageHandle,
- Scheduler& scheduler, ndn::security::Validator& validator);
-
- virtual
- ~CommandBaseHandle() = default;
-
ndn::mgmt::Authorization
makeAuthorization();
@@ -69,6 +62,12 @@
}
protected:
+ CommandBaseHandle(Face& face, RepoStorage& storageHandle,
+ Scheduler& scheduler, ndn::security::Validator& validator);
+
+ ~CommandBaseHandle() = default;
+
+protected:
Face& face;
RepoStorage& storageHandle;
Scheduler& scheduler;
diff --git a/src/handles/read-handle.hpp b/src/handles/read-handle.hpp
index 780a9c6..4e53f97 100644
--- a/src/handles/read-handle.hpp
+++ b/src/handles/read-handle.hpp
@@ -31,10 +31,10 @@
class ReadHandle : public noncopyable
{
-
public:
using DataPrefixRegistrationCallback = std::function<void(const ndn::Name&)>;
using DataPrefixUnregistrationCallback = std::function<void(const ndn::Name&)>;
+
struct RegisteredDataPrefix
{
ndn::RegisteredPrefixHandle hdl;
diff --git a/src/repo-command.hpp b/src/repo-command.hpp
index b985cbf..bcda13e 100644
--- a/src/repo-command.hpp
+++ b/src/repo-command.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2023, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -29,7 +29,7 @@
{
public:
/**
- * \brief Represents an error in RepoCommandParameters
+ * \brief Represents an error in RepoCommandParameter.
*/
class ArgumentError : public std::invalid_argument
{
@@ -37,15 +37,13 @@
using std::invalid_argument::invalid_argument;
};
- virtual
- ~RepoCommand() = default;
-
class FieldValidator
{
public:
FieldValidator();
- /** \brief declare a required field
+ /**
+ * \brief Declare a required field.
*/
FieldValidator&
required(RepoParameterField field)
@@ -54,7 +52,8 @@
return *this;
}
- /** \brief declare an optional field
+ /**
+ * \brief Declare an optional field.
*/
FieldValidator&
optional(RepoParameterField field)
@@ -78,36 +77,39 @@
void
validateRequest(const RepoCommandParameter& parameters);
+protected:
+ ~RepoCommand() = default;
+
private:
virtual void
check(const RepoCommandParameter& parameters) const
{
}
-public:
+protected:
FieldValidator m_requestValidator;
};
-class InsertCommand : public RepoCommand
+class InsertCommand final : public RepoCommand
{
public:
InsertCommand();
};
-class InsertCheckCommand : public RepoCommand
+class InsertCheckCommand final : public RepoCommand
{
public:
InsertCheckCommand();
};
-class DeleteCommand : public RepoCommand
+class DeleteCommand final : public RepoCommand
{
public:
DeleteCommand();
private:
void
- check(const RepoCommandParameter& parameters) const override;
+ check(const RepoCommandParameter& parameters) const final;
};
} // namespace repo
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index 2c6a32e..9c0398b 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -31,9 +31,6 @@
class TcpClient
{
public:
- virtual
- ~TcpClient() = default;
-
void
start(const std::string& host, const std::string& port)
{
@@ -59,7 +56,6 @@
{
if (error) {
BOOST_FAIL("TCP connection aborted");
- return;
}
}
@@ -81,8 +77,8 @@
guardEvent = scheduler.schedule(2_s, std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
}
- virtual void
- onSuccessfullConnect(const boost::system::error_code& error)
+ void
+ onSuccessfullConnect(const boost::system::error_code& error) override
{
TcpClient::onSuccessfullConnect(error);