From d3c853eb088f6c898a2ecd151508fa60030e08a7 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 22 Oct 2019 00:13:26 +0300 Subject: [PATCH 01/19] Updated CI configs, added compilers. --- .travis.yml | 178 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 130 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc68de4..13bd0d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ # Copyright 2016, 2017, 2018 Peter Dimov +# Copyright 2019 Andrey Semashev # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) @@ -22,12 +23,10 @@ matrix: - env: BOGUS_JOB=true include: +# gcc, Linux - os: linux - compiler: g++ - env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 - - - os: linux - compiler: g++-4.4 + dist: trusty + compiler: gcc-4.4 env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x addons: apt: @@ -37,7 +36,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-4.6 + dist: trusty + compiler: gcc-4.6 env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x addons: apt: @@ -47,7 +47,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-4.7 + dist: trusty + compiler: gcc-4.7 env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 addons: apt: @@ -57,7 +58,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-4.8 + dist: xenial + compiler: gcc-4.8 env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 addons: apt: @@ -65,8 +67,10 @@ matrix: - g++-4.8 sources: - ubuntu-toolchain-r-test + - os: linux - compiler: g++-4.9 + dist: xenial + compiler: gcc-4.9 env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 addons: apt: @@ -76,7 +80,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-5 + dist: xenial + compiler: gcc-5 env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z addons: apt: @@ -86,7 +91,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-6 + dist: xenial + compiler: gcc-6 env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z addons: apt: @@ -96,7 +102,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-7 + dist: xenial + compiler: gcc-7 env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 addons: apt: @@ -106,7 +113,8 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-8 + dist: xenial + compiler: gcc-8 env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17 addons: apt: @@ -116,27 +124,34 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 - - - os: linux - compiler: /usr/bin/clang++ - env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11 + dist: bionic + compiler: gcc-9 + env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17 addons: apt: packages: - - clang-3.3 + - g++-9 + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" +# clang, Linux - os: linux - compiler: /usr/bin/clang++ - env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11 + dist: trusty + compiler: clang-3.4 + env: TOOLSET=clang COMPILER=clang++-3.4 CXXSTD=03,11 addons: apt: packages: - clang-3.4 + - libstdc++-4.9-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.4 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-3.5 + dist: trusty + compiler: clang-3.5 env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z addons: apt: @@ -145,109 +160,176 @@ matrix: - libstdc++-4.9-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.5 + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.5 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-3.6 + dist: trusty + compiler: clang-3.6 env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z addons: apt: packages: - clang-3.6 + - libstdc++-5-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.6 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-3.7 + dist: trusty + compiler: clang-3.7 env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z addons: apt: packages: - clang-3.7 + - libstdc++-5-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.7 + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.7 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-3.8 + dist: xenial + compiler: clang-3.8 env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z addons: apt: packages: - clang-3.8 - - libstdc++-4.9-dev + - libstdc++-6-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.8 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-3.9 + dist: xenial + compiler: clang-3.9 env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z addons: apt: packages: - clang-3.9 - - libstdc++-4.9-dev + - libstdc++-6-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.9 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-4.0 + dist: xenial + compiler: clang-4 env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z addons: apt: packages: - clang-4.0 + - libstdc++-6-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-4.0 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-5.0 + dist: xenial + compiler: clang-5 env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z addons: apt: packages: - clang-5.0 + - libstdc++-7-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-5.0 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,1z + dist: xenial + compiler: clang-6 + env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17 addons: apt: packages: - clang-6.0 + - libstdc++-8-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-6.0 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-7 + dist: xenial + compiler: clang-7 env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17 addons: apt: packages: - clang-7 + - libstdc++-8-dev sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-7 + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux - compiler: clang++-libc++ - env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z + dist: xenial + compiler: clang-8 + env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17 addons: apt: packages: - - libc++-dev + - clang-8 + - libstdc++-8-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-9 + env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17 + addons: + apt: + packages: + - clang-9 + - libstdc++-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-libc++ + env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + addons: + apt: + packages: + - clang-9 + - libc++-9-dev + - libc++abi-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + +# clang, OS X + - os: osx + env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z + osx_image: xcode9.4 - os: osx - compiler: clang++ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z + osx_image: xcode10.3 + + - os: osx + env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 + osx_image: xcode11.2 install: - GIT_FETCH_JOBS=8 @@ -271,7 +353,7 @@ script: - |- echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null` - - ./b2 -j $BUILD_JOBS libs/detail/test toolset=$TOOLSET cxxstd=$CXXSTD + - ./b2 -j $BUILD_JOBS libs/detail/test toolset=$TOOLSET cxxstd=$CXXSTD ${CXXFLAGS:+cxxflags="$CXXFLAGS"} ${LINKFLAGS:+linkflags="$LINKFLAGS"} notifications: email: From 8dbbfe372b83f7ff32d545bad1c779348bfe3eea Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 22 Oct 2019 15:01:40 +0300 Subject: [PATCH 02/19] Disabled OS X builds because they are slow on Travis CI. --- .travis.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13bd0d2..9e87746 100644 --- a/.travis.yml +++ b/.travis.yml @@ -319,17 +319,18 @@ matrix: key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" # clang, OS X - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z - osx_image: xcode9.4 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z - osx_image: xcode10.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 - osx_image: xcode11.2 +# Disabled because OS X builds are slow on Travis CI +# - os: osx +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z +# osx_image: xcode9.4 +# +# - os: osx +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z +# osx_image: xcode10.3 +# +# - os: osx +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 +# osx_image: xcode11.2 install: - GIT_FETCH_JOBS=8 From 116cc18560b8550034822f456fe7c4232d8025d0 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 23 Mar 2020 09:35:45 -0400 Subject: [PATCH 03/19] Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. --- include/boost/detail/catch_exceptions.hpp | 2 +- include/boost/detail/named_template_params.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index 823ebd1..f768557 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -26,7 +26,7 @@ #include // for exit codes #include // for ostream -# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551) +# if defined(BOOST_BORLANDC) && (BOOST_BORLANDC <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT # endif diff --git a/include/boost/detail/named_template_params.hpp b/include/boost/detail/named_template_params.hpp index e7cb079..c8ff904 100644 --- a/include/boost/detail/named_template_params.hpp +++ b/include/boost/detail/named_template_params.hpp @@ -13,7 +13,7 @@ #include #include // for is_reference -#if defined(__BORLANDC__) +#if defined(BOOST_BORLANDC) #include #endif @@ -57,7 +57,7 @@ namespace boost { }; }; -#if defined(__BORLANDC__) +#if defined(BOOST_BORLANDC) template struct choose_arg_or_default { typedef choose_arg type; }; template <> @@ -75,7 +75,7 @@ namespace boost { template class resolve_default { -#if defined(__BORLANDC__) +#if defined(BOOST_BORLANDC) typedef typename choose_arg_or_default::type>::type Selector; #else // This usually works for Borland, but I'm seeing weird errors in From 52b610e32b6edb07d54982b278bc24a65da780cc Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 5 May 2020 23:14:53 +0300 Subject: [PATCH 04/19] Added clang-10 jobs to Travis CI. --- .travis.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e87746..a2054a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -305,17 +305,31 @@ matrix: - os: linux dist: xenial - compiler: clang-libc++ - env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + compiler: clang-10 + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 addons: apt: packages: - - clang-9 - - libc++-9-dev - - libc++abi-9-dev + - clang-10 + - libstdc++-9-dev sources: - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-libc++ + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + addons: + apt: + packages: + - clang-10 + - libc++-10-dev + - libc++abi-10-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" # clang, OS X From 3b9267be462f8f5eef8aad29a1060203ba60e76a Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 6 May 2020 11:15:57 -0400 Subject: [PATCH 05/19] Changed because config.hpp is not being included --- include/boost/detail/catch_exceptions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index f768557..7203300 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -26,7 +26,7 @@ #include // for exit codes #include // for ostream -# if defined(BOOST_BORLANDC) && (BOOST_BORLANDC <= 0x0551) +# if defined(__BORLANDC__) && !defined(__clang__) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT # endif From f5bb480082f6bb8badf489d3ced19b645a6aa494 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 6 May 2020 13:16:18 -0400 Subject: [PATCH 06/19] Added boost/config.hpp. --- include/boost/detail/catch_exceptions.hpp | 3 ++- include/boost/detail/named_template_params.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index 7203300..e7639a2 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -18,6 +18,7 @@ // header dependencies are deliberately restricted to the standard library // to reduce coupling to other boost libraries. +#include #include // for string #include // for bad_alloc #include // for bad_cast, bad_typeid @@ -26,7 +27,7 @@ #include // for exit codes #include // for ostream -# if defined(__BORLANDC__) && !defined(__clang__) && (__BORLANDC__ <= 0x0551) +# if defined(BOOST_BORLANDC) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT # endif diff --git a/include/boost/detail/named_template_params.hpp b/include/boost/detail/named_template_params.hpp index c8ff904..7675c4e 100644 --- a/include/boost/detail/named_template_params.hpp +++ b/include/boost/detail/named_template_params.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP #define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP +#include #include #include // for is_reference #if defined(BOOST_BORLANDC) From c281caa89fe2eb66c61235bfc372d055ae7d887a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 6 May 2020 20:31:14 +0300 Subject: [PATCH 07/19] Reordered includes. --- include/boost/detail/catch_exceptions.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index e7639a2..3db832a 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -18,14 +18,14 @@ // header dependencies are deliberately restricted to the standard library // to reduce coupling to other boost libraries. -#include #include // for string #include // for bad_alloc +#include // for ostream #include // for bad_cast, bad_typeid #include // for exception, bad_exception #include // for std exception hierarchy +#include #include // for exit codes -#include // for ostream # if defined(BOOST_BORLANDC) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT From 63f2e170cb666a1c6566a24298ca5cf88b03535f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:14:19 +0300 Subject: [PATCH 08/19] Removed use of deprecated header boost/detail/iterator.hpp. --- include/boost/detail/binary_search.hpp | 48 +++++++++++++------------- include/boost/detail/is_sorted.hpp | 13 ++++--- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/include/boost/detail/binary_search.hpp b/include/boost/detail/binary_search.hpp index 3dca9b6..0591563 100644 --- a/include/boost/detail/binary_search.hpp +++ b/include/boost/detail/binary_search.hpp @@ -1,11 +1,11 @@ -// Copyright (c) 2000 David Abrahams. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// Copyright (c) 2000 David Abrahams. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// +// // Copyright (c) 1994 // Hewlett-Packard Company -// +// // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and @@ -13,10 +13,10 @@ // in supporting documentation. Hewlett-Packard Company makes no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. -// +// // Copyright (c) 1996 // Silicon Graphics Computer Systems, Inc. -// +// // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and @@ -24,22 +24,22 @@ // in supporting documentation. Silicon Graphics makes no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. -// +// #ifndef BINARY_SEARCH_DWA_122600_H_ # define BINARY_SEARCH_DWA_122600_H_ -# include # include +# include namespace boost { namespace detail { template ForwardIter lower_bound(ForwardIter first, ForwardIter last, - const Tp& val) + const Tp& val) { - typedef detail::iterator_traits traits; - - typename traits::difference_type len = boost::detail::distance(first, last); + typedef std::iterator_traits traits; + + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -62,9 +62,9 @@ template ForwardIter lower_bound(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits traits; + typedef std::iterator_traits traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -87,9 +87,9 @@ template ForwardIter upper_bound(ForwardIter first, ForwardIter last, const Tp& val) { - typedef detail::iterator_traits traits; + typedef std::iterator_traits traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -112,9 +112,9 @@ template ForwardIter upper_bound(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits traits; + typedef std::iterator_traits traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -137,9 +137,9 @@ template std::pair equal_range(ForwardIter first, ForwardIter last, const Tp& val) { - typedef detail::iterator_traits traits; + typedef std::iterator_traits traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle, left, right; @@ -169,9 +169,9 @@ std::pair equal_range(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits traits; + typedef std::iterator_traits traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle, left, right; @@ -194,7 +194,7 @@ equal_range(ForwardIter first, ForwardIter last, const Tp& val, } } return std::pair(first, first); -} +} template bool binary_search(ForwardIter first, ForwardIter last, diff --git a/include/boost/detail/is_sorted.hpp b/include/boost/detail/is_sorted.hpp index 5ab32e5..84357f9 100644 --- a/include/boost/detail/is_sorted.hpp +++ b/include/boost/detail/is_sorted.hpp @@ -8,8 +8,7 @@ #ifndef BOOST_DETAIL_SORTED_HPP #define BOOST_DETAIL_SORTED_HPP -#include - +#include #include namespace boost { @@ -31,23 +30,23 @@ inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) { template inline Iterator is_sorted_until (Iterator first, Iterator last) { - typedef typename boost::detail::iterator_traits::value_type + typedef typename std::iterator_traits::value_type value_type; - typedef std::less c; + typedef std::less c; - return ::boost::detail::is_sorted_until(first, last, c()); + return ::boost::detail::is_sorted_until(first, last, c()); } template inline bool is_sorted (Iterator first, Iterator last, Comp c) { return ::boost::detail::is_sorted_until(first, last, c) == last; -} +} template inline bool is_sorted (Iterator first, Iterator last) { return ::boost::detail::is_sorted_until(first, last) == last; -} +} } // detail } // boost From 5f456ffe339c8409ded9dc98cc5520dded1df0a6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:16:58 +0300 Subject: [PATCH 09/19] Converted blank_test to lightweight_test.hpp. --- test/blank_test.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/blank_test.cpp b/test/blank_test.cpp index c1cf033..721aa58 100644 --- a/test/blank_test.cpp +++ b/test/blank_test.cpp @@ -5,28 +5,33 @@ #include #include -#include - +#include +#include +#include +#include #if !defined(BOOST_NO_IOSTREAM) #include #endif -int main() { +int main() +{ BOOST_STATIC_ASSERT((boost::is_pod::value)); BOOST_STATIC_ASSERT((boost::is_empty::value)); BOOST_STATIC_ASSERT((boost::is_stateless::value)); boost::blank b1,b2; - assert(b1 == b2); - assert(b1 <= b2); - assert(b1 >= b2); - assert(!(b1 != b2)); - assert(!(b1 < b2)); - assert(!(b1 > b2)); + BOOST_TEST(b1 == b2); + BOOST_TEST(b1 <= b2); + BOOST_TEST(b1 >= b2); + BOOST_TEST(!(b1 != b2)); + BOOST_TEST(!(b1 < b2)); + BOOST_TEST(!(b1 > b2)); #if !defined(BOOST_NO_IOSTREAM) std::stringstream s; s << "(" << b1 << ")"; - assert(s.str() == "()"); + BOOST_TEST(s.str() == "()"); #endif + + return boost::report_errors(); } From f26a04df6567fb645dd1892955e51dcd096002e4 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:20:53 +0300 Subject: [PATCH 10/19] Converted allocator_utilities_test to lightweight_test.hpp --- test/allocator_utilities_test.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/allocator_utilities_test.cpp b/test/allocator_utilities_test.cpp index 2b06720..def9b4b 100644 --- a/test/allocator_utilities_test.cpp +++ b/test/allocator_utilities_test.cpp @@ -5,14 +5,17 @@ #include #include -#include +#include +#include +#include typedef std::allocator std_int_allocator; typedef boost::detail::allocator::rebind_to::type char_allocator; typedef boost::detail::allocator::rebind_to::type int_allocator; typedef boost::detail::allocator::rebind_to::type char_allocator2; -int main() { +int main() +{ BOOST_STATIC_ASSERT((!boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); @@ -25,7 +28,7 @@ int main() { // Check allocate works okay { char_allocator::pointer p = a2.allocate(10); - assert(p); + BOOST_TEST(!!p); a2.deallocate(p, 10); } @@ -33,8 +36,10 @@ int main() { { int_allocator::pointer p2 = a3.allocate(1); boost::detail::allocator::construct(p2, 25); - assert(*p2 == 25); + BOOST_TEST(*p2 == 25); boost::detail::allocator::destroy(p2); a3.deallocate(p2, 1); } + + return boost::report_errors(); } From be1294c8a80c442ced73992b6a5eb13f115b73ac Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:24:58 +0300 Subject: [PATCH 11/19] Converted binary_search_test to lightweight_test.hpp --- test/binary_search_test.cpp | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/test/binary_search_test.cpp b/test/binary_search_test.cpp index aeecfc0..ee4d6d2 100644 --- a/test/binary_search_test.cpp +++ b/test/binary_search_test.cpp @@ -3,18 +3,19 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include #include #include -#include +#include #include // for rand(). Would use cstdlib but VC6.4 doesn't put it in std:: #include +#include #include -#include #include -#include +#include #if defined(__SGI_STL_PORT) ? defined(__SGI_STL_OWN_IOSTREAMS) : (!defined(__GNUC__) || __GNUC__ > 2) # define USE_SSTREAM @@ -32,7 +33,7 @@ namespace { struct mystring : std::string { typedef std::string base; - + mystring(std::string const& x) : base(x) {} }; @@ -180,13 +181,13 @@ template void test_loop(Sequence& x, Compare cmp, unsigned long test_count) { typedef typename Sequence::const_iterator const_iterator; - + for (unsigned long i = 0; i < test_count; ++i) { random_sorted_sequence(x); const const_iterator start = x.begin(); const const_iterator finish = x.end(); - + unsigned key = random_number(); const const_iterator l = searches::lower_bound(start, finish, key, cmp); const const_iterator u = searches::upper_bound(start, finish, key, cmp); @@ -204,38 +205,40 @@ void test_loop(Sequence& x, Compare cmp, unsigned long test_count) if (p == u) { - assert(found_l); + BOOST_TEST(found_l); found_u = true; } unsigned value = to_int(*p); - assert(value >= last_value); + BOOST_TEST(value >= last_value); last_value = value; if (!found_l) { ++index; - assert(to_int(*p) < key); + BOOST_TEST(to_int(*p) < key); } else if (!found_u) { ++count; - assert(to_int(*p) == key); + BOOST_TEST(to_int(*p) == key); } else - assert(to_int(*p) > key); + { + BOOST_TEST(to_int(*p) > key); + } } - assert(found_l || l == finish); - assert(found_u || u == finish); + BOOST_TEST(found_l || l == finish); + BOOST_TEST(found_u || u == finish); std::pair range = searches::equal_range(start, finish, key, cmp); - assert(range.first == l); - assert(range.second == u); + BOOST_TEST(range.first == l); + BOOST_TEST(range.second == u); bool found = searches::binary_search(start, finish, key, cmp); (void)found; - assert(found == (u != l)); + BOOST_TEST(found == (u != l)); std::cout << "found " << count << " copies of " << key << " at index " << index << "\n"; } } @@ -256,5 +259,6 @@ int main() std::cout << "=== testing bidirectional iterators with compare: ===\n"; test_loop(y, cmp(), 25); std::cerr << "******TEST PASSED******\n"; - return 0; + + return boost::report_errors(); } From 01c1bf1906aaf002987157ed8fa5e9cecd33b8fe Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:27:22 +0300 Subject: [PATCH 12/19] Use more up-to-date location of lightweight_test.hpp --- test/is_sorted_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/is_sorted_test.cpp b/test/is_sorted_test.cpp index f88d91c..58cb31c 100644 --- a/test/is_sorted_test.cpp +++ b/test/is_sorted_test.cpp @@ -5,11 +5,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include #include #include #include -#include -#include +#include template struct tracking_less { From e539c056f6baaaaae005bc7a3b59832f85336ddf Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 22 May 2020 18:39:16 +0300 Subject: [PATCH 13/19] Added gcc 10 build jobs to Travis CI. --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index a2054a0..b4b3e0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,6 +134,17 @@ matrix: sources: - sourceline: "ppa:ubuntu-toolchain-r/test" + - os: linux + dist: bionic + compiler: gcc-10 + env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 + addons: + apt: + packages: + - g++-10 + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + # clang, Linux - os: linux dist: trusty From 4bb5ef3b3854d274fdbe1f811c90f481a31ce4a0 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 23 May 2020 18:36:02 +0300 Subject: [PATCH 14/19] Added a workaround for C++20 ostream having deleted operator<< for wchar_t. --- test/numeric_traits_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/numeric_traits_test.cpp b/test/numeric_traits_test.cpp index c22cc6f..197f61f 100644 --- a/test/numeric_traits_test.cpp +++ b/test/numeric_traits_test.cpp @@ -154,6 +154,12 @@ template <> struct stream_as { typedef unsigned char t1; typedef unsigned t2; }; +// C++20 ostream has deleted operator<< for wchar_t +template <> struct stream_as { + typedef unsigned int t1; + typedef unsigned int t2; +}; + #if defined(BOOST_MSVC_STD_ITERATOR) // No intmax streaming built-in // With this library implementation, __int64 and __uint64 get streamed as strings From d3da3ed0706f106f1a6e5e2d837843ac9c1d144d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 23 May 2020 18:45:20 +0300 Subject: [PATCH 15/19] Added a workaround for removed nested typedefs in std::allocator. --- test/allocator_utilities_test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/allocator_utilities_test.cpp b/test/allocator_utilities_test.cpp index def9b4b..781d60b 100644 --- a/test/allocator_utilities_test.cpp +++ b/test/allocator_utilities_test.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -27,14 +28,14 @@ int main() // Check allocate works okay { - char_allocator::pointer p = a2.allocate(10); + boost::allocator_pointer::type p = a2.allocate(10); BOOST_TEST(!!p); a2.deallocate(p, 10); } // Try using the standalone construct/destroy { - int_allocator::pointer p2 = a3.allocate(1); + boost::allocator_pointer::type p2 = a3.allocate(1); boost::detail::allocator::construct(p2, 25); BOOST_TEST(*p2 == 25); boost::detail::allocator::destroy(p2); From 5d285a2d5a561308ad6703e1ff284d106eb01032 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 23 May 2020 19:02:45 +0300 Subject: [PATCH 16/19] Disabled libstdc++ debug mode to work around gcc 10.1 bug. The debug mode fails to compile in C++11 mode because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95289. --- test/Jamfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Jamfile b/test/Jamfile index b389925..c3f1aea 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -14,7 +14,8 @@ project detail/test clang:-ftemplate-depth-300 gcc:-ftemplate-depth-300 gcc:_STLP_DEBUG - gcc:_GLIBCXX_DEBUG + # Do not enable libstdc++ debug mode because of gcc 10.1 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95289 + # gcc:_GLIBCXX_DEBUG darwin:-ftemplate-depth-300 ; From 99fc546b78ac37f80628cc916dcfab7801329baa Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Tue, 26 Jan 2021 15:53:19 -0500 Subject: [PATCH 17/19] Update maintainer list --- meta/libraries.json | 1 - 1 file changed, 1 deletion(-) diff --git a/meta/libraries.json b/meta/libraries.json index 5c1aa00..19784f5 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -19,7 +19,6 @@ "Miscellaneous" ], "maintainers": [ - "Beman Dawes ", "Robert Ramey ", "Rene Rivera ", "Andrey Semashev " From 131208d8ccd82ef69afb9cf0bad1a314bd931d88 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 17 Mar 2021 14:12:36 +0300 Subject: [PATCH 18/19] Fixed out-of-bounds access in utf8_codecvt_facet::do_length. The loop in do_length used to dereference from_end pointer, which could point to an out-of-bounds memory. Rewritten the loop to avoid this and also make the logic a bit more clear. Closes https://github.com/boostorg/detail/pull/21. --- include/boost/detail/utf8_codecvt_facet.ipp | 29 +++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/include/boost/detail/utf8_codecvt_facet.ipp b/include/boost/detail/utf8_codecvt_facet.ipp index 24eb61a..564743f 100644 --- a/include/boost/detail/utf8_codecvt_facet.ipp +++ b/include/boost/detail/utf8_codecvt_facet.ipp @@ -188,26 +188,17 @@ int utf8_codecvt_facet::do_length( #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) throw() #endif -{ - // RG - this code is confusing! I need a better way to express it. - // and test cases. - - // Invariants: - // 1) last_octet_count has the size of the last measured character - // 2) char_count holds the number of characters shown to fit - // within the bounds so far (no greater than max_limit) - // 3) from_next points to the octet 'last_octet_count' before the - // last measured character. - int last_octet_count=0; - std::size_t char_count = 0; - const char* from_next = from; - // Use "<" because the buffer may represent incomplete characters - while (from_next+last_octet_count <= from_end && char_count <= max_limit) { - from_next += last_octet_count; - last_octet_count = (get_octet_count(*from_next)); - ++char_count; +{ + const char * from_next = from; + for (std::size_t char_count = 0u; char_count < max_limit && from_next < from_end; ++char_count) { + unsigned int octet_count = get_octet_count(*from_next); + // The buffer may represent incomplete characters, so terminate early if one is found + if (octet_count > static_cast(from_end - from_next)) + break; + from_next += octet_count; } - return static_cast(from_next-from); + + return static_cast(from_next - from); } unsigned int utf8_codecvt_facet::get_octet_count( From a01fe6d57b906edf0400daebfb5ea88bb4582f44 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 10 Jun 2021 01:15:48 +0300 Subject: [PATCH 19/19] Update CMakeLists.txt --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e122d4..8ea9396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,9 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt -# Partial (add_subdirectory only) and experimental CMake support -# Subject to change; please do not rely on the contents of this file yet. +cmake_minimum_required(VERSION 3.5...3.20) -cmake_minimum_required(VERSION 3.5) - -project(BoostDetail LANGUAGES CXX) +project(boost_detail VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) add_library(boost_detail INTERFACE) add_library(Boost::detail ALIAS boost_detail)