Skip to content

Commit

Permalink
Add missing virtual dtors #2
Browse files Browse the repository at this point in the history
CMSSW GCC 7.0.1 builds now follows jemalloc (dev branch) and also has a
new TCMalloc. Both of these have C++14 sized deallocation feature
enabled. This means that if possible operator delete will be called with
size argument, which will help allocator to reduce the time to free the
object. E.g. this is not possible for incomplete types which size is
unknown at a time.

GCC 7.0.1 builds contain an additional build of jemalloc
(jemalloc-debug) which contains extra asserts and checks for developers.

This seems to be undefined behavior in C++14. From [expr.delete] (5.3.5
Delete):

    In the first alternative (delete object), if the static type of the
    object to be deleted is different from its dynamic type, the static type
    shall be a base class of the dynamic type of the object to be deleted
    and the static type shall have a virtual destructor or the behavior is
    undefined.

Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
  • Loading branch information
David Abdurachmanov authored and David Abdurachmanov committed Apr 8, 2017
1 parent 3804d4a commit 04a4375
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CalibFormats/CastorObjects/interface/CastorCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CastorCoder {
public:
virtual void adc2fC(const CastorDataFrame& df, CaloSamples& lf) const = 0;
virtual void fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const = 0;
virtual ~CastorCoder() = default;
};

#endif
1 change: 1 addition & 0 deletions CalibFormats/HcalObjects/interface/HcalCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class HcalCoder {
virtual void fC2adc(const CaloSamples& clf, HcalCalibDataFrame& df, int fCapIdOffset) const = 0;
virtual void fC2adc(const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const = 0;
virtual void fC2adc(const CaloSamples& clf, QIE11DataFrame& df, int fCapIdOffset) const = 0;
virtual ~HcalCoder() = default;
};

#endif
1 change: 1 addition & 0 deletions EventFilter/L1TRawToDigi/interface/Packer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace l1t {
class Packer {
public:
virtual Blocks pack(const edm::Event&, const PackerTokens*) = 0;
virtual ~Packer() = default;
};

typedef std::vector<std::shared_ptr<Packer>> Packers;
Expand Down
2 changes: 2 additions & 0 deletions EventFilter/L1TRawToDigi/interface/PackerTokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace edm {

namespace l1t {
class PackerTokens {
public:
virtual ~PackerTokens() = default;
};
}

Expand Down
3 changes: 0 additions & 3 deletions L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ CSCMotherboard::CSCMotherboard() :
}
}

CSCMotherboard::~CSCMotherboard() {
}

void CSCMotherboard::clear() {
if (alct) alct->clear();
if (clct) clct->clear();
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CSCMotherboard
CSCMotherboard();

/** Default destructor. */
~CSCMotherboard();
virtual ~CSCMotherboard() = default;

/** Test version of run function. */
void run(const std::vector<int> w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class EtaPhiRegion{
class EtaPhiRegionDataBase {
public:
EtaPhiRegionDataBase(){}
virtual ~EtaPhiRegionDataBase() = default;
virtual void getEtaPhiRegions(const edm::Event&,std::vector<EtaPhiRegion>&)const=0;
};

Expand Down

0 comments on commit 04a4375

Please sign in to comment.