Add missing virtual destructors:

Some classes had virtual methods, but were missing a virtual
destructor.

Technically, every unit test that inherits from the Beast test suite
would get flagged by `-Wnon-virtual-dtor` but I did not think it would
be a great idea to go sprinkle a virtual destructor for every Ripple
test suite.
This commit is contained in:
Joe Loser
2018-05-05 07:40:08 -04:00
committed by seelabs
parent 681df58b61
commit 717f874767
13 changed files with 48 additions and 11 deletions

View File

@@ -641,7 +641,7 @@ macro(setup_build_boilerplate)
if (NOT WIN32)
add_definitions(-D_FILE_OFFSET_BITS=64)
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof -Wdeprecated
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof -Wdeprecated -Wnon-virtual-dtor
-DBOOST_COROUTINE_NO_DEPRECATION_WARNING -DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
add_compile_options(-Wall -Wno-sign-compare -Wno-char-subscripts -Wno-format
-Wno-unused-local-typedefs -g)

View File

@@ -183,6 +183,10 @@ public:
{
}
virtual ~suite() = default;
suite(suite const&) = delete;
suite& operator=(suite const&) = delete;
/** Invokes the test using the specified runner.
Data members are set up here instead of the constructor as a

View File

@@ -37,6 +37,10 @@ class seconds_clock_worker
{
public:
virtual void sample () = 0;
virtual ~seconds_clock_worker() = default;
seconds_clock_worker() = default;
seconds_clock_worker(seconds_clock_worker const&) = delete;
seconds_clock_worker& operator=(seconds_clock_worker const&) = delete;
};
//------------------------------------------------------------------------------

View File

@@ -35,6 +35,10 @@ private:
{
virtual void operator()(
void* dest, std::size_t bytes) const = 0;
virtual ~base() = default;
base() = default;
base(base const&) = delete;
base& operator=(base const&) = delete;
};
struct impl : base

View File

@@ -53,6 +53,10 @@ class StatsDMetricBase : public List <StatsDMetricBase>::Node
{
public:
virtual void do_process () = 0;
virtual ~StatsDMetricBase() = default;
StatsDMetricBase() = default;
StatsDMetricBase(StatsDMetricBase const&) = delete;
StatsDMetricBase& operator=(StatsDMetricBase const&) = delete;
};
//------------------------------------------------------------------------------

View File

@@ -282,7 +282,7 @@ private:
public:
explicit Source (std::string const& name);
~Source ();
virtual ~Source ();
Source (Source const&) = delete;
Source& operator= (Source const&) = delete;

View File

@@ -44,6 +44,11 @@ public:
/** Called to perform tasks as needed. */
struct Callback
{
virtual ~Callback () = default;
Callback() = default;
Callback(Callback const&) = delete;
Callback& operator=(Callback const&) = delete;
/** Perform a task.
The call is made on a thread owned by Workers. It is important

View File

@@ -31,6 +31,11 @@ namespace NodeStore {
class Manager
{
public:
virtual ~Manager () = default;
Manager() = default;
Manager(Manager const&) = delete;
Manager& operator=(Manager const&) = delete;
/** Returns the instance of the manager singleton. */
static
Manager&

View File

@@ -43,6 +43,11 @@ public:
/** This callback does the actual writing. */
struct Callback
{
virtual ~Callback () = default;
Callback() = default;
Callback(Callback const&) = delete;
Callback& operator=(Callback const&) = delete;
virtual void writeBatch (Batch const& batch) = 0;
};

View File

@@ -32,6 +32,10 @@ private:
void addCommonFields (Item& item);
public:
virtual ~InnerObjectFormats () = default;
InnerObjectFormats(InnerObjectFormats const&) = delete;
InnerObjectFormats& operator=(InnerObjectFormats const&) = delete;
/** Create the object.
This will load the object will all the known inner object formats.
*/

View File

@@ -87,17 +87,15 @@ public:
Derived classes will load the object will all the known formats.
*/
KnownFormats ()
{
}
KnownFormats () = default;
/** Destroy the known formats object.
The defined formats are deleted.
*/
~KnownFormats ()
{
}
virtual ~KnownFormats () = default;
KnownFormats(KnownFormats const&) = delete;
KnownFormats& operator=(KnownFormats const&) = delete;
/** Retrieve the type for a format specified by name.
@@ -180,9 +178,6 @@ protected:
virtual void addCommonFields (Item& item) = 0;
private:
KnownFormats(KnownFormats const&) = delete;
KnownFormats& operator=(KnownFormats const&) = delete;
std::vector <std::unique_ptr <Item>> m_formats;
NameMap m_names;
TypeMap m_types;

View File

@@ -42,6 +42,8 @@ class Session
public:
Session() = default;
Session (Session const&) = delete;
Session& operator=(Session const&) = delete;
virtual ~Session () = default;
/** A user-definable pointer.
The initial value is always zero.

View File

@@ -110,6 +110,11 @@ struct WSSession
{
std::shared_ptr<void> appDefined;
virtual ~WSSession () = default;
WSSession() = default;
WSSession(WSSession const&) = delete;
WSSession& operator=(WSSession const&) = delete;
virtual
void
run() = 0;