Compare commits

...

5 Commits

Author SHA1 Message Date
ae5d7d8c0c Added a CMake test. 2023-11-17 17:47:20 +03:00
d72d57fa39 Removed dependency on Boost.Conversion in CMakeLists.txt.
Fixes https://github.com/boostorg/iterator/issues/81.
2023-11-17 17:24:02 +03:00
c98f965388 Use gcc-11 libstdc++ for clang-12 through 15. 2023-11-17 11:06:21 +03:00
d09f78ae9b Removed C++03 CI jobs. 2023-11-17 04:46:21 +03:00
a9dabd3c65 Removed dependency on Boost.Conversion in tests.
This reduces the minimum supported compilers versions.
2023-11-17 04:25:29 +03:00
7 changed files with 166 additions and 59 deletions

View File

@ -33,16 +33,8 @@ jobs:
matrix:
include:
# Linux, gcc
- toolset: gcc-4.4
cxxstd: "98,0x"
os: ubuntu-latest
container: ubuntu:16.04
install:
- g++-4.4
sources:
- "ppa:ubuntu-toolchain-r/test"
- toolset: gcc-4.6
cxxstd: "03,0x"
cxxstd: "0x"
os: ubuntu-latest
container: ubuntu:16.04
install:
@ -50,70 +42,70 @@ jobs:
sources:
- "ppa:ubuntu-toolchain-r/test"
- toolset: gcc-4.7
cxxstd: "03,11"
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:16.04
install:
- g++-4.7
- toolset: gcc-4.8
cxxstd: "03,11"
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-4.8
- toolset: gcc-4.9
cxxstd: "03,11"
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:16.04
install:
- g++-4.9
- toolset: gcc-5
cxxstd: "03,11,14,1z"
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:16.04
install:
- g++-5
- toolset: gcc-6
cxxstd: "03,11,14,1z"
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-6
- toolset: gcc-7
cxxstd: "03,11,14,17"
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-7
- toolset: gcc-8
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-8
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
install:
- g++-9
- toolset: gcc-10
cxxstd: "03,11,14,17,20"
cxxstd: "11,14,17,20"
os: ubuntu-20.04
install:
- g++-10
- toolset: gcc-11
cxxstd: "03,11,14,17,20,23"
cxxstd: "11,14,17,20,23"
os: ubuntu-22.04
install:
- g++-11
- toolset: gcc-12
cxxstd: "03,11,14,17,20,23"
cxxstd: "11,14,17,20,23"
os: ubuntu-22.04
install:
- g++-12
- name: UBSAN
toolset: gcc-11
cxxstd: "03,11,14,17,20,23"
cxxstd: "11,14,17,20,23"
ubsan: 1
build_variant: debug
os: ubuntu-22.04
@ -123,63 +115,63 @@ jobs:
# Linux, clang
- toolset: clang
compiler: clang++-3.5
cxxstd: "03,11"
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.5
- toolset: clang
compiler: clang++-3.6
cxxstd: "03,11,14"
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.6
- toolset: clang
compiler: clang++-3.7
cxxstd: "03,11,14"
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.7
- toolset: clang
compiler: clang++-3.8
cxxstd: "03,11,14"
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.8
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "03,11,14,17"
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "03,11,14,17"
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:18.04
install:
@ -187,7 +179,7 @@ jobs:
# Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
- toolset: clang
compiler: clang++-8
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:18.04
install:
@ -196,49 +188,57 @@ jobs:
gcc_toolchain: 7
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
install:
- clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,20"
cxxstd: "11,14,17,20"
os: ubuntu-20.04
install:
- clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,20"
cxxstd: "11,14,17,20"
os: ubuntu-22.04
install:
- clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-12
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-13
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-13
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-14
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-14
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-15
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-15
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-15
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-15
@ -248,7 +248,7 @@ jobs:
linkflags: -stdlib=libc++
- toolset: clang
compiler: clang++-16
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-16
@ -258,7 +258,7 @@ jobs:
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
- toolset: clang
compiler: clang++-16
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-16
@ -273,7 +273,7 @@ jobs:
- name: UBSAN
toolset: clang
compiler: clang++-15
cxxstd: "03,11,14,17,20,2b"
cxxstd: "11,14,17,20,2b"
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
ubsan: 1
@ -285,9 +285,13 @@ jobs:
- libc++abi-15-dev
- toolset: clang
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
os: macos-11
- name: CMake tests
cmake_tests: 1
os: ubuntu-20.04
timeout-minutes: 60
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
@ -486,3 +490,19 @@ jobs:
fi
B2_ARGS+=("libs/$LIBRARY/test")
./b2 "${B2_ARGS[@]}"
- name: Run CMake tests
if: matrix.cmake_tests
run: |
if [ -n "${{matrix.macosx_version_min}}" ]
then
export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}"
fi
cd ../boost-root
mkdir __build_static__ && cd __build_static__
cmake ../libs/$LIBRARY/test/test_cmake
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
cd ..
mkdir __build_shared__ && cd __build_shared__
cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS

View File

@ -17,7 +17,6 @@ target_link_libraries(boost_iterator
Boost::assert
Boost::concept_check
Boost::config
Boost::conversion
Boost::core
Boost::detail
Boost::function_types

View File

@ -15,9 +15,6 @@ branches:
environment:
matrix:
- TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
ADDRMD: 32
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: msvc-12.0
ADDRMD: 32,64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
@ -42,25 +39,27 @@ environment:
CXXSTD: 14,17,latest
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
CXXSTD: 11,14,1z
ADDPATH: C:\cygwin\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
CXXSTD: 11,14,1z
ADDPATH: C:\cygwin64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
CXXSTD: 11,14,1z
ADDPATH: C:\mingw\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
CXXSTD: 11,14,1z
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
CXXSTD: 11,14,1z
ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TEST_CMAKE: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
install:
- set GIT_FETCH_JOBS=8
@ -87,3 +86,17 @@ test_script:
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% %ADDRMD%
for:
- matrix:
only: [TEST_CMAKE: 1]
test_script:
- mkdir __build_static__
- cd __build_static__
- cmake ../libs/iterator/test/test_cmake
- cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS%
- cd ..
- mkdir __build_shared__
- cd __build_shared__
- cmake -DBUILD_SHARED_LIBS=On ../libs/iterator/test/test_cmake
- cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS%

View File

@ -22,7 +22,6 @@
# include <iterator>
# include <boost/static_assert.hpp>
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
# include <boost/implicit_cast.hpp>
# include <boost/core/ignore_unused.hpp>
# include <boost/core/lightweight_test.hpp>
# include <boost/type_traits/is_same.hpp>
@ -223,12 +222,15 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
int c;
typedef typename std::iterator_traits<Iterator>::value_type value_type;
boost::ignore_unused<value_type>();
struct local
{
static value_type to_value_type(value_type v) { return v; }
};
for (c = 0; c < N-1; ++c) {
BOOST_TEST(i == j + c);
BOOST_TEST(*i == vals[c]);
BOOST_TEST(*i == boost::implicit_cast<value_type>(j[c]));
BOOST_TEST(*i == local::to_value_type(j[c]));
BOOST_TEST(*i == *(j + c));
BOOST_TEST(*i == *(c + j));
++i;
@ -242,7 +244,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
for (c = 0; c < N-1; ++c) {
BOOST_TEST(i == k - c);
BOOST_TEST(*i == vals[N - 1 - c]);
BOOST_TEST(*i == boost::implicit_cast<value_type>(j[N - 1 - c]));
BOOST_TEST(*i == local::to_value_type(j[N - 1 - c]));
Iterator q = k - c;
boost::ignore_unused(q);
BOOST_TEST(*i == *q);

View File

@ -8,7 +8,6 @@
#include <boost/iterator/new_iterator_tests.hpp>
#include <boost/call_traits.hpp>
#include <boost/polymorphic_cast.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/core/enable_if.hpp>
@ -188,12 +187,12 @@ struct derived : base
virtual void assign(const base &b)
{
state = boost::polymorphic_cast<const derived *>(&b)->state;
state = dynamic_cast<const derived &>(b).state;
}
virtual bool equal(const base &b) const
{
return state == boost::polymorphic_cast<const derived *>(&b)->state;
return state == dynamic_cast<const derived &>(b).state;
}
int state;

View File

@ -0,0 +1,20 @@
# Copyright 2023 Andrey Semashev
#
# 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
#
# NOTE: This does NOT run the unit tests for Boost.Atomic.
# It only tests if the CMakeLists.txt file in its root works as expected
cmake_minimum_required(VERSION 3.5)
project(BoostIteratorCMakeSelfTest)
# Use experimental superproject to pull library dependencies recursively
set(BOOST_ENABLE_CMAKE 1)
add_subdirectory(../../../.. "${CMAKE_CURRENT_BINARY_DIR}/boost_superproject")
add_definitions(-DBOOST_ALL_NO_LIB)
add_executable(boost_iterator_cmake_self_test main.cpp)
target_link_libraries(boost_iterator_cmake_self_test Boost::iterator)

54
test/test_cmake/main.cpp Normal file
View File

@ -0,0 +1,54 @@
// Copyright (c) 2023 Andrey Semashev
//
// 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)
#include <boost/generator_iterator.hpp>
#include <boost/indirect_reference.hpp>
#include <boost/next_prior.hpp>
#include <boost/pointee.hpp>
#include <boost/shared_container_iterator.hpp>
#include <boost/iterator/advance.hpp>
#include <boost/iterator/counting_iterator.hpp>
#include <boost/iterator/distance.hpp>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/iterator/function_input_iterator.hpp>
#include <boost/iterator/function_output_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
#include <boost/iterator/interoperable.hpp>
#include <boost/iterator/is_iterator.hpp>
#include <boost/iterator/is_lvalue_iterator.hpp>
#include <boost/iterator/is_readable_iterator.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_archetypes.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_concepts.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/iterator/minimum_category.hpp>
#include <boost/iterator/new_iterator_tests.hpp>
#include <boost/iterator/permutation_iterator.hpp>
#include <boost/iterator/reverse_iterator.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/zip_iterator.hpp>
template< typename Iterator >
class adapted_iterator :
public boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator >
{
friend class iterator_core_access;
private:
typedef boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > base_type;
public:
explicit adapted_iterator(Iterator it) : base_type(it) {}
};
int main()
{
unsigned char buf[8];
adapted_iterator< unsigned char* > b(buf), e(buf + sizeof(buf));
return boost::iterators::distance(b, e) == static_cast< adapted_iterator< unsigned char* >::difference_type >(sizeof(buf));
}