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