diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py index 3899b063..c946d1f0 100644 --- a/.waf-tools/default-compiler-flags.py +++ b/.waf-tools/default-compiler-flags.py @@ -188,7 +188,7 @@ class ClangFlags(GccBasicFlags): '-Wno-unused-local-typedef', # Bugs #2657 and #3209 ] version = tuple(int(i) for i in conf.env['CC_VERSION']) - if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (9, 0, 0)): + if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)): flags['CXXFLAGS'] += ['-Wno-unknown-pragmas'] return flags @@ -200,6 +200,6 @@ class ClangFlags(GccBasicFlags): '-Wno-unused-local-typedef', # Bugs #2657 and #3209 ] version = tuple(int(i) for i in conf.env['CC_VERSION']) - if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (9, 0, 0)): + if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)): flags['CXXFLAGS'] += ['-Wno-unknown-pragmas'] return flags diff --git a/core/config-file.cpp b/core/config-file.cpp index b9f40b1a..c2638cce 100644 --- a/core/config-file.cpp +++ b/core/config-file.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -24,10 +24,10 @@ */ #include "config-file.hpp" -#include "logger.hpp" #include #include +#include namespace nfd { @@ -42,11 +42,8 @@ ConfigFile::throwErrorOnUnknownSection(const std::string& filename, const ConfigSection& section, bool isDryRun) { - std::string msg = "Error processing configuration file "; - msg += filename; - msg += ": no module subscribed for section \"" + sectionName + "\""; - - BOOST_THROW_EXCEPTION(ConfigFile::Error(msg)); + BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename + + ": no module subscribed for section \"" + sectionName + "\"")); } void @@ -87,7 +84,7 @@ ConfigFile::parse(const std::string& filename, bool isDryRun) { std::ifstream inputFile(filename); if (!inputFile.good() || !inputFile.is_open()) { - BOOST_THROW_EXCEPTION(Error("Failed to read configuration file: " + filename)); + BOOST_THROW_EXCEPTION(Error("Failed to read configuration file " + filename)); } parse(inputFile, isDryRun, filename); inputFile.close(); @@ -107,11 +104,8 @@ ConfigFile::parse(std::istream& input, bool isDryRun, const std::string& filenam boost::property_tree::read_info(input, m_global); } catch (const boost::property_tree::info_parser_error& error) { - std::stringstream msg; - msg << "Failed to parse configuration file"; - msg << " " << filename; - msg << " " << error.message() << " line " << error.line(); - BOOST_THROW_EXCEPTION(Error(msg.str())); + BOOST_THROW_EXCEPTION(Error("Failed to parse configuration file " + filename + + ": " + error.message() + " on line " + to_string(error.line()))); } process(isDryRun, filename); @@ -130,10 +124,7 @@ ConfigFile::process(bool isDryRun, const std::string& filename) const BOOST_ASSERT(!filename.empty()); if (m_global.begin() == m_global.end()) { - std::string msg = "Error processing configuration file: "; - msg += filename; - msg += " no data"; - BOOST_THROW_EXCEPTION(Error(msg)); + BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename + ": no data")); } for (const auto& i : m_global) { diff --git a/core/logger-factory.cpp b/core/logger-factory.cpp index 3c419f16..215b0874 100644 --- a/core/logger-factory.cpp +++ b/core/logger-factory.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,6 +30,8 @@ #include #include +#include + #ifdef HAVE_CUSTOM_LOGGER #error "This file should not be compiled when custom logger is used" #endif diff --git a/core/privilege-helper.cpp b/core/privilege-helper.cpp index ba3da78d..b0ca116d 100644 --- a/core/privilege-helper.cpp +++ b/core/privilege-helper.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -29,6 +29,8 @@ #include #include +#include + namespace nfd { NFD_LOG_INIT("PrivilegeHelper"); diff --git a/daemon/main.cpp b/daemon/main.cpp index 6be75515..2ad3d455 100644 --- a/daemon/main.cpp +++ b/daemon/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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -45,6 +45,7 @@ #include #include +#include namespace nfd { diff --git a/tests/core/config-file.t.cpp b/tests/core/config-file.t.cpp index 8a41ac2e..0a570219 100644 --- a/tests/core/config-file.t.cpp +++ b/tests/core/config-file.t.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,8 +27,9 @@ #include "tests/test-common.hpp" -#include #include +#include +#include namespace nfd { namespace tests { diff --git a/tests/core/logger.t.cpp b/tests/core/logger.t.cpp index 11dcfa41..b2fb4c74 100644 --- a/tests/core/logger.t.cpp +++ b/tests/core/logger.t.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,6 +30,8 @@ #include #include +#include + namespace nfd { namespace tests { diff --git a/tests/other/cs-benchmark.cpp b/tests/other/cs-benchmark.cpp index 3e7a5a21..c28921b1 100644 --- a/tests/other/cs-benchmark.cpp +++ b/tests/other/cs-benchmark.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -24,9 +24,10 @@ */ #include "table/cs.hpp" - #include "tests/test-common.hpp" +#include + #ifdef HAVE_VALGRIND #include #endif @@ -40,8 +41,7 @@ protected: CsBenchmarkFixture() { #ifdef _DEBUG - BOOST_TEST_MESSAGE("Benchmark compiled in debug mode is unreliable, " - "please compile in release mode."); + std::cerr << "Benchmark compiled in debug mode is unreliable, please compile in release mode.\n"; #endif cs.setLimit(CS_CAPACITY); @@ -123,10 +123,8 @@ protected: static constexpr size_t CS_CAPACITY = 50000; }; -BOOST_FIXTURE_TEST_SUITE(TableCsBenchmark, CsBenchmarkFixture) - // find miss, then insert -BOOST_AUTO_TEST_CASE(FindMissInsert) +BOOST_FIXTURE_TEST_CASE(FindMissInsert, CsBenchmarkFixture) { constexpr size_t N_WORKLOAD = CS_CAPACITY * 2; constexpr size_t REPEAT = 4; @@ -145,11 +143,12 @@ BOOST_AUTO_TEST_CASE(FindMissInsert) } } }); - BOOST_TEST_MESSAGE("find(miss)-insert " << (N_WORKLOAD * REPEAT) << ": " << d); + + std::cout << "find(miss)-insert " << (N_WORKLOAD * REPEAT) << ": " << d << std::endl; } // insert, then find hit -BOOST_AUTO_TEST_CASE(InsertFindHit) +BOOST_FIXTURE_TEST_CASE(InsertFindHit, CsBenchmarkFixture) { constexpr size_t N_WORKLOAD = CS_CAPACITY * 2; constexpr size_t REPEAT = 4; @@ -168,11 +167,12 @@ BOOST_AUTO_TEST_CASE(InsertFindHit) } } }); - BOOST_TEST_MESSAGE("insert-find(hit) " << (N_WORKLOAD * REPEAT) << ": " << d); + + std::cout << "insert-find(hit) " << (N_WORKLOAD * REPEAT) << ": " << d << std::endl; } // find(leftmost) hit -BOOST_AUTO_TEST_CASE(Leftmost) +BOOST_FIXTURE_TEST_CASE(Leftmost, CsBenchmarkFixture) { constexpr size_t N_CHILDREN = 10; constexpr size_t N_INTERESTS = CS_CAPACITY / N_CHILDREN; @@ -197,11 +197,12 @@ BOOST_AUTO_TEST_CASE(Leftmost) } } }); - BOOST_TEST_MESSAGE("find(leftmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d); + + std::cout << "find(leftmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d << std::endl; } // find(rightmost) hit -BOOST_AUTO_TEST_CASE(Rightmost) +BOOST_FIXTURE_TEST_CASE(Rightmost, CsBenchmarkFixture) { constexpr size_t N_CHILDREN = 10; constexpr size_t N_INTERESTS = CS_CAPACITY / N_CHILDREN; @@ -226,10 +227,9 @@ BOOST_AUTO_TEST_CASE(Rightmost) } } }); - BOOST_TEST_MESSAGE("find(rightmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d); -} -BOOST_AUTO_TEST_SUITE_END() + std::cout << "find(rightmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d << std::endl; +} } // namespace tests } // namespace nfd diff --git a/tests/other/pit-fib-benchmark.cpp b/tests/other/pit-fib-benchmark.cpp index 85ffe5ef..d027c923 100644 --- a/tests/other/pit-fib-benchmark.cpp +++ b/tests/other/pit-fib-benchmark.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, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -23,11 +23,12 @@ * NFD, e.g., in COPYING.md file. If not, see . */ -#include "table/pit.hpp" #include "table/fib.hpp" - +#include "table/pit.hpp" #include "tests/test-common.hpp" +#include + #ifdef HAVE_VALGRIND #include #endif @@ -43,8 +44,7 @@ protected: , m_pit(m_nameTree) { #ifdef _DEBUG - BOOST_TEST_MESSAGE("Benchmark compiled in debug mode is unreliable, " - "please compile in release mode."); + std::cerr << "Benchmark compiled in debug mode is unreliable, please compile in release mode.\n"; #endif } @@ -150,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE(SimpleExchanges, PitFibBenchmarkFixture) CALLGRIND_STOP_INSTRUMENTATION; #endif - BOOST_TEST_MESSAGE(time::duration_cast(t2 - t1)); + std::cout << time::duration_cast(t2 - t1) << std::endl; } } // namespace tests diff --git a/tools/ndn-autoconfig-server/main.cpp b/tools/ndn-autoconfig-server/main.cpp index 3806d9a4..ba836db2 100644 --- a/tools/ndn-autoconfig-server/main.cpp +++ b/tools/ndn-autoconfig-server/main.cpp @@ -1,5 +1,5 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** +/* * Copyright (c) 2014-2017, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, @@ -26,6 +26,8 @@ #include "program.hpp" #include "core/extended-error-message.hpp" #include "core/version.hpp" + +#include #include namespace ndn { diff --git a/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp index c6c3b1a3..8f624b8e 100644 --- a/tools/ndn-autoconfig-server/program.cpp +++ b/tools/ndn-autoconfig-server/program.cpp @@ -1,5 +1,5 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** +/* * Copyright (c) 2014-2017, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, @@ -24,10 +24,13 @@ */ #include "program.hpp" + #include #include #include +#include + namespace ndn { namespace tools { namespace autoconfig_server { diff --git a/tools/ndn-autoconfig/dns-srv.cpp b/tools/ndn-autoconfig/dns-srv.cpp index 5bfa3d54..f432e2c2 100644 --- a/tools/ndn-autoconfig/dns-srv.cpp +++ b/tools/ndn-autoconfig/dns-srv.cpp @@ -34,6 +34,8 @@ #include #endif +#include + namespace ndn { namespace tools { namespace autoconfig { diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp index 8ef112de..9c50c201 100644 --- a/tools/ndn-autoconfig/guess-from-identity-name.cpp +++ b/tools/ndn-autoconfig/guess-from-identity-name.cpp @@ -25,9 +25,12 @@ #include "guess-from-identity-name.hpp" #include "dns-srv.hpp" + #include #include +#include + namespace ndn { namespace tools { namespace autoconfig { diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp index 01c169e7..395d9f96 100644 --- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp +++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp @@ -24,8 +24,11 @@ */ #include "ndn-fch-discovery.hpp" -#include + #include +#include + +#include namespace ndn { namespace tools { diff --git a/tools/ndn-autoconfig/stage.hpp b/tools/ndn-autoconfig/stage.hpp index 015153dc..f7f358ee 100644 --- a/tools/ndn-autoconfig/stage.hpp +++ b/tools/ndn-autoconfig/stage.hpp @@ -27,9 +27,12 @@ #define NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP #include "core/common.hpp" + #include #include +#include + namespace ndn { namespace tools { namespace autoconfig { diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp index 042248aa..39b7f6b7 100644 --- a/tools/nfd-autoreg.cpp +++ b/tools/nfd-autoreg.cpp @@ -1,5 +1,5 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** +/* * Copyright (c) 2014-2017, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, @@ -23,9 +23,11 @@ * NFD, e.g., in COPYING.md file. If not, see . */ +#include "core/network.hpp" +#include "core/version.hpp" + #include #include - #include #include #include @@ -37,8 +39,7 @@ #include #include -#include "core/version.hpp" -#include "core/network.hpp" +#include namespace ndn { namespace nfd_autoreg { diff --git a/tools/nfdc/main.cpp b/tools/nfdc/main.cpp index a7469a90..dfbc05c0 100644 --- a/tools/nfdc/main.cpp +++ b/tools/nfdc/main.cpp @@ -1,5 +1,5 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** +/* * Copyright (c) 2014-2017, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, @@ -27,6 +27,8 @@ #include "help.hpp" #include "core/version.hpp" +#include + namespace nfd { namespace tools { namespace nfdc {