From: Nikos Nikoleris Date: Wed, 28 Nov 2018 08:16:33 +0000 (+0000) Subject: base, sim: Add missing destructors X-Git-Tag: v19.0.0.0~1344 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f2d7fe4ef622d861e55517279f193cdf8acfc99;p=gem5.git base, sim: Add missing destructors Derived classes with virtual functions need to define a virtual destructor or a protected destructor otherwise calling the base class destructor has undefined behavior. This change adds a virtual distructor in the base class. Change-Id: I1c855aa56dff6585ff99b9147bdb4eb9729a0a53 Signed-off-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/14815 Reviewed-by: Giacomo Travaglini Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 404bdf15a..8a5420f05 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -2090,6 +2090,8 @@ class Node * */ virtual std::string str() const = 0; + + virtual ~Node() {}; }; /** Shared pointer to a function Node. */ diff --git a/src/cpu/minor/buffers.hh b/src/cpu/minor/buffers.hh index edf87dec5..a32e37493 100644 --- a/src/cpu/minor/buffers.hh +++ b/src/cpu/minor/buffers.hh @@ -381,6 +381,8 @@ class Reservable /** Free a reserved slot */ virtual void freeReservation() = 0; + + virtual ~Reservable() {}; }; /** Wrapper for a queue type to act as a pipeline stage input queue. @@ -418,8 +420,6 @@ class Queue : public Named, public Reservable dataName(data_name) { } - virtual ~Queue() { } - public: /** Push an element into the buffer if it isn't a bubble. Bubbles are * just discarded. It is assummed that any push into a queue with diff --git a/src/cpu/testers/traffic_gen/stream_gen.hh b/src/cpu/testers/traffic_gen/stream_gen.hh index df9d7b75e..b579f1b1d 100644 --- a/src/cpu/testers/traffic_gen/stream_gen.hh +++ b/src/cpu/testers/traffic_gen/stream_gen.hh @@ -63,6 +63,8 @@ class StreamGen } public: + virtual ~StreamGen() {}; + virtual uint32_t pickStreamID() = 0; virtual uint32_t pickSubStreamID() = 0; diff --git a/src/mem/qos/q_policy.hh b/src/mem/qos/q_policy.hh index 3e455e89c..ba36b43b7 100644 --- a/src/mem/qos/q_policy.hh +++ b/src/mem/qos/q_policy.hh @@ -99,6 +99,8 @@ class QueuePolicy */ void setMemCtrl(MemCtrl* mem) { memCtrl = mem; }; + virtual ~QueuePolicy() {}; + protected: QueuePolicy(const QoSMemCtrlParams* p) : memCtrl(nullptr) diff --git a/src/sim/faults.hh b/src/sim/faults.hh index be7aab582..747597152 100644 --- a/src/sim/faults.hh +++ b/src/sim/faults.hh @@ -47,6 +47,8 @@ class FaultBase virtual FaultName name() const = 0; virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst = StaticInst::nullStaticInstPtr); + + virtual ~FaultBase() {}; }; class UnimpFault : public FaultBase