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/encoding/block.hpp b/src/encoding/block.hpp
index 031b00f..177d1f2 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -24,11 +24,9 @@
 #ifndef NDN_ENCODING_BLOCK_HPP
 #define NDN_ENCODING_BLOCK_HPP
 
-#include "../common.hpp"
-
 #include "buffer.hpp"
-#include "tlv.hpp"
 #include "encoding-buffer-fwd.hpp"
+#include "tlv.hpp"
 
 namespace boost {
 namespace asio {
diff --git a/src/encoding/encoding-buffer-fwd.hpp b/src/encoding/encoding-buffer-fwd.hpp
index 359864f..88f6dea 100644
--- a/src/encoding/encoding-buffer-fwd.hpp
+++ b/src/encoding/encoding-buffer-fwd.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 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).
  *
@@ -22,10 +22,12 @@
 #ifndef NDN_ENCODING_ENCODING_BUFFER_FWD_HPP
 #define NDN_ENCODING_ENCODING_BUFFER_FWD_HPP
 
+#include "../common.hpp"
+
 namespace ndn {
 namespace encoding {
 
-typedef bool Tag;
+using Tag = bool;
 
 /**
  * @brief Tag for EncodingImpl to indicate that Encoder is requested
@@ -44,8 +46,8 @@
 template<Tag TAG>
 class EncodingImpl;
 
-typedef EncodingImpl<EncoderTag> EncodingBuffer;
-typedef EncodingImpl<EstimatorTag> EncodingEstimator;
+using EncodingBuffer    = EncodingImpl<EncoderTag>;
+using EncodingEstimator = EncodingImpl<EstimatorTag>;
 
 } // namespace encoding
 
@@ -55,4 +57,16 @@
 
 } // namespace ndn
 
+#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName) \
+  extern template size_t \
+  ClassName::wireEncode<::ndn::encoding::EncoderTag>(::ndn::EncodingBuffer&) const; \
+  extern template size_t \
+  ClassName::wireEncode<::ndn::encoding::EstimatorTag>(::ndn::EncodingEstimator&) const \
+
+#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName) \
+  template size_t \
+  ClassName::wireEncode<::ndn::encoding::EncoderTag>(::ndn::EncodingBuffer&) const; \
+  template size_t \
+  ClassName::wireEncode<::ndn::encoding::EstimatorTag>(::ndn::EncodingEstimator&) const \
+
 #endif // NDN_ENCODING_ENCODING_BUFFER_FWD_HPP
diff --git a/src/encoding/encoding-buffer.hpp b/src/encoding/encoding-buffer.hpp
index 4f364fe..9b483c2 100644
--- a/src/encoding/encoding-buffer.hpp
+++ b/src/encoding/encoding-buffer.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).
  *
@@ -22,7 +22,6 @@
 #ifndef NDN_ENCODING_ENCODING_BUFFER_HPP
 #define NDN_ENCODING_ENCODING_BUFFER_HPP
 
-#include "../common.hpp"
 #include "encoding-buffer-fwd.hpp"
 #include "encoder.hpp"
 #include "estimator.hpp"
@@ -31,10 +30,10 @@
 namespace encoding {
 
 /**
- * @brief EncodingImpl specialization for real TLV encoding
+ * @brief EncodingImpl specialization for actual TLV encoding
  */
 template<>
-class EncodingImpl<EncoderTag> : public encoding::Encoder
+class EncodingImpl<EncoderTag> : public Encoder
 {
 public:
   explicit
@@ -51,10 +50,10 @@
 };
 
 /**
- * @brief EncodingImpl specialization TLV size estimation
+ * @brief EncodingImpl specialization for TLV size estimation
  */
 template<>
-class EncodingImpl<EstimatorTag> : public encoding::Estimator
+class EncodingImpl<EstimatorTag> : public Estimator
 {
 public:
   explicit