build+src: mark destructor virtual in classes with virtual functions
And to prevent similar mistakes in the future, add -Wnon-virtual-dtor
to the default build flags.
Change-Id: I28e2361341abab29fca134309288cd259736d67a
diff --git a/src/face.hpp b/src/face.hpp
index 1940928..a6cd4da 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -231,6 +231,7 @@
*/
Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService, KeyChain& keyChain);
+ virtual
~Face();
public: // consumer
diff --git a/src/mgmt/control-parameters.hpp b/src/mgmt/control-parameters.hpp
index f436056..50646a7 100644
--- a/src/mgmt/control-parameters.hpp
+++ b/src/mgmt/control-parameters.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -32,6 +32,9 @@
class ControlParameters
{
public:
+ virtual
+ ~ControlParameters() = default;
+
virtual void
wireDecode(const Block& wire) = 0;
diff --git a/src/mgmt/nfd/control-parameters.hpp b/src/mgmt/nfd/control-parameters.hpp
index a798459..6c0c599 100644
--- a/src/mgmt/nfd/control-parameters.hpp
+++ b/src/mgmt/nfd/control-parameters.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -77,7 +77,7 @@
* \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand#ControlParameters
* \details This type is copyable because it's an abstraction of a TLV type.
*/
-class ControlParameters : public ndn::mgmt::ControlParameters
+class ControlParameters : public mgmt::ControlParameters
{
public:
class Error : public tlv::Error
diff --git a/src/mgmt/nfd/face-event-notification.hpp b/src/mgmt/nfd/face-event-notification.hpp
index 7d3121e..0126b64 100644
--- a/src/mgmt/nfd/face-event-notification.hpp
+++ b/src/mgmt/nfd/face-event-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -79,7 +79,7 @@
protected:
void
- wireReset() const;
+ wireReset() const override;
private:
FaceEventKind m_kind;
diff --git a/src/mgmt/nfd/face-status.hpp b/src/mgmt/nfd/face-status.hpp
index 4f20e53..cbd2e60 100644
--- a/src/mgmt/nfd/face-status.hpp
+++ b/src/mgmt/nfd/face-status.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -22,7 +22,7 @@
#ifndef NDN_MGMT_NFD_FACE_STATUS_HPP
#define NDN_MGMT_NFD_FACE_STATUS_HPP
-#include "face-traits.hpp" // include this first, to ensure it compiles on its own.
+#include "face-traits.hpp"
#include "../../encoding/block.hpp"
#include "../../util/time.hpp"
@@ -149,7 +149,7 @@
protected:
void
- wireReset() const;
+ wireReset() const override;
private:
time::milliseconds m_expirationPeriod;
diff --git a/src/mgmt/nfd/face-traits.hpp b/src/mgmt/nfd/face-traits.hpp
index 48c2624..e88e1bc 100644
--- a/src/mgmt/nfd/face-traits.hpp
+++ b/src/mgmt/nfd/face-traits.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,8 +29,8 @@
/** \ingroup management
* \brief providers getters and setters of face information fields
- * \tparam C the concrete class; it must provide .wireReset() method
- to clear wire encoding when a field changes
+ * \tparam C the concrete class; it must provide a wireReset() member
+ * function to clear the wire encoding when a field changes
*/
template<class C>
class FaceTraits
@@ -55,6 +55,9 @@
{
}
+ virtual
+ ~FaceTraits() = default;
+
uint64_t
getFaceId() const
{
diff --git a/src/mgmt/nfd/status-dataset.cpp b/src/mgmt/nfd/status-dataset.cpp
index ca5f5df..cc0d6ea 100644
--- a/src/mgmt/nfd/status-dataset.cpp
+++ b/src/mgmt/nfd/status-dataset.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,6 +30,8 @@
{
}
+StatusDataset::~StatusDataset() = default;
+
Name
StatusDataset::getDatasetPrefix(const Name& prefix) const
{
diff --git a/src/mgmt/nfd/status-dataset.hpp b/src/mgmt/nfd/status-dataset.hpp
index 09c1e14..e3cc264 100644
--- a/src/mgmt/nfd/status-dataset.hpp
+++ b/src/mgmt/nfd/status-dataset.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -42,6 +42,9 @@
class StatusDataset : noncopyable
{
public:
+ virtual
+ ~StatusDataset();
+
#ifdef DOXYGEN
/**
* \brief if defined, specifies constructor argument type;
diff --git a/src/security/v2/trust-anchor-group.cpp b/src/security/v2/trust-anchor-group.cpp
index 6b94951..24f5b9e 100644
--- a/src/security/v2/trust-anchor-group.cpp
+++ b/src/security/v2/trust-anchor-group.cpp
@@ -24,7 +24,6 @@
#include "util/io.hpp"
#include "util/logger.hpp"
-#include <set>
#include <boost/filesystem.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
@@ -44,6 +43,8 @@
{
}
+TrustAnchorGroup::~TrustAnchorGroup() = default;
+
size_t
TrustAnchorGroup::size() const
{
diff --git a/src/security/v2/trust-anchor-group.hpp b/src/security/v2/trust-anchor-group.hpp
index 356a2a3..8e41ebb 100644
--- a/src/security/v2/trust-anchor-group.hpp
+++ b/src/security/v2/trust-anchor-group.hpp
@@ -25,8 +25,8 @@
#include "../../data.hpp"
#include "certificate.hpp"
-#include <set>
#include <boost/filesystem/path.hpp>
+#include <set>
namespace ndn {
namespace security {
@@ -35,6 +35,9 @@
class CertContainerInterface
{
public:
+ virtual
+ ~CertContainerInterface() = default;
+
virtual void
add(Certificate&& cert) = 0;
@@ -51,9 +54,11 @@
/**
* @brief Create an anchor group
*/
- explicit
TrustAnchorGroup(CertContainerInterface& certContainer, const std::string& id);
+ virtual
+ ~TrustAnchorGroup();
+
/**
* @return group id
*/
@@ -145,7 +150,8 @@
* @throw std::invalid_argument @p refreshPeriod is negative
*/
DynamicTrustAnchorGroup(CertContainerInterface& certContainer, const std::string& id,
- const boost::filesystem::path& path, time::nanoseconds refreshPeriod, bool isDir = false);
+ const boost::filesystem::path& path, time::nanoseconds refreshPeriod,
+ bool isDir = false);
void
refresh() override;