Add -Wextra-semi -Wundefined-func-template to the default CXXFLAGS

And fix the resulting compilation errors.

Change-Id: I16f679836a0cf2a3ff5dfcf6f6b67bfbfe4cdbd7
Refs: #4248
diff --git a/src/security/detail/openssl.hpp b/src/security/detail/openssl.hpp
index cde9efc..99d20cb 100644
--- a/src/security/detail/openssl.hpp
+++ b/src/security/detail/openssl.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * 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,15 +22,11 @@
 #ifndef NDN_SECURITY_DETAIL_OPENSSL_HPP
 #define NDN_SECURITY_DETAIL_OPENSSL_HPP
 
-// suppress deprecation warnings in OSX >= 10.7
-
-#if defined(__APPLE__)
-
-#ifdef __clang__
+// suppress deprecation warnings on macOS >= 10.7
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#endif // __clang__
-
-#endif // __APPLE__
+#endif
 
 #include <openssl/bio.h>
 #include <openssl/crypto.h>
@@ -43,4 +39,8 @@
 #include <openssl/rsa.h>
 #include <openssl/x509.h>
 
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
 #endif // NDN_SECURITY_DETAIL_OPENSSL_HPP
diff --git a/src/security/safe-bag.cpp b/src/security/safe-bag.cpp
index 448847a..8315acf 100644
--- a/src/security/safe-bag.cpp
+++ b/src/security/safe-bag.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).
  *
@@ -20,7 +20,9 @@
  *
  * @author Zhiyi Zhang <dreamerbarrychang@gmail.com>
  */
+
 #include "safe-bag.hpp"
+#include "encoding/encoding-buffer.hpp"
 #include "encoding/tlv-security.hpp"
 #include "util/concepts.hpp"
 
@@ -74,11 +76,7 @@
   return totalLength;
 }
 
-template size_t
-SafeBag::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
-
-template size_t
-SafeBag::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(SafeBag);
 
 const Block&
 SafeBag::wireEncode() const
diff --git a/src/security/safe-bag.hpp b/src/security/safe-bag.hpp
index 12555c9..13a2410 100644
--- a/src/security/safe-bag.hpp
+++ b/src/security/safe-bag.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).
  *
@@ -25,9 +25,8 @@
 
 #include "../common.hpp"
 #include "../data.hpp"
+#include "../encoding/block.hpp"
 #include "../encoding/buffer.hpp"
-#include "../encoding/encoder.hpp"
-#include "../encoding/encoding-buffer.hpp"
 #include "security-common.hpp"
 
 namespace ndn {
@@ -115,6 +114,8 @@
   mutable Block m_wire;
 };
 
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(SafeBag);
+
 } // namespace security
 } // namespace ndn
 
diff --git a/src/security/v1/sec-tpm-osx.cpp b/src/security/v1/sec-tpm-osx.cpp
index f43faa9..a54bf6e 100644
--- a/src/security/v1/sec-tpm-osx.cpp
+++ b/src/security/v1/sec-tpm-osx.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -149,7 +149,7 @@
       CFRelease(m_typeRef);
       m_typeRef = nullptr;
     }
-  };
+  }
 
   bool
   operator==(std::nullptr_t)
diff --git a/src/security/v2/additional-description.cpp b/src/security/v2/additional-description.cpp
index 6fdfd53..63b5ee6 100644
--- a/src/security/v2/additional-description.cpp
+++ b/src/security/v2/additional-description.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).
  *
@@ -109,11 +109,7 @@
   return totalLength;
 }
 
-template size_t
-AdditionalDescription::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
-
-template size_t
-AdditionalDescription::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(AdditionalDescription);
 
 const Block&
 AdditionalDescription::wireEncode() const
diff --git a/src/security/v2/additional-description.hpp b/src/security/v2/additional-description.hpp
index d5142ae..ad9df37 100644
--- a/src/security/v2/additional-description.hpp
+++ b/src/security/v2/additional-description.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).
  *
@@ -52,7 +52,6 @@
   typedef std::map<std::string, std::string>::const_iterator const_iterator;
 
 public:
-
   /**
    * @brief Create an empty AdditionalDescription
    */
@@ -109,7 +108,6 @@
   wireDecode(const Block& wire);
 
 public: // EqualityComparable concept
-
   bool
   operator==(const AdditionalDescription& other) const;
 
@@ -117,12 +115,13 @@
   operator!=(const AdditionalDescription& other) const;
 
 private:
-
   std::map<std::string, std::string> m_info;
 
   mutable Block m_wire;
 };
 
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(AdditionalDescription);
+
 std::ostream&
 operator<<(std::ostream& os, const AdditionalDescription& period);
 
diff --git a/src/security/validity-period.cpp b/src/security/validity-period.cpp
index 14ba0f2..c30497b 100644
--- a/src/security/validity-period.cpp
+++ b/src/security/validity-period.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).
  *
@@ -72,11 +72,7 @@
   return totalLength;
 }
 
-template size_t
-ValidityPeriod::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
-
-template size_t
-ValidityPeriod::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ValidityPeriod);
 
 const Block&
 ValidityPeriod::wireEncode() const
diff --git a/src/security/validity-period.hpp b/src/security/validity-period.hpp
index d09657f..e87c6ec 100644
--- a/src/security/validity-period.hpp
+++ b/src/security/validity-period.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).
  *
@@ -125,6 +125,8 @@
   mutable Block m_wire;
 };
 
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ValidityPeriod);
+
 std::ostream&
 operator<<(std::ostream& os, const ValidityPeriod& period);