build: update default CXXFLAGS.

* Add -std=c++03 and -pedantic, and fix the resulting warnings. The
  long-long-int warning is explicitly suppressed because it's not
  trivial to workaround in a platform-independent and ISO-conformant
  way without using C++11.

* Initial support for building with -std=c++11 (experimental).

* Prefer -Og optimization level in debug builds if supported by the
  compiler.

Change-Id: I744a25c8b52842dc3ea3a733d6ab2fa66171e6f8
diff --git a/daemon/core/face-uri.cpp b/daemon/core/face-uri.cpp
index 5da35cd..5cfaf72 100644
--- a/daemon/core/face-uri.cpp
+++ b/daemon/core/face-uri.cpp
@@ -24,6 +24,7 @@
 
 #include "face-uri.hpp"
 #include "core/logger.hpp"
+
 #ifdef HAVE_PCAP
 #include "face/ethernet.hpp"
 #endif // HAVE_PCAP
diff --git a/daemon/core/logger.hpp b/daemon/core/logger.hpp
index 552cb11..907ce7e 100644
--- a/daemon/core/logger.hpp
+++ b/daemon/core/logger.hpp
@@ -41,7 +41,7 @@
   LOG_DEBUG          = 4, // debug messages
   LOG_TRACE          = 5, // trace messages (most verbose)
   // LOG_FATAL is not a level and is logged unconditionally
-  LOG_ALL            = 255, // all messages
+  LOG_ALL            = 255 // all messages
 };
 
 class Logger
@@ -81,7 +81,6 @@
     m_moduleName = name;
   }
 
-
   /// \brief return a string representation of time since epoch: seconds.microseconds
   static std::string
   now()
@@ -89,13 +88,11 @@
     using namespace ndn::time;
 
     static const microseconds::rep ONE_SECOND = 1000000;
-
-    // 10 (whole seconds) + '.' + 6 (fraction) + 1 (\0)
-    char buffer[10 + 1 + 6 + 1];
-
     microseconds::rep microseconds_since_epoch =
       duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
 
+    // 10 (whole seconds) + '.' + 6 (fraction) + 1 (\0)
+    char buffer[10 + 1 + 6 + 1];
     ::snprintf(buffer, sizeof(buffer), "%lld.%06lld",
                static_cast<long long int>(microseconds_since_epoch / ONE_SECOND),
                static_cast<long long int>(microseconds_since_epoch % ONE_SECOND));
@@ -126,26 +123,26 @@
 
 namespace nfd {
 
-#define NFD_LOG_INIT(name)                                              \
-static nfd::Logger& g_logger = nfd::LoggerFactory::create(name);
+#define NFD_LOG_INIT(name) \
+static nfd::Logger& g_logger = nfd::LoggerFactory::create(name)
 
-#define NFD_LOG_INCLASS_DECLARE()               \
-static nfd::Logger& g_logger;
+#define NFD_LOG_INCLASS_DECLARE() \
+static nfd::Logger& g_logger
 
-#define NFD_LOG_INCLASS_DEFINE(cls, name)                       \
-nfd::Logger& cls::g_logger = nfd::LoggerFactory::create(name);
+#define NFD_LOG_INCLASS_DEFINE(cls, name) \
+nfd::Logger& cls::g_logger = nfd::LoggerFactory::create(name)
 
-#define NFD_LOG_INCLASS_TEMPLATE_DEFINE(cls, name)                      \
-template<class T>                                                       \
-nfd::Logger& cls<T>::g_logger = nfd::LoggerFactory::create(name);
+#define NFD_LOG_INCLASS_TEMPLATE_DEFINE(cls, name) \
+template<class T>                                  \
+nfd::Logger& cls<T>::g_logger = nfd::LoggerFactory::create(name)
 
 #define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name) \
-template<>                                                              \
-nfd::Logger& cls<specialization>::g_logger = nfd::LoggerFactory::create(name);
+template<>                                                                        \
+nfd::Logger& cls<specialization>::g_logger = nfd::LoggerFactory::create(name)
 
 #define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(cls, s1, s2, name) \
-template<>                                                              \
-nfd::Logger& cls<s1, s2>::g_logger = nfd::LoggerFactory::create(name);
+template<>                                                                 \
+nfd::Logger& cls<s1, s2>::g_logger = nfd::LoggerFactory::create(name)
 
 
 #define NFD_LOG(level, expression)                                      \
diff --git a/daemon/core/network-interface.cpp b/daemon/core/network-interface.cpp
index c8e4046..df47ac5 100644
--- a/daemon/core/network-interface.cpp
+++ b/daemon/core/network-interface.cpp
@@ -40,9 +40,9 @@
 #error Platform not supported
 #endif
 
-namespace nfd {
+NFD_LOG_INIT("NetworkInterfaceInfo");
 
-NFD_LOG_INIT("NetworkInterfaceInfo")
+namespace nfd {
 
 std::list< shared_ptr<NetworkInterfaceInfo> >
 listNetworkInterfaces()