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/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;