build: switch to C++14
Cleanup core/common.hpp
Change-Id: I6566b0224e24716691d5896462aa7613547ed950
Refs: #3076
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index e9fdcc6..e690290 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -39,7 +39,7 @@
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
- # General flags are always applied (e.g., selecting C++11 mode)
+ # General flags are always applied (e.g., selecting C++ language standard)
generalFlags = conf.flags.getGeneralFlags(conf)
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
@@ -128,7 +128,7 @@
"""
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
- flags['CXXFLAGS'] += ['-std=c++11']
+ flags['CXXFLAGS'] += ['-std=c++14']
return flags
def getDebugFlags(self, conf):
diff --git a/core/common.hpp b/core/common.hpp
index f74c272..8e8c1db 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,13 +38,15 @@
#define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
#endif
-#include <cinttypes>
#include <cstddef>
+#include <cstdint>
+#include <functional>
#include <iostream>
-#include <list>
+#include <limits>
#include <map>
-#include <set>
+#include <memory>
#include <stdexcept>
+#include <string>
#include <utility>
#include <vector>
@@ -55,20 +57,26 @@
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
+#include <boost/throw_exception.hpp>
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/name.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
-#include <ndn-cxx/security/signing-info.hpp>
#include <ndn-cxx/util/backports.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/scheduler-scoped-event-id.hpp>
#include <ndn-cxx/util/signal.hpp>
+#include <ndn-cxx/util/time.hpp>
namespace ndn {
+using std::shared_ptr;
+using std::unique_ptr;
+using std::make_shared;
+using std::make_unique;
+
using std::size_t;
using boost::noncopyable;
diff --git a/tests/boost-test.hpp b/tests/boost-test.hpp
index cd4ccfe..017a0be 100644
--- a/tests/boost-test.hpp
+++ b/tests/boost-test.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,7 +30,6 @@
#pragma GCC system_header
#pragma clang system_header
-#include <boost/concept_check.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>
diff --git a/tests/chunks/aimd-rtt-estimator.t.cpp b/tests/chunks/aimd-rtt-estimator.t.cpp
index 9241fee..d254985 100644
--- a/tests/chunks/aimd-rtt-estimator.t.cpp
+++ b/tests/chunks/aimd-rtt-estimator.t.cpp
@@ -28,8 +28,6 @@
#include "tests/test-common.hpp"
-#include <limits>
-
namespace ndn {
namespace chunks {
namespace aimd {
diff --git a/tests/chunks/consumer.t.cpp b/tests/chunks/consumer.t.cpp
index 3662f24..37e9abe 100644
--- a/tests/chunks/consumer.t.cpp
+++ b/tests/chunks/consumer.t.cpp
@@ -29,7 +29,6 @@
#include "tests/test-common.hpp"
-#include <boost/test/output_test_stream.hpp>
#include <ndn-cxx/security/validator-null.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
diff --git a/tests/dump/ndndump.t.cpp b/tests/dump/ndndump.t.cpp
index e371fa5..bad4efa 100644
--- a/tests/dump/ndndump.t.cpp
+++ b/tests/dump/ndndump.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, University of Memphis.
+/*
+ * Copyright (c) 2014-2018, University of Memphis.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -19,13 +19,11 @@
#include "tools/dump/ndndump.hpp"
+#include "tests/identity-management-fixture.hpp"
+#include "tests/test-common.hpp"
+
#include <ndn-cxx/lp/packet.hpp>
#include <ndn-cxx/net/ethernet.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-
-#include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
-#include <boost/test/output_test_stream.hpp>
namespace ndn {
namespace dump {
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index fbe5251..a0fac2e 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -21,8 +21,6 @@
#define NDN_TOOLS_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
#include "tests/test-common.hpp"
-#include <ndn-cxx/security/key-chain.hpp>
-#include <vector>
namespace ndn {
namespace tests {
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index be0b63d..c0052e2 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,14 +27,10 @@
#define NDN_TOOLS_TESTS_TEST_COMMON_HPP
#include "boost-test.hpp"
+#include "core/common.hpp"
-#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/interest.hpp>
-#include <ndn-cxx/lp/nack.hpp>
#include <ndn-cxx/util/time-unit-test-clock.hpp>
-#include <boost/asio/io_service.hpp>
-
namespace ndn {
namespace tests {
diff --git a/tools/chunks/catchunks/aimd-rtt-estimator.cpp b/tools/chunks/catchunks/aimd-rtt-estimator.cpp
index 5e88f7c..2e1852f 100644
--- a/tools/chunks/catchunks/aimd-rtt-estimator.cpp
+++ b/tools/chunks/catchunks/aimd-rtt-estimator.cpp
@@ -26,7 +26,6 @@
#include "aimd-rtt-estimator.hpp"
#include <cmath>
-#include <limits>
namespace ndn {
namespace chunks {
diff --git a/tools/chunks/catchunks/data-fetcher.hpp b/tools/chunks/catchunks/data-fetcher.hpp
index 4335ab2..5b66450 100644
--- a/tools/chunks/catchunks/data-fetcher.hpp
+++ b/tools/chunks/catchunks/data-fetcher.hpp
@@ -1,8 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2016, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
+/*
+ * Copyright (c) 2016-2018, Regents of the University of California,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -60,7 +60,7 @@
*/
static const time::milliseconds MAX_CONGESTION_BACKOFF_TIME;
- typedef function<void(const Interest& interest, const std::string& reason)> FailureCallback;
+ using FailureCallback = std::function<void(const Interest& interest, const std::string& reason)>;
/**
* @brief instantiate a DataFetcher object and start fetching data
diff --git a/tools/chunks/catchunks/pipeline-interests.hpp b/tools/chunks/catchunks/pipeline-interests.hpp
index 90fd76a..30ff2a0 100644
--- a/tools/chunks/catchunks/pipeline-interests.hpp
+++ b/tools/chunks/catchunks/pipeline-interests.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2017, Regents of the University of California,
+ * Copyright (c) 2016-2018, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -49,8 +49,8 @@
class PipelineInterests
{
public:
- using DataCallback = function<void(const Data&)>;
- using FailureCallback = function<void(const std::string& reason)>;
+ using DataCallback = std::function<void(const Data&)>;
+ using FailureCallback = std::function<void(const std::string& reason)>;
/**
* @brief create a PipelineInterests service
diff --git a/tools/dump/ndndump.cpp b/tools/dump/ndndump.cpp
index e6cfc6a..1fec4f1 100644
--- a/tools/dump/ndndump.cpp
+++ b/tools/dump/ndndump.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
+/*
* Copyright (c) 2011-2014, Regents of the University of California,
*
* This file is part of ndndump, the packet capture and analysis tool for Named Data
@@ -52,13 +52,9 @@
#include <pcap/sll.h>
-#include <boost/lexical_cast.hpp>
-
#include <iomanip>
#include <sstream>
-#include <ndn-cxx/interest.hpp>
-#include <ndn-cxx/data.hpp>
#include <ndn-cxx/lp/nack.hpp>
#include <ndn-cxx/lp/packet.hpp>
diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp
index ceb49b3..7a1eb7b 100644
--- a/tools/peek/ndn-poke.cpp
+++ b/tools/peek/ndn-poke.cpp
@@ -27,6 +27,8 @@
#include "core/version.hpp"
+#include <ndn-cxx/security/signing-helpers.hpp>
+
#include <sstream>
namespace ndn {
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index 08d17bf..0a94d0f 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015, Arizona Board of Regents.
+/*
+ * Copyright (c) 2015-2018, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -22,6 +22,8 @@
#include "ping-server.hpp"
+#include <ndn-cxx/security/signing-helpers.hpp>
+
namespace ndn {
namespace ping {
namespace server {