From 844b09331bfca9cd06a96775e39bee8225cb2220 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Mon, 7 May 2018 01:00:16 -0400 Subject: [PATCH] build: require gcc >= 5.3, boost >= 1.58, openssl >= 1.0.2 This effectively drops support for all versions of Ubuntu older than 16.04 Change-Id: Ie3ab7df9147e97f6467658a6399a4f9379f089c1 Refs: #4462 --- .jenkins.d/README.md | 4 +- .travis.yml | 91 +++++++--------------- .waf-tools/compiler-features.py | 25 +----- .waf-tools/default-compiler-flags.py | 16 ++-- .waf-tools/type_traits.py | 15 ---- README-dev.md | 4 +- docs/INSTALL.rst | 6 +- docs/code-style.rst | 2 +- docs/examples.rst | 2 +- docs/tutorials/utils-ndn-regex.rst | 2 +- src/encoding/block.cpp | 28 ------- src/encoding/buffer.cpp | 7 +- src/net/address-converter.cpp | 69 +--------------- src/security/transform/verifier-filter.cpp | 10 +-- src/util/backports-optional.hpp | 22 ------ src/util/regex/regex-component-matcher.cpp | 19 +---- src/util/scheduler-scoped-event-id.cpp | 6 +- src/util/signal/scoped-connection.cpp | 8 +- src/util/signal/signal.hpp | 9 +-- src/util/time.hpp | 4 +- wscript | 19 ++--- 21 files changed, 72 insertions(+), 296 deletions(-) delete mode 100644 .waf-tools/type_traits.py diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md index f6e3167ee..a69ef9e8a 100644 --- a/.jenkins.d/README.md +++ b/.jenkins.d/README.md @@ -13,13 +13,13 @@ Environment Variables Used in Build Scripts * `[OS_TYPE]`: `Linux` * `[DISTRO_TYPE]`: `Ubuntu` - * `[DISTRO_VERSION]`: `Ubuntu-14.04`, `Ubuntu-16.04` + * `[DISTRO_VERSION]`: `Ubuntu-16.04`, `Ubuntu-18.04` Possible values for OS X / macOS: * `[OS_TYPE]`: `OSX` * `[DISTRO_TYPE]`: `OSX` (can be absent) - * `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.11`, `OSX-10.12` + * `[DISTRO_VERSION]`: `OSX-10.11`, `OSX-10.12`, `OSX-10.13` - `JOB_NAME`: optional variable to define type of the job. Depending on the defined job type, the build scripts can perform different tasks. diff --git a/.travis.yml b/.travis.yml index bc7118611..fb2ec6fe4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -dist: trusty +dist: xenial sudo: required env: global: @@ -10,93 +10,35 @@ matrix: include: # Linux/gcc # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages - - os: linux - env: COMPILER=g++-4.8 - - os: linux - env: COMPILER=g++-4.9 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-4.9 - os: linux env: COMPILER=g++-5 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-5 - os: linux env: COMPILER=g++-6 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-6 - os: linux env: COMPILER=g++-7 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-7 - os: linux env: COMPILER=g++-8 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-8 # Linux/clang # https://apt.llvm.org/ - os: linux env: COMPILER=clang++-3.5 - addons: - apt: - packages: clang-3.5 - os: linux env: COMPILER=clang++-3.6 - addons: - apt: - packages: clang-3.6 - os: linux env: COMPILER=clang++-3.7 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-precise-3.7", "ubuntu-toolchain-r-test"] - packages: clang-3.7 - os: linux env: COMPILER=clang++-3.8 - addons: - apt: - sources: ["llvm-toolchain-precise-3.8", "ubuntu-toolchain-r-test"] - packages: clang-3.8 - os: linux - env: COMPILER=clang++-3.9 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-trusty-3.9", "ubuntu-toolchain-r-test"] - packages: clang-3.9 + env: COMPILER=clang++-3.9 - os: linux env: COMPILER=clang++-4.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-4.0", "ubuntu-toolchain-r-test"] - packages: clang-4.0 - os: linux env: COMPILER=clang++-5.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-5.0", "ubuntu-toolchain-r-test"] - packages: clang-5.0 - os: linux env: COMPILER=clang++-6.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-6.0", "ubuntu-toolchain-r-test"] - packages: clang-6.0 - os: linux env: COMPILER=clang++-7 - addons: - apt: - sources: ["llvm-toolchain-trusty", "ubuntu-toolchain-r-test"] - packages: clang-7 # macOS/clang # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version @@ -114,13 +56,40 @@ matrix: env: OSX_VERSION=10.13 USE_OPENSSL_1_1=yes allow_failures: + - env: COMPILER=g++-6 + - env: COMPILER=g++-7 + - env: COMPILER=g++-8 + - env: COMPILER=clang++-3.5 + - env: COMPILER=clang++-3.6 + - env: COMPILER=clang++-3.7 DISABLE_ASAN=yes + - env: COMPILER=clang++-4.0 + - env: COMPILER=clang++-5.0 + - env: COMPILER=clang++-6.0 - env: COMPILER=clang++-7 - env: OSX_VERSION=10.13 USE_OPENSSL_1_1=yes fast_finish: true +install: | + case ${COMPILER} in + g++-[6789]) + travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + travis_retry sudo apt-get -qq update + travis_retry sudo apt-get -qy install "${COMPILER}" + ;; + clang++-*) + CLANG_VERSION=${COMPILER/clang++} + if [[ ${CLANG_VERSION} != "-3."* ]]; then + wget -O - "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - + travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial${CLANG_VERSION/-7} main" + fi + travis_retry sudo apt-get -qq update + travis_retry sudo apt-get -qy install "clang${CLANG_VERSION}" + ;; + esac + before_script: - - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-14.04"; fi + - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi - ${CXX:-c++} --version diff --git a/.waf-tools/compiler-features.py b/.waf-tools/compiler-features.py index 502596ca1..1602f1683 100644 --- a/.waf-tools/compiler-features.py +++ b/.waf-tools/compiler-features.py @@ -23,31 +23,8 @@ @conf def check_std_to_string(self): if self.check_cxx(msg='Checking for std::to_string', - fragment=STD_TO_STRING, - features='cxx', mandatory=False): + fragment=STD_TO_STRING, mandatory=False): self.define('HAVE_STD_TO_STRING', 1) -VECTOR_INSERT_ERASE_CONST_ITERATOR = ''' -#include -int -main() -{ - std::vector v; - std::vector::const_iterator it = v.cbegin(); - - v.insert(it, 2); - it = v.cend() - 1; - v.erase(it); -} -''' - -@conf -def check_vector_const_iterators(self): - if self.check_cxx(msg='Checking for std::vector::insert with const_iterator', - fragment=VECTOR_INSERT_ERASE_CONST_ITERATOR, - features='cxx', mandatory=False): - self.define('HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR', 1) - def configure(conf): conf.check_std_to_string() - conf.check_vector_const_iterators() diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py index 54db7ea99..e9fdcc61b 100644 --- a/.waf-tools/default-compiler-flags.py +++ b/.waf-tools/default-compiler-flags.py @@ -15,14 +15,14 @@ def configure(conf): errmsg = '' warnmsg = '' if cxx == 'gcc': - if ccver < (4, 8, 2): + if ccver < (5, 3, 0): errmsg = ('The version of gcc you are using is too old.\n' - 'The minimum supported gcc version is 4.8.2.') + 'The minimum supported gcc version is 5.3.0.') conf.flags = GccFlags() elif cxx == 'clang': - if ccver < (3, 4, 0): + if ccver < (3, 5, 0): errmsg = ('The version of clang you are using is too old.\n' - 'The minimum supported clang version is 3.4.0.') + 'The minimum supported clang version is 3.5.0.') conf.flags = ClangFlags() else: warnmsg = 'Note: %s compiler is unsupported' % cxx @@ -164,16 +164,12 @@ def getOptimizedFlags(self, conf): class GccFlags(GccBasicFlags): def getDebugFlags(self, conf): flags = super(GccFlags, self).getDebugFlags(conf) - if self.getCompilerVersion(conf) < (5, 1, 0): - flags['CXXFLAGS'] += ['-Wno-missing-field-initializers'] - flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9 + flags['CXXFLAGS'] += ['-fdiagnostics-color'] return flags def getOptimizedFlags(self, conf): flags = super(GccFlags, self).getOptimizedFlags(conf) - if self.getCompilerVersion(conf) < (5, 1, 0): - flags['CXXFLAGS'] += ['-Wno-missing-field-initializers'] - flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9 + flags['CXXFLAGS'] += ['-fdiagnostics-color'] return flags class ClangFlags(GccBasicFlags): diff --git a/.waf-tools/type_traits.py b/.waf-tools/type_traits.py deleted file mode 100644 index efc4e3d0f..000000000 --- a/.waf-tools/type_traits.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -def checkForTypeProperty(conf, prop, tparams): - if conf.check_cxx(msg=('Checking for std::%s' % prop), - fragment=('#include \nstatic_assert(std::%s<%s>::value, "");' % - (prop, tparams)), - features='cxx', mandatory=False): - define = 'HAVE_' + prop.upper() - conf.define(define, 1) - conf.env[define] = True - -def configure(conf): - checkForTypeProperty(conf, 'is_default_constructible', 'int') - checkForTypeProperty(conf, 'is_nothrow_move_constructible', 'int') - checkForTypeProperty(conf, 'is_nothrow_move_assignable', 'int') diff --git a/README-dev.md b/README-dev.md index d9af4c9c3..8dd53d149 100644 --- a/README-dev.md +++ b/README-dev.md @@ -63,7 +63,7 @@ The simplest way to run tests, is just to run the compiled binary without any pa ./build/unit-tests -[Boost.Test framework](http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/index.html) +[Boost.Test framework](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html) is very flexible and allows a number of run-time customization of what tests should be run. For example, it is possible to choose to run only a specific test suite, only a specific test case within a suite, or specific test cases within specific test suites: @@ -96,7 +96,7 @@ or `-p` to show progress bar: There are many more command line options available, information about which can be obtained either from the command line using `--help` switch, or online on -[Boost.Test library](http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/index.html) +[Boost.Test library](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html) website. **Warning:** If you have customized parameters for NDN platform using `client.conf` in diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 019ed5ba9..0eaf52ac0 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -9,7 +9,6 @@ Supported platforms ndn-cxx uses continuous integration and has been tested on the following platforms: -- Ubuntu 14.04 (amd64) - Ubuntu 16.04 (amd64, armhf, i386) - Ubuntu 18.04 (amd64) - OS X 10.11 @@ -30,11 +29,12 @@ Prerequisites Required: ~~~~~~~~~ +- GCC >= 5.3, or clang >= 3.5 - ``python2`` >= 2.7, or ``python3`` >= 3.4 - ``libsqlite3`` -- OpenSSL >= 1.0.1 +- OpenSSL >= 1.0.2 - ``pkg-config`` -- Boost libraries >= 1.54 +- Boost libraries >= 1.58 - OSX Security framework (on OSX/macOS platform only) Following are the detailed steps for each platform to install the compiler, all necessary diff --git a/docs/code-style.rst b/docs/code-style.rst index 1450598a8..bf0ffee8c 100644 --- a/docs/code-style.rst +++ b/docs/code-style.rst @@ -1087,6 +1087,6 @@ member function or a virtual destructor. 3.31. The recommended way to throw an exception derived from ``std::exception`` is to use the ``BOOST_THROW_EXCEPTION`` -`macro `__. +`macro `__. Exceptions thrown using this macro will be augmented with additional diagnostic information, including file name, line number, and function name from where the exception was thrown. diff --git a/docs/examples.rst b/docs/examples.rst index 8689e4fd7..729a6c5f2 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -52,7 +52,7 @@ The following example demonstrates how to use :ndn-cxx:`Scheduler` to schedule a events for execution at specific points of time. The library internally uses `boost::asio::io_service -`_ to +`_ to implement fully asynchronous NDN operations (i.e., sending and receiving Interests and Data). In addition to network-related operations, ``boost::asio::io_service`` can be used to execute any arbitrary callback within the processing thread (run either explicitly via diff --git a/docs/tutorials/utils-ndn-regex.rst b/docs/tutorials/utils-ndn-regex.rst index 6492a964b..af107c0c5 100644 --- a/docs/tutorials/utils-ndn-regex.rst +++ b/docs/tutorials/utils-ndn-regex.rst @@ -6,7 +6,7 @@ performed at two levels: the name level and the name component level. A name component matcher, enclosed in ``<`` and ``>``, specifies the pattern of a name component. The component pattern is expressed with the `Perl Regular Expression Syntax -`__. +`__. For example, ```` matches the 1st, 3rd, and 4th components of ``/ac/dc/abc/abbc``, but does not match the 2nd component. A special case is that ``<>`` denotes a wildcard matcher that can match **ANY** name component. diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp index 21130646d..ed8f5c908 100644 --- a/src/encoding/block.cpp +++ b/src/encoding/block.cpp @@ -34,15 +34,10 @@ namespace ndn { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE static_assert(std::is_nothrow_move_constructible::value, "Block must be MoveConstructible with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE - -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE static_assert(std::is_nothrow_move_assignable::value, "Block must be MoveAssignable with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE const size_t MAX_SIZE_OF_BLOCK_FROM_STREAM = MAX_NDN_PACKET_SIZE; @@ -454,30 +449,14 @@ Block::element_iterator Block::erase(Block::element_const_iterator position) { resetWire(); - -#ifdef NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR return m_elements.erase(position); -#else - element_iterator it = m_elements.begin(); - std::advance(it, std::distance(m_elements.cbegin(), position)); - return m_elements.erase(it); -#endif } Block::element_iterator Block::erase(Block::element_const_iterator first, Block::element_const_iterator last) { resetWire(); - -#ifdef NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR return m_elements.erase(first, last); -#else - element_iterator itStart = m_elements.begin(); - element_iterator itEnd = m_elements.begin(); - std::advance(itStart, std::distance(m_elements.cbegin(), first)); - std::advance(itEnd, std::distance(m_elements.cbegin(), last)); - return m_elements.erase(itStart, itEnd); -#endif } void @@ -491,14 +470,7 @@ Block::element_iterator Block::insert(Block::element_const_iterator pos, const Block& element) { resetWire(); - -#ifdef NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR return m_elements.insert(pos, element); -#else - element_iterator it = m_elements.begin(); - std::advance(it, std::distance(m_elements.cbegin(), pos)); - return m_elements.insert(it, element); -#endif } // ---- misc ---- diff --git a/src/encoding/buffer.cpp b/src/encoding/buffer.cpp index ce4c88009..531e9fab9 100644 --- a/src/encoding/buffer.cpp +++ b/src/encoding/buffer.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California. + * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -25,15 +25,10 @@ namespace ndn { -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE static_assert(std::is_nothrow_move_constructible::value, "Buffer must be MoveConstructible with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE - -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE static_assert(std::is_nothrow_move_assignable::value, "Buffer must be MoveAssignable with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE Buffer::Buffer() = default; diff --git a/src/net/address-converter.cpp b/src/net/address-converter.cpp index d84f75778..e29c0c0c8 100644 --- a/src/net/address-converter.cpp +++ b/src/net/address-converter.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California, + * Copyright (c) 2013-2018 Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,13 +27,7 @@ #include "address-converter.hpp" -#if BOOST_VERSION < 105800 -#include -#include -#include -#endif // BOOST_VERSION < 105800 - -#include // for if_nametoindex and if_indextoname +#include // for if_indextoname() namespace ndn { namespace ip { @@ -49,69 +43,10 @@ scopeNameFromId(unsigned int scopeId) return nullopt; } -#if BOOST_VERSION < 105800 -static unsigned int -scopeIdFromString(const std::string& scope) -{ - auto id = if_nametoindex(scope.c_str()); - if (id != 0) { - return id; - } - - // cannot find a corresponding index, assume it's not a name but an interface index - try { - return boost::lexical_cast(scope); - } - catch (const boost::bad_lexical_cast&) { - return 0; - } -} - -struct ParsedAddress -{ - boost::asio::ip::address addr; - std::string scope; -}; - -static ParsedAddress -parseAddressFromString(const std::string& address, boost::system::error_code& ec) -{ - std::vector parseResult; - boost::algorithm::split(parseResult, address, boost::is_any_of("%")); - auto addr = boost::asio::ip::address::from_string(parseResult[0], ec); - - switch (parseResult.size()) { - case 1: - // regular address - return {addr, ""}; - case 2: - // the presence of % in either an IPv4 address or a regular IPv6 address is invalid - if (!ec && addr.is_v6() && addr.to_v6().is_link_local()) { - return {addr, parseResult[1]}; - } - NDN_CXX_FALLTHROUGH; - default: - ec = boost::asio::error::invalid_argument; - return {}; - } -} -#endif // BOOST_VERSION < 105800 - boost::asio::ip::address addressFromString(const std::string& address, boost::system::error_code& ec) { - // boost < 1.58 cannot recognize scope-id in link-local IPv6 address -#if BOOST_VERSION < 105800 - auto parsedAddress = parseAddressFromString(address, ec); - if (ec || parsedAddress.addr.is_v4()) { - return parsedAddress.addr; - } - auto addr = parsedAddress.addr.to_v6(); - addr.scope_id(scopeIdFromString(parsedAddress.scope)); - return addr; -#else return boost::asio::ip::address::from_string(address, ec); -#endif // BOOST_VERSION < 105800 } boost::asio::ip::address diff --git a/src/security/transform/verifier-filter.cpp b/src/security/transform/verifier-filter.cpp index fca982a56..f4b8e84f5 100644 --- a/src/security/transform/verifier-filter.cpp +++ b/src/security/transform/verifier-filter.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California. + * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -75,13 +75,7 @@ VerifierFilter::convert(const uint8_t* buf, size_t size) void VerifierFilter::finalize() { - int res = EVP_DigestVerifyFinal(m_impl->ctx, -#if OPENSSL_VERSION_NUMBER < 0x1000200fL - const_cast(m_impl->sig), -#else - m_impl->sig, -#endif - m_impl->siglen); + int res = EVP_DigestVerifyFinal(m_impl->ctx, m_impl->sig, m_impl->siglen); auto buffer = make_unique(1); (*buffer)[0] = (res == 1) ? 1 : 0; diff --git a/src/util/backports-optional.hpp b/src/util/backports-optional.hpp index accae69c0..73e106891 100644 --- a/src/util/backports-optional.hpp +++ b/src/util/backports-optional.hpp @@ -107,18 +107,7 @@ class nullopt_t }; constexpr nullopt_t nullopt{0}; -#if BOOST_VERSION >= 105600 using boost::bad_optional_access; -#else -class bad_optional_access : public std::logic_error -{ -public: - bad_optional_access() - : std::logic_error("bad optional access") - { - } -}; -#endif template constexpr bool @@ -241,25 +230,14 @@ class optional T& value() { -#if BOOST_VERSION >= 105600 return m_boostOptional.value(); -#else - if (!m_boostOptional) { - BOOST_THROW_EXCEPTION(bad_optional_access()); - } - return m_boostOptional.get(); -#endif } template constexpr T value_or(U&& default_value) const { -#if BOOST_VERSION >= 105600 return m_boostOptional.value_or(default_value); -#else - return m_boostOptional.get_value_or(default_value); -#endif } public: // modifiers diff --git a/src/util/regex/regex-component-matcher.cpp b/src/util/regex/regex-component-matcher.cpp index 8d1e824c4..aca35c1c5 100644 --- a/src/util/regex/regex-component-matcher.cpp +++ b/src/util/regex/regex-component-matcher.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California. + * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -26,19 +26,6 @@ namespace ndn { -// Re: http://www.boost.org/users/history/version_1_56_0.html -// -// Breaking change: corrected behavior of basic_regex<>::mark_count() to match existing -// documentation, basic_regex<>::subexpression(n) changed to match, see -// https://svn.boost.org/trac/boost/ticket/9227 -// -static constexpr size_t BOOST_REGEXP_MARK_COUNT_CORRECTION = -#if BOOST_VERSION < 105600 - 1; -#else - 0; -#endif - RegexComponentMatcher::RegexComponentMatcher(const std::string& expr, shared_ptr backrefManager, bool isExactMatch) @@ -56,7 +43,7 @@ RegexComponentMatcher::compile() m_pseudoMatchers.clear(); m_pseudoMatchers.push_back(make_shared()); - for (size_t i = 1; i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++) { + for (size_t i = 1; i <= m_componentRegex.mark_count(); i++) { m_pseudoMatchers.push_back(make_shared()); m_backrefManager->pushRef(m_pseudoMatchers.back()); } @@ -78,7 +65,7 @@ RegexComponentMatcher::match(const Name& name, size_t offset, size_t len) boost::smatch subResult; std::string targetStr = name.get(offset).toUri(); if (boost::regex_match(targetStr, subResult, m_componentRegex)) { - for (size_t i = 1; i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++) { + for (size_t i = 1; i <= m_componentRegex.mark_count(); i++) { m_pseudoMatchers[i]->resetMatchResult(); m_pseudoMatchers[i]->setMatchResult(subResult[i]); } diff --git a/src/util/scheduler-scoped-event-id.cpp b/src/util/scheduler-scoped-event-id.cpp index f5378c8f9..0ca7d1396 100644 --- a/src/util/scheduler-scoped-event-id.cpp +++ b/src/util/scheduler-scoped-event-id.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-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -25,10 +25,8 @@ namespace ndn { namespace util { namespace scheduler { -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE static_assert(std::is_nothrow_move_constructible::value, "ScopedEventId must be MoveConstructible with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE ScopedEventId::ScopedEventId(Scheduler& scheduler) : m_scheduler(&scheduler) diff --git a/src/util/signal/scoped-connection.cpp b/src/util/signal/scoped-connection.cpp index cbbfabacb..3fed4a398 100644 --- a/src/util/signal/scoped-connection.cpp +++ b/src/util/signal/scoped-connection.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California. + * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -25,14 +25,10 @@ namespace ndn { namespace util { namespace signal { -#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE static_assert(std::is_nothrow_move_constructible::value, "ScopedConnection must be MoveConstructible with noexcept"); -#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE -ScopedConnection::ScopedConnection() -{ -} +ScopedConnection::ScopedConnection() = default; ScopedConnection::ScopedConnection(const Connection& connection) : m_connection(connection) diff --git a/src/util/signal/signal.hpp b/src/util/signal/signal.hpp index 9b502abb1..8c76e13e9 100644 --- a/src/util/signal/signal.hpp +++ b/src/util/signal/signal.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2017 Regents of the University of California. + * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -23,6 +23,7 @@ #define NDN_UTIL_SIGNAL_SIGNAL_HPP #include "connection.hpp" + #include namespace ndn { @@ -163,7 +164,7 @@ template Connection Signal::connect(const Handler& handler) { - typename SlotList::iterator it = m_slots.insert(m_slots.end(), {handler, nullptr}); + auto it = m_slots.insert(m_slots.end(), {handler, nullptr}); it->disconnect = make_shared>(bind(&Self::disconnect, this, it)); return signal::Connection(weak_ptr>(it->disconnect)); @@ -173,7 +174,7 @@ template Connection Signal::connectSingleShot(const Handler& handler) { - typename SlotList::iterator it = m_slots.insert(m_slots.end(), {nullptr, nullptr}); + auto it = m_slots.insert(m_slots.end(), {nullptr, nullptr}); it->disconnect = make_shared>(bind(&Self::disconnect, this, it)); signal::Connection conn(weak_ptr>(it->disconnect)); @@ -189,8 +190,6 @@ template void Signal::disconnect(typename SlotList::iterator it) { - // 'it' could be const_iterator, but gcc 4.6 doesn't support std::list::erase(const_iterator) - if (m_isExecuting) { // during signal emission, only the currently executing handler can be disconnected BOOST_ASSERT_MSG(it == m_currentSlot, "cannot disconnect another handler from a handler"); diff --git a/src/util/time.hpp b/src/util/time.hpp index cf497affe..0d1250dd2 100644 --- a/src/util/time.hpp +++ b/src/util/time.hpp @@ -303,7 +303,7 @@ fromIsoString(const std::string& isoString); * \param format desired output format (default: `%Y-%m-%d %H:%M:%S`) * \param locale desired locale (default: "C" locale) * - * \sa http://www.boost.org/doc/libs/1_54_0/doc/html/date_time/date_time_io.html#date_time.format_flags + * \sa https://www.boost.org/doc/libs/1_58_0/doc/html/date_time/date_time_io.html#date_time.format_flags * describes possible formatting flags **/ std::string @@ -321,7 +321,7 @@ toString(const system_clock::TimePoint& timePoint, * \param format input output format (default: `%Y-%m-%d %H:%M:%S`) * \param locale input locale (default: "C" locale) * - * \sa http://www.boost.org/doc/libs/1_54_0/doc/html/date_time/date_time_io.html#date_time.format_flags + * \sa https://www.boost.org/doc/libs/1_58_0/doc/html/date_time/date_time_io.html#date_time.format_flags * describes possible formatting flags */ system_clock::TimePoint diff --git a/wscript b/wscript index 96740c3cb..f37418deb 100644 --- a/wscript +++ b/wscript @@ -11,7 +11,7 @@ GIT_TAG_PREFIX = 'ndn-cxx-' def options(opt): opt.load(['compiler_cxx', 'gnu_dirs', 'c_osx']) - opt.load(['default-compiler-flags', 'compiler-features', 'type_traits', + opt.load(['default-compiler-flags', 'compiler-features', 'coverage', 'pch', 'sanitizers', 'osx-frameworks', 'boost', 'openssl', 'sqlite3', 'doxygen', 'sphinx_build'], @@ -67,7 +67,7 @@ def configure(conf): conf.fatal('Either static library or shared library must be enabled') conf.load(['compiler_cxx', 'gnu_dirs', 'c_osx', - 'default-compiler-flags', 'compiler-features', 'type_traits', + 'default-compiler-flags', 'compiler-features', 'pch', 'osx-frameworks', 'boost', 'openssl', 'sqlite3', 'doxygen', 'sphinx_build']) @@ -89,15 +89,13 @@ def configure(conf): 'linux/netlink.h', 'linux/rtnetlink.h']): conf.env['HAVE_RTNETLINK'] = True conf.check_cxx(msg='Checking for IFA_FLAGS', define_name='HAVE_IFA_FLAGS', mandatory=False, - fragment=''' - #include - int main() { return IFA_FLAGS; } - ''') + fragment='''#include + int main() { return IFA_FLAGS; }''') conf.check_osx_frameworks() conf.check_sqlite3(mandatory=True) - conf.check_openssl(mandatory=True, atleast_version=0x10001000) # 1.0.1 + conf.check_openssl(mandatory=True, atleast_version=0x1000200f) # 1.0.2 USED_BOOST_LIBS = ['system', 'filesystem', 'date_time', 'iostreams', 'regex', 'program_options', 'chrono', 'thread', @@ -108,14 +106,11 @@ def configure(conf): conf.define('HAVE_TESTS', 1) conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True, mt=True) - if conf.env.BOOST_VERSION_NUMBER < 105400: - conf.fatal('Minimum required Boost version is 1.54.0\n' + if conf.env.BOOST_VERSION_NUMBER < 105800: + conf.fatal('Minimum required Boost version is 1.58.0\n' 'Please upgrade your distribution or manually install a newer version of Boost' ' (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)') - if conf.env['CXX_NAME'] == 'clang' and conf.env.BOOST_VERSION_NUMBER < 105800: - conf.env.append_value('DEFINES', 'BOOST_ASIO_HAS_STD_ARRAY=1') # Bug #4096 - if not conf.options.with_sqlite_locking: conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)