diff --git a/.travis.yml b/.travis.yml index fc68de4..b4b3e0f 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,45 @@ 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" - os: linux - compiler: /usr/bin/clang++ - env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11 + 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 + 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 +171,191 @@ 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: osx - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z + - 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-10 + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 + addons: + apt: + packages: + - clang-10 + - libstdc++-9-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" + + - 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 +# 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 @@ -271,7 +379,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: 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) 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/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index 823ebd1..3db832a 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -20,13 +20,14 @@ // to reduce coupling to other boost libraries. #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(__BORLANDC__) && (__BORLANDC__ <= 0x0551) +# if defined(BOOST_BORLANDC) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT # endif 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 diff --git a/include/boost/detail/named_template_params.hpp b/include/boost/detail/named_template_params.hpp index e7cb079..7675c4e 100644 --- a/include/boost/detail/named_template_params.hpp +++ b/include/boost/detail/named_template_params.hpp @@ -11,9 +11,10 @@ #ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP #define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP +#include #include #include // for is_reference -#if defined(__BORLANDC__) +#if defined(BOOST_BORLANDC) #include #endif @@ -57,7 +58,7 @@ namespace boost { }; }; -#if defined(__BORLANDC__) +#if defined(BOOST_BORLANDC) template struct choose_arg_or_default { typedef choose_arg type; }; template <> @@ -75,7 +76,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 diff --git a/include/boost/detail/utf8_codecvt_facet.ipp b/include/boost/detail/utf8_codecvt_facet.ipp index f8f1cbc..f9e9deb 100644 --- a/include/boost/detail/utf8_codecvt_facet.ipp +++ b/include/boost/detail/utf8_codecvt_facet.ipp @@ -188,26 +188,17 @@ BOOST_UTF8_DECL 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); } BOOST_UTF8_DECL unsigned int utf8_codecvt_facet::get_octet_count( 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 " 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 ; diff --git a/test/allocator_utilities_test.cpp b/test/allocator_utilities_test.cpp index 2b06720..781d60b 100644 --- a/test/allocator_utilities_test.cpp +++ b/test/allocator_utilities_test.cpp @@ -5,14 +5,18 @@ #include #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)); @@ -24,17 +28,19 @@ int main() { // Check allocate works okay { - char_allocator::pointer p = a2.allocate(10); - assert(p); + 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); - assert(*p2 == 25); + BOOST_TEST(*p2 == 25); boost::detail::allocator::destroy(p2); a3.deallocate(p2, 1); } + + return boost::report_errors(); } 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(); } 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(); } 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 { 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