Fix compilation with Boost 1.65.0

Change-Id: Ib88b7e13bddb1728dd882c086e97edffdd696f0d
Refs: #4258
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 3899b06..c946d1f 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -188,7 +188,7 @@
                               '-Wno-unused-local-typedef', # Bugs #2657 and #3209
                               ]
         version = tuple(int(i) for i in conf.env['CC_VERSION'])
-        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (9, 0, 0)):
+        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
             flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
         return flags
 
@@ -200,6 +200,6 @@
                               '-Wno-unused-local-typedef', # Bugs #2657 and #3209
                               ]
         version = tuple(int(i) for i in conf.env['CC_VERSION'])
-        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (9, 0, 0)):
+        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
             flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
         return flags
diff --git a/core/config-file.cpp b/core/config-file.cpp
index b9f40b1..c2638cc 100644
--- a/core/config-file.cpp
+++ b/core/config-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,10 +24,10 @@
  */
 
 #include "config-file.hpp"
-#include "logger.hpp"
 
 #include <boost/property_tree/info_parser.hpp>
 #include <fstream>
+#include <sstream>
 
 namespace nfd {
 
@@ -42,11 +42,8 @@
                                        const ConfigSection& section,
                                        bool isDryRun)
 {
-  std::string msg = "Error processing configuration file ";
-  msg += filename;
-  msg += ": no module subscribed for section \"" + sectionName + "\"";
-
-  BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
+  BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename +
+                              ": no module subscribed for section \"" + sectionName + "\""));
 }
 
 void
@@ -87,7 +84,7 @@
 {
   std::ifstream inputFile(filename);
   if (!inputFile.good() || !inputFile.is_open()) {
-    BOOST_THROW_EXCEPTION(Error("Failed to read configuration file: " + filename));
+    BOOST_THROW_EXCEPTION(Error("Failed to read configuration file " + filename));
   }
   parse(inputFile, isDryRun, filename);
   inputFile.close();
@@ -107,11 +104,8 @@
     boost::property_tree::read_info(input, m_global);
   }
   catch (const boost::property_tree::info_parser_error& error) {
-    std::stringstream msg;
-    msg << "Failed to parse configuration file";
-    msg << " " << filename;
-    msg << " " << error.message() << " line " << error.line();
-    BOOST_THROW_EXCEPTION(Error(msg.str()));
+    BOOST_THROW_EXCEPTION(Error("Failed to parse configuration file " + filename +
+                                ": " + error.message() + " on line " + to_string(error.line())));
   }
 
   process(isDryRun, filename);
@@ -130,10 +124,7 @@
   BOOST_ASSERT(!filename.empty());
 
   if (m_global.begin() == m_global.end()) {
-    std::string msg = "Error processing configuration file: ";
-    msg += filename;
-    msg += " no data";
-    BOOST_THROW_EXCEPTION(Error(msg));
+    BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename + ": no data"));
   }
 
   for (const auto& i : m_global) {
diff --git a/core/logger-factory.cpp b/core/logger-factory.cpp
index 3c419f1..215b087 100644
--- a/core/logger-factory.cpp
+++ b/core/logger-factory.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,8 @@
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/range/adaptor/map.hpp>
 
+#include <iostream>
+
 #ifdef HAVE_CUSTOM_LOGGER
 #error "This file should not be compiled when custom logger is used"
 #endif
diff --git a/core/privilege-helper.cpp b/core/privilege-helper.cpp
index ba3da78..b0ca116 100644
--- a/core/privilege-helper.cpp
+++ b/core/privilege-helper.cpp
@@ -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-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,8 @@
 #include <pwd.h>
 #include <grp.h>
 
+#include <sstream>
+
 namespace nfd {
 
 NFD_LOG_INIT("PrivilegeHelper");
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 6be7551..2ad3d45 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -45,6 +45,7 @@
 
 #include <atomic>
 #include <condition_variable>
+#include <iostream>
 
 namespace nfd {
 
diff --git a/tests/core/config-file.t.cpp b/tests/core/config-file.t.cpp
index 8a41ac2..0a57021 100644
--- a/tests/core/config-file.t.cpp
+++ b/tests/core/config-file.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,9 @@
 
 #include "tests/test-common.hpp"
 
-#include <fstream>
 #include <boost/property_tree/info_parser.hpp>
+#include <fstream>
+#include <sstream>
 
 namespace nfd {
 namespace tests {
diff --git a/tests/core/logger.t.cpp b/tests/core/logger.t.cpp
index 11dcfa4..b2fb4c7 100644
--- a/tests/core/logger.t.cpp
+++ b/tests/core/logger.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,8 @@
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 
+#include <iostream>
+
 namespace nfd {
 namespace tests {
 
diff --git a/tests/other/cs-benchmark.cpp b/tests/other/cs-benchmark.cpp
index 3e7a5a2..c28921b 100644
--- a/tests/other/cs-benchmark.cpp
+++ b/tests/other/cs-benchmark.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,9 +24,10 @@
  */
 
 #include "table/cs.hpp"
-
 #include "tests/test-common.hpp"
 
+#include <iostream>
+
 #ifdef HAVE_VALGRIND
 #include <valgrind/callgrind.h>
 #endif
@@ -40,8 +41,7 @@
   CsBenchmarkFixture()
   {
 #ifdef _DEBUG
-    BOOST_TEST_MESSAGE("Benchmark compiled in debug mode is unreliable, "
-                       "please compile in release mode.");
+    std::cerr << "Benchmark compiled in debug mode is unreliable, please compile in release mode.\n";
 #endif
 
     cs.setLimit(CS_CAPACITY);
@@ -123,10 +123,8 @@
   static constexpr size_t CS_CAPACITY = 50000;
 };
 
-BOOST_FIXTURE_TEST_SUITE(TableCsBenchmark, CsBenchmarkFixture)
-
 // find miss, then insert
-BOOST_AUTO_TEST_CASE(FindMissInsert)
+BOOST_FIXTURE_TEST_CASE(FindMissInsert, CsBenchmarkFixture)
 {
   constexpr size_t N_WORKLOAD = CS_CAPACITY * 2;
   constexpr size_t REPEAT = 4;
@@ -145,11 +143,12 @@
       }
     }
   });
-  BOOST_TEST_MESSAGE("find(miss)-insert " << (N_WORKLOAD * REPEAT) << ": " << d);
+
+  std::cout << "find(miss)-insert " << (N_WORKLOAD * REPEAT) << ": " << d << std::endl;
 }
 
 // insert, then find hit
-BOOST_AUTO_TEST_CASE(InsertFindHit)
+BOOST_FIXTURE_TEST_CASE(InsertFindHit, CsBenchmarkFixture)
 {
   constexpr size_t N_WORKLOAD = CS_CAPACITY * 2;
   constexpr size_t REPEAT = 4;
@@ -168,11 +167,12 @@
       }
     }
   });
-  BOOST_TEST_MESSAGE("insert-find(hit) " << (N_WORKLOAD * REPEAT) << ": " << d);
+
+  std::cout << "insert-find(hit) " << (N_WORKLOAD * REPEAT) << ": " << d << std::endl;
 }
 
 // find(leftmost) hit
-BOOST_AUTO_TEST_CASE(Leftmost)
+BOOST_FIXTURE_TEST_CASE(Leftmost, CsBenchmarkFixture)
 {
   constexpr size_t N_CHILDREN = 10;
   constexpr size_t N_INTERESTS = CS_CAPACITY / N_CHILDREN;
@@ -197,11 +197,12 @@
       }
     }
   });
-  BOOST_TEST_MESSAGE("find(leftmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d);
+
+  std::cout << "find(leftmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d << std::endl;
 }
 
 // find(rightmost) hit
-BOOST_AUTO_TEST_CASE(Rightmost)
+BOOST_FIXTURE_TEST_CASE(Rightmost, CsBenchmarkFixture)
 {
   constexpr size_t N_CHILDREN = 10;
   constexpr size_t N_INTERESTS = CS_CAPACITY / N_CHILDREN;
@@ -226,10 +227,9 @@
       }
     }
   });
-  BOOST_TEST_MESSAGE("find(rightmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d);
-}
 
-BOOST_AUTO_TEST_SUITE_END()
+  std::cout << "find(rightmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d << std::endl;
+}
 
 } // namespace tests
 } // namespace nfd
diff --git a/tests/other/pit-fib-benchmark.cpp b/tests/other/pit-fib-benchmark.cpp
index 85ffe5e..d027c92 100644
--- a/tests/other/pit-fib-benchmark.cpp
+++ b/tests/other/pit-fib-benchmark.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -23,11 +23,12 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "table/pit.hpp"
 #include "table/fib.hpp"
-
+#include "table/pit.hpp"
 #include "tests/test-common.hpp"
 
+#include <iostream>
+
 #ifdef HAVE_VALGRIND
 #include <valgrind/callgrind.h>
 #endif
@@ -43,8 +44,7 @@
     , m_pit(m_nameTree)
   {
 #ifdef _DEBUG
-    BOOST_TEST_MESSAGE("Benchmark compiled in debug mode is unreliable, "
-                       "please compile in release mode.");
+    std::cerr << "Benchmark compiled in debug mode is unreliable, please compile in release mode.\n";
 #endif
   }
 
@@ -150,7 +150,7 @@
   CALLGRIND_STOP_INSTRUMENTATION;
 #endif
 
-  BOOST_TEST_MESSAGE(time::duration_cast<time::microseconds>(t2 - t1));
+  std::cout << time::duration_cast<time::microseconds>(t2 - t1) << std::endl;
 }
 
 } // namespace tests
diff --git a/tools/ndn-autoconfig-server/main.cpp b/tools/ndn-autoconfig-server/main.cpp
index 3806d9a..ba836db 100644
--- a/tools/ndn-autoconfig-server/main.cpp
+++ b/tools/ndn-autoconfig-server/main.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -26,6 +26,8 @@
 #include "program.hpp"
 #include "core/extended-error-message.hpp"
 #include "core/version.hpp"
+
+#include <iostream>
 #include <unistd.h>
 
 namespace ndn {
diff --git a/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp
index c6c3b1a..8f624b8 100644
--- a/tools/ndn-autoconfig-server/program.cpp
+++ b/tools/ndn-autoconfig-server/program.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -24,10 +24,13 @@
  */
 
 #include "program.hpp"
+
 #include <ndn-cxx/encoding/block-helpers.hpp>
 #include <ndn-cxx/encoding/tlv.hpp>
 #include <ndn-cxx/encoding/tlv-nfd.hpp>
 
+#include <iostream>
+
 namespace ndn {
 namespace tools {
 namespace autoconfig_server {
diff --git a/tools/ndn-autoconfig/dns-srv.cpp b/tools/ndn-autoconfig/dns-srv.cpp
index 5bfa3d5..f432e2c 100644
--- a/tools/ndn-autoconfig/dns-srv.cpp
+++ b/tools/ndn-autoconfig/dns-srv.cpp
@@ -34,6 +34,8 @@
 #include <arpa/nameser_compat.h>
 #endif
 
+#include <iostream>
+
 namespace ndn {
 namespace tools {
 namespace autoconfig {
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp
index 8ef112d..9c50c20 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.cpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.cpp
@@ -25,9 +25,12 @@
 
 #include "guess-from-identity-name.hpp"
 #include "dns-srv.hpp"
+
 #include <ndn-cxx/security/pib/identity.hpp>
 #include <ndn-cxx/security/pib/pib.hpp>
 
+#include <sstream>
+
 namespace ndn {
 namespace tools {
 namespace autoconfig {
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 01c169e..395d9f9 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
@@ -24,8 +24,11 @@
  */
 
 #include "ndn-fch-discovery.hpp"
-#include <boost/regex.hpp>
+
 #include <boost/algorithm/string.hpp>
+#include <boost/regex.hpp>
+
+#include <sstream>
 
 namespace ndn {
 namespace tools {
diff --git a/tools/ndn-autoconfig/stage.hpp b/tools/ndn-autoconfig/stage.hpp
index 015153d..f7f358e 100644
--- a/tools/ndn-autoconfig/stage.hpp
+++ b/tools/ndn-autoconfig/stage.hpp
@@ -27,9 +27,12 @@
 #define NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
 
 #include "core/common.hpp"
+
 #include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/util/signal.hpp>
 
+#include <iostream>
+
 namespace ndn {
 namespace tools {
 namespace autoconfig {
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 042248a..39b7f6b 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -23,9 +23,11 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "core/network.hpp"
+#include "core/version.hpp"
+
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/name.hpp>
-
 #include <ndn-cxx/encoding/buffer-stream.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-monitor.hpp>
@@ -37,8 +39,7 @@
 #include <boost/program_options/variables_map.hpp>
 #include <boost/program_options/parsers.hpp>
 
-#include "core/version.hpp"
-#include "core/network.hpp"
+#include <iostream>
 
 namespace ndn {
 namespace nfd_autoreg {
diff --git a/tools/nfdc/main.cpp b/tools/nfdc/main.cpp
index a7469a9..dfbc05c 100644
--- a/tools/nfdc/main.cpp
+++ b/tools/nfdc/main.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -27,6 +27,8 @@
 #include "help.hpp"
 #include "core/version.hpp"
 
+#include <iostream>
+
 namespace nfd {
 namespace tools {
 namespace nfdc {