build: add -std=c++03 (in non C++11 mode) and -pedantic to the default CXXFLAGS
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.
This commit also includes fix for the advisory check for C++11-enabled
compiler in common.hpp (gcc < 4.7 does not correctly define __cpluplus
macro).
Finally, when custom CXXFLAGS are specified, --with-c++11 does not force
-std=c++11 or -std=c++0x flags, but just performs mandatory checks for
std::shared_ptr and std::function.
Change-Id: Icf44627edfddd34301bd27a05882b62fcbf54329
diff --git a/src/util/logging.cpp b/src/util/logging.cpp
index 59c7b2a..0b969a0 100644
--- a/src/util/logging.cpp
+++ b/src/util/logging.cpp
@@ -26,21 +26,21 @@
#include <unistd.h>
void
-INIT_LOGGERS ()
+INIT_LOGGERS()
{
static bool configured = false;
if (configured) return;
- if (access ("log4cxx.properties", R_OK)==0)
- PropertyConfigurator::configureAndWatch ("log4cxx.properties");
+ if (access("log4cxx.properties", R_OK)==0)
+ PropertyConfigurator::configureAndWatch("log4cxx.properties");
else
{
- PatternLayoutPtr layout (new PatternLayout ("%d{HH:mm:ss} %p %c{1} - %m%n"));
- ConsoleAppenderPtr appender (new ConsoleAppender (layout));
+ PatternLayoutPtr layout (new PatternLayout("%d{HH:mm:ss} %p %c{1} - %m%n"));
+ ConsoleAppenderPtr appender(new ConsoleAppender(layout));
BasicConfigurator::configure( appender );
- Logger::getRootLogger()->setLevel (log4cxx::Level::getInfo ());
+ Logger::getRootLogger()->setLevel(log4cxx::Level::getInfo());
}
configured = true;
diff --git a/src/util/logging.hpp b/src/util/logging.hpp
index 3fc1c0a..9370af0 100644
--- a/src/util/logging.hpp
+++ b/src/util/logging.hpp
@@ -16,28 +16,28 @@
#include <log4cxx/logger.h>
#define MEMBER_LOGGER \
- static log4cxx::LoggerPtr staticModuleLogger;
+ static log4cxx::LoggerPtr staticModuleLogger
#define INIT_MEMBER_LOGGER(className,name) \
- log4cxx::LoggerPtr className::staticModuleLogger = log4cxx::Logger::getLogger (name);
+ log4cxx::LoggerPtr className::staticModuleLogger = log4cxx::Logger::getLogger(name)
#define INIT_LOGGER(name) \
- static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger (name);
+ static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger(name)
#define _LOG_DEBUG(x) \
- LOG4CXX_DEBUG(staticModuleLogger, x);
+ LOG4CXX_DEBUG(staticModuleLogger, x)
#define _LOG_TRACE(x) \
- LOG4CXX_TRACE(staticModuleLogger, x);
+ LOG4CXX_TRACE(staticModuleLogger, x)
#define _LOG_FUNCTION(x) \
- LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "(" << x << ")");
+ LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "(" << x << ")")
#define _LOG_FUNCTION_NOARGS \
- LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "()");
+ LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "()")
#define _LOG_ERROR(x) \
- LOG4CXX_ERROR(staticModuleLogger, x);
+ LOG4CXX_ERROR(staticModuleLogger, x)
#define _LOG_ERROR_COND(cond,x) \
if (cond) { _LOG_ERROR(x) }
@@ -46,11 +46,11 @@
if (cond) { _LOG_DEBUG(x) }
void
-INIT_LOGGERS ();
+INIT_LOGGERS()
#else // else NDN_CPP_HAVE_LOG4CXX
-#define INIT_LOGGER(name)
+#define INIT_LOGGER(name) struct LOGGING_DISABLED
#define _LOG_FUNCTION(x)
#define _LOG_FUNCTION_NOARGS
#define _LOG_TRACE(x)