diff --git a/src/Notifier.h b/src/Notifier.h index 592c491219..6da7d7c59f 100644 --- a/src/Notifier.h +++ b/src/Notifier.h @@ -99,6 +99,8 @@ extern Registry registry; */ class Modifiable { public: + virtual ~Modifiable(); + /** * Calling this method signals to all registered receivers that the * object has been modified. @@ -111,8 +113,6 @@ public: protected: friend class Registry; - virtual ~Modifiable(); - // Number of currently registered receivers. uint64_t num_receivers = 0; }; diff --git a/src/Stmt.h b/src/Stmt.h index cc242170d7..a0870c2896 100644 --- a/src/Stmt.h +++ b/src/Stmt.h @@ -21,6 +21,8 @@ class ZAMCompiler; // for "friend" declarations class ExprListStmt : public Stmt { public: + ~ExprListStmt() override; + const ListExpr* ExprList() const { return l.get(); } const ListExprPtr& ExprListPtr() const { return l; } @@ -35,8 +37,6 @@ public: protected: ExprListStmt(StmtTag t, ListExprPtr arg_l); - ~ExprListStmt() override; - ValPtr Exec(Frame* f, StmtFlowType& flow) override; virtual ValPtr DoExec(std::vector vals, StmtFlowType& flow) = 0; diff --git a/src/Type.h b/src/Type.h index d1d01b55c7..e17de61cc2 100644 --- a/src/Type.h +++ b/src/Type.h @@ -356,6 +356,8 @@ protected: class IndexType : public Type { public: + ~IndexType() override = default; + int MatchesIndex(detail::ListExpr* index) const override; const TypeListPtr& GetIndices() const { return indices; } @@ -391,8 +393,6 @@ protected: is_pattern_index = types.size() == 1 && types[0]->Tag() == TYPE_PATTERN; } - ~IndexType() override = default; - void DoDescribe(ODesc* d) const override; TypeListPtr indices; diff --git a/src/script_opt/CPP/RuntimeInits.h b/src/script_opt/CPP/RuntimeInits.h index e582f0f492..c1fa9f87da 100644 --- a/src/script_opt/CPP/RuntimeInits.h +++ b/src/script_opt/CPP/RuntimeInits.h @@ -327,6 +327,8 @@ public: inits_vec.resize(inits.size()); } + virtual ~CPP_AbstractBasicConsts() = default; + void InitializeCohort(InitsManager* im, int cohort) { ASSERT(cohort == 0); auto& offsets_vec = im->Indices(offsets_set); diff --git a/src/spicy/file-analyzer.h b/src/spicy/file-analyzer.h index 0395c4b9f4..ad4bba6d86 100644 --- a/src/spicy/file-analyzer.h +++ b/src/spicy/file-analyzer.h @@ -25,6 +25,8 @@ public: */ FileState(Cookie cookie) : ParsingState(::spicy::rt::driver::ParsingType::Stream), _cookie(std::move(cookie)) {} + virtual ~FileState() = default; + /** Returns the cookie pointer to use with the runtime library during analysis. */ auto* cookie() { return &_cookie; } diff --git a/src/spicy/packet-analyzer.h b/src/spicy/packet-analyzer.h index 8da37afbba..351daa4711 100644 --- a/src/spicy/packet-analyzer.h +++ b/src/spicy/packet-analyzer.h @@ -26,6 +26,8 @@ public: */ PacketState(Cookie cookie) : ParsingState(::spicy::rt::driver::ParsingType::Block), _cookie(std::move(cookie)) {} + virtual ~PacketState() = default; + /** Returns the cookie pointer to use with the runtime library during analysis. */ auto* cookie() { return &_cookie; } diff --git a/src/spicy/protocol-analyzer.h b/src/spicy/protocol-analyzer.h index 8ea8bbbe82..affb091235 100644 --- a/src/spicy/protocol-analyzer.h +++ b/src/spicy/protocol-analyzer.h @@ -17,6 +17,11 @@ namespace zeek::spicy::rt { /** Parsing state for one endpoint of the connection. */ +// FIXME: It's strange that the parent class of this does not have a virtual destructor, +// but fixing it requires also implementing copy constructor/operators, and it turns into +// a rabbit hole. +// +// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor) class EndpointState : public ::spicy::rt::driver::ParsingState { public: /** diff --git a/src/threading/BasicThread.h b/src/threading/BasicThread.h index 8b11e1c2c0..a3e6363c0c 100644 --- a/src/threading/BasicThread.h +++ b/src/threading/BasicThread.h @@ -37,6 +37,13 @@ public: BasicThread(BasicThread const&) = delete; BasicThread& operator=(BasicThread const&) = delete; + /** + * Destructor. This will be called by the manager. + * + * Only Zeek's main thread may delete thread instances. + */ + virtual ~BasicThread(); + /** * Returns a descriptive name for the thread. If not set via * SetName(), a default name is chosen automatically. @@ -168,14 +175,6 @@ protected: */ virtual void OnKill() {} - /** - * Destructor. This will be called by the manager. - * - * Only Zeek's main thread may delete thread instances. - * - */ - virtual ~BasicThread(); - /** * Waits until the thread's Run() method has finished and then joins * it. This is called from the threading::Manager.