Fix compilation with Boost 1.65.0

Also sync default-compiler-flags.py with NFD

Change-Id: Ib39118567428e8fe2ac73f2b7cbd96fe1a9598b8
Refs: #4259, #4248
diff --git a/tools/chunks/catchunks/pipeline-interests-aimd.hpp b/tools/chunks/catchunks/pipeline-interests-aimd.hpp
index ec5bfce..aa19d3f 100644
--- a/tools/chunks/catchunks/pipeline-interests-aimd.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-aimd.hpp
@@ -32,6 +32,7 @@
 #include "pipeline-interests.hpp"
 
 #include <queue>
+#include <unordered_map>
 
 namespace ndn {
 namespace chunks {
diff --git a/tools/dissect/main.cpp b/tools/dissect/main.cpp
index 7232e32..30bf6db 100644
--- a/tools/dissect/main.cpp
+++ b/tools/dissect/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.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -24,12 +24,14 @@
 #include <boost/program_options/variables_map.hpp>
 #include <boost/program_options/parsers.hpp>
 
+#include <fstream>
+
 namespace po = boost::program_options;
 
 namespace ndn {
 namespace dissect {
 
-void
+static void
 usage(std::ostream& os, const std::string& appName, const po::options_description& options)
 {
   os << "Usage:\n"
@@ -38,7 +40,7 @@
      << options;
 }
 
-int
+static int
 main(int argc, char* argv[])
 {
   po::options_description visibleOptions;
diff --git a/tools/dissect/ndn-dissect.cpp b/tools/dissect/ndn-dissect.cpp
index f37195e..6cd8659 100644
--- a/tools/dissect/ndn-dissect.cpp
+++ b/tools/dissect/ndn-dissect.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.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -41,7 +41,6 @@
 #include "ndn-dissect.hpp"
 
 #include <algorithm>
-#include <map>
 
 #include <ndn-cxx/name-component.hpp>
 #include <ndn-cxx/util/indented-stream.hpp>
@@ -49,7 +48,7 @@
 namespace ndn {
 namespace dissect {
 
-std::map<uint32_t, std::string> TLV_DICT = {
+static const std::map<uint32_t, std::string> TLV_DICT = {
   {tlv::Interest                     , "Interest"},
   {tlv::Data                         , "Data"},
   {tlv::Name                         , "Name"},
@@ -82,8 +81,9 @@
 {
   os << type << " (";
 
-  if (TLV_DICT.count(type) != 0) {
-    os << TLV_DICT[type];
+  auto it = TLV_DICT.find(type);
+  if (it != TLV_DICT.end()) {
+    os << it->second;
   }
   else if (type < tlv::AppPrivateBlock1) {
     os << "RESERVED_1";
@@ -97,6 +97,7 @@
   else {
     os << "APP_TAG_3";
   }
+
   os << ")";
 }
 
@@ -110,7 +111,7 @@
     // if (block.type() != tlv::Content && block.type() != tlv::SignatureValue)
     block.parse();
   }
-  catch (tlv::Error& e) {
+  catch (const tlv::Error&) {
     // pass (e.g., leaf block reached)
 
     // @todo: Figure how to deterministically figure out that value is not recursive TLV block
@@ -138,7 +139,7 @@
       Block block = Block::fromStream(is);
       this->printBlock(os, block);
     }
-    catch (std::exception& e) {
+    catch (const std::exception& e) {
       std::cerr << "ERROR: " << e.what() << std::endl;
     }
   }
diff --git a/tools/dissect/ndn-dissect.hpp b/tools/dissect/ndn-dissect.hpp
index a90b845..062d3f0 100644
--- a/tools/dissect/ndn-dissect.hpp
+++ b/tools/dissect/ndn-dissect.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-2017,  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.
@@ -17,8 +17,12 @@
  * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef NDN_TOOLS_DISSECT_NDN_DISSECT_HPP
+#define NDN_TOOLS_DISSECT_NDN_DISSECT_HPP
+
+#include "core/common.hpp"
+
 #include <ndn-cxx/encoding/block.hpp>
-#include <fstream>
 
 namespace ndn {
 namespace dissect {
@@ -39,3 +43,5 @@
 
 } // namespace dissect
 } // namespace ndn
+
+#endif // NDN_TOOLS_DISSECT_NDN_DISSECT_HPP
diff --git a/tools/dump/main.cpp b/tools/dump/main.cpp
index 2ace7f6..7e23ef9 100644
--- a/tools/dump/main.cpp
+++ b/tools/dump/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.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -41,6 +41,8 @@
 #include <boost/program_options/variables_map.hpp>
 #include <boost/program_options/parsers.hpp>
 
+#include <sstream>
+
 namespace po = boost::program_options;
 
 namespace boost {
diff --git a/tools/dump/ndndump.cpp b/tools/dump/ndndump.cpp
index 91d6827..e6cfc6a 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-2016,  Regents of the University of California.
+ * Copyright (c) 2014-2017,  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.
@@ -55,6 +55,7 @@
 #include <boost/lexical_cast.hpp>
 
 #include <iomanip>
+#include <sstream>
 
 #include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/data.hpp>
@@ -251,7 +252,8 @@
   //   os << (int) header->ts.tv_sec
   //      << "."
   //      << setfill('0') << setw(6) << (int)header->ts.tv_usec;
-  // } else {
+  // }
+  // else {
   //   tm = localtime(&(header->ts.tv_sec));
   //   os << (int)tm->tm_hour << ":"
   //      << setfill('0') << setw(2) << (int)tm->tm_min<< ":"
diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp
index 9ef3c53..adfe93e 100644
--- a/tools/peek/ndn-poke.cpp
+++ b/tools/peek/ndn-poke.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,
@@ -50,6 +50,8 @@
 
 #include "core/version.hpp"
 
+#include <sstream>
+
 namespace ndn {
 namespace peek {
 
@@ -217,7 +219,7 @@
       else
         m_face.processEvents(m_timeout);
     }
-    catch (std::exception& e) {
+    catch (const std::exception& e) {
       std::cerr << "ERROR: " << e.what() << "\n" << std::endl;
       exit(1);
     }
diff --git a/tools/pib/pib-validator.hpp b/tools/pib/pib-validator.hpp
index 8b303f5..0bdf357 100644
--- a/tools/pib/pib-validator.hpp
+++ b/tools/pib/pib-validator.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-2017,  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.
@@ -24,21 +24,21 @@
 
 #include "pib-db.hpp"
 #include "key-cache.hpp"
+
 #include <ndn-cxx/security/validator.hpp>
-#include <unordered_map>
 
 namespace ndn {
 namespace pib {
 
-
 /*
  * @brief The validator to verify the command interests to PIB service
  *
- * @sa http://redmine.named-data.net/projects/ndn-cxx/wiki/PublicKey_Info_Base
+ * @sa https://redmine.named-data.net/projects/ndn-cxx/wiki/PublicKey_Info_Base
  */
 class PibValidator : public Validator
 {
   struct UserKeyCache;
+
 public:
   explicit
   PibValidator(const PibDb& pibDb,
@@ -47,22 +47,21 @@
   ~PibValidator();
 
 protected:
-  virtual void
+  void
   checkPolicy(const Interest& interest,
               int nSteps,
               const OnInterestValidated& onValidated,
               const OnInterestValidationFailed& onValidationFailed,
-              std::vector<shared_ptr<ValidationRequest>>& nextSteps);
+              std::vector<shared_ptr<ValidationRequest>>& nextSteps) override;
 
-  virtual void
+  void
   checkPolicy(const Data& data,
               int nSteps,
               const OnDataValidated& onValidated,
               const OnDataValidationFailed& onValidationFailed,
-              std::vector<shared_ptr<ValidationRequest>>& nextSteps);
+              std::vector<shared_ptr<ValidationRequest>>& nextSteps) override;
 
 private:
-
   const PibDb& m_db;
 
   bool m_isMgmtReady;
diff --git a/tools/ping/client/ndn-ping.cpp b/tools/ping/client/ndn-ping.cpp
index d94cd0c..19f5bb6 100644
--- a/tools/ping/client/ndn-ping.cpp
+++ b/tools/ping/client/ndn-ping.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Arizona Board of Regents.
+ * Copyright (c) 2014-2017,  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.
@@ -57,7 +57,7 @@
       m_ping.start();
       m_face.processEvents();
     }
-    catch (std::exception& e) {
+    catch (const std::exception& e) {
       m_tracer.onError(e.what());
       return 2;
     }
@@ -102,7 +102,7 @@
 
     m_statisticsCollector.computeStatistics().printSummary(std::cout);
     m_signalSetQuit.async_wait(bind(&Runner::afterQuitSignal, this, _1));
-  };
+  }
 
 private:
   Face m_face;