mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-10-04 19:51:02 +02:00
Compare commits
10 Commits
feature/re
...
boost-1.73
Author | SHA1 | Date | |
---|---|---|---|
|
54b5498208 | ||
|
da81452f1f | ||
|
7b9a969215 | ||
|
91cd83e5bf | ||
|
2fdb8c4b0a | ||
|
e806b53433 | ||
|
e0c7bd9a7e | ||
|
766ab05a12 | ||
|
05cbefd28e | ||
|
bfbdf4f45f |
92
.travis.yml
92
.travis.yml
@@ -1,12 +1,10 @@
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# Copyright 2016-2020 Peter Dimov
|
||||
# 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)
|
||||
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
|
||||
branches:
|
||||
only:
|
||||
@@ -25,8 +23,19 @@ matrix:
|
||||
|
||||
include:
|
||||
- os: linux
|
||||
arch: arm64
|
||||
compiler: g++
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14
|
||||
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
compiler: g++
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14
|
||||
|
||||
- os: linux
|
||||
arch: s390x
|
||||
compiler: g++
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.4
|
||||
@@ -158,10 +167,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||
addons:
|
||||
@@ -170,6 +176,7 @@ matrix:
|
||||
- clang-3.3
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||
addons:
|
||||
@@ -179,15 +186,13 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.5
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.5
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.6
|
||||
@@ -198,7 +203,6 @@ matrix:
|
||||
- clang-3.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.7
|
||||
@@ -209,7 +213,6 @@ matrix:
|
||||
- clang-3.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.8
|
||||
@@ -218,10 +221,8 @@ matrix:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.9
|
||||
@@ -230,10 +231,8 @@ matrix:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-4.0
|
||||
@@ -244,7 +243,6 @@ matrix:
|
||||
- clang-4.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-4.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-5.0
|
||||
@@ -255,7 +253,6 @@ matrix:
|
||||
- clang-5.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-6.0
|
||||
@@ -266,7 +263,6 @@ matrix:
|
||||
- clang-6.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-7
|
||||
@@ -277,7 +273,7 @@ matrix:
|
||||
- clang-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
- llvm-toolchain-xenial-7
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-8
|
||||
@@ -288,21 +284,34 @@ matrix:
|
||||
- clang-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-8
|
||||
- llvm-toolchain-xenial-8
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-7
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
|
||||
dist: xenial
|
||||
compiler: clang++-9
|
||||
env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-7
|
||||
- libstdc++-5-dev
|
||||
- clang-9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-8
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-xenial-8
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: clang++-libc++
|
||||
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
@@ -311,6 +320,7 @@ matrix:
|
||||
- libc++-dev
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: clang++-libc++
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
addons:
|
||||
@@ -322,6 +332,17 @@ matrix:
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
|
||||
- os: linux
|
||||
env: CMAKE_TEST=1
|
||||
script:
|
||||
- mkdir __build__ && cd __build__
|
||||
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr -DBUILD_TESTING=ON ..
|
||||
- ctest --output-on-failure -R boost_smart_ptr
|
||||
|
||||
- os: linux
|
||||
compiler: g++
|
||||
env: CMAKE_SUBDIR_TEST=1
|
||||
@@ -331,6 +352,17 @@ matrix:
|
||||
- cmake --build .
|
||||
- cmake --build . --target check
|
||||
|
||||
- os: linux
|
||||
env: CMAKE_INSTALL_TEST=1
|
||||
script:
|
||||
- mkdir __build__ && cd __build__
|
||||
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
- cmake --build . --target install
|
||||
- cd ../libs/smart_ptr/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
- cmake --build .
|
||||
- cmake --build . --target check
|
||||
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- cd ..
|
||||
@@ -352,7 +384,9 @@ install:
|
||||
- git submodule init tools/build
|
||||
- git submodule init libs/headers
|
||||
- git submodule init tools/boost_install
|
||||
- git submodule update --jobs 3
|
||||
- git submodule init tools/cmake
|
||||
- git submodule init libs/preprocessor
|
||||
- git submodule update # no --jobs 3 on non-amd64
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/smart_ptr
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
@@ -1,12 +1,10 @@
|
||||
# Copyright 2018 Mike Dev
|
||||
# Copyright 2018-2020 Peter Dimov
|
||||
# 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
|
||||
|
||||
# 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.16)
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(BoostSmartPtr LANGUAGES CXX)
|
||||
project(boost_smart_ptr VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
add_library(boost_smart_ptr INTERFACE)
|
||||
add_library(Boost::smart_ptr ALIAS boost_smart_ptr)
|
||||
@@ -14,13 +12,25 @@ add_library(Boost::smart_ptr ALIAS boost_smart_ptr)
|
||||
target_include_directories(boost_smart_ptr INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_smart_ptr
|
||||
INTERFACE
|
||||
Boost::assert
|
||||
Boost::config
|
||||
Boost::core
|
||||
Boost::move
|
||||
Boost::predef
|
||||
Boost::static_assert
|
||||
Boost::throw_exception
|
||||
Boost::type_traits
|
||||
INTERFACE
|
||||
Boost::assert
|
||||
Boost::config
|
||||
Boost::core
|
||||
Boost::move
|
||||
Boost::static_assert
|
||||
Boost::throw_exception
|
||||
Boost::type_traits
|
||||
)
|
||||
|
||||
if(BOOST_SUPERPROJECT_VERSION)
|
||||
|
||||
include(BoostInstall)
|
||||
boost_install(TARGETS boost_smart_ptr HEADER_DIRECTORY include/)
|
||||
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
@@ -106,7 +106,7 @@ template<class T>
|
||||
+
|
||||
Constraints:: `T` is not an array.
|
||||
Returns:: `std::unique_ptr<T>(new T)`.
|
||||
Example:: `auto p = make_unique_noinit<double[1024]>();`
|
||||
Example:: `auto p = make_unique_noinit<std::array<double, 1024> >();`
|
||||
|
||||
```
|
||||
template<class T>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
// enable_shared_from.hpp
|
||||
//
|
||||
// Copyright 2019 Peter Dimov
|
||||
// Copyright 2019, 2020 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -19,17 +19,21 @@ namespace boost
|
||||
|
||||
class enable_shared_from: public enable_shared_from_this<enable_shared_from>
|
||||
{
|
||||
private:
|
||||
|
||||
using enable_shared_from_this<enable_shared_from>::shared_from_this;
|
||||
using enable_shared_from_this<enable_shared_from>::weak_from_this;
|
||||
};
|
||||
|
||||
|
||||
template<class T> shared_ptr<T> shared_from( T * p )
|
||||
{
|
||||
return shared_ptr<T>( p->enable_shared_from::shared_from_this(), p );
|
||||
return shared_ptr<T>( p->enable_shared_from_this<enable_shared_from>::shared_from_this(), p );
|
||||
}
|
||||
|
||||
template<class T> weak_ptr<T> weak_from( T * p ) BOOST_SP_NOEXCEPT
|
||||
{
|
||||
return weak_ptr<T>( p->enable_shared_from::weak_from_this(), p );
|
||||
return weak_ptr<T>( p->enable_shared_from_this<enable_shared_from>::weak_from_this(), p );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
@@ -1175,6 +1175,13 @@ template<class D, class T> D const * basic_get_local_deleter( D const *, shared_
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if defined(__cpp_deduction_guides)
|
||||
|
||||
template<class T> shared_ptr( weak_ptr<T> ) -> shared_ptr<T>;
|
||||
template<class T, class D> shared_ptr( std::unique_ptr<T, D> ) -> shared_ptr<T>;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if defined( BOOST_SP_DISABLE_DEPRECATED )
|
||||
|
@@ -264,6 +264,12 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_SP_NOEXCEPT
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#if defined(__cpp_deduction_guides)
|
||||
|
||||
template<class T> weak_ptr( shared_ptr<T> ) -> weak_ptr<T>;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
|
||||
|
15
test/CMakeLists.txt
Normal file
15
test/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# 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
|
||||
|
||||
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||
|
||||
if(HAVE_BOOST_TEST)
|
||||
|
||||
# for lw_thread_test.cpp
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
|
||||
boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::smart_ptr Boost::core Boost::align Boost::atomic Boost::container_hash Threads::Threads)
|
||||
|
||||
endif()
|
70
test/Jamfile
70
test/Jamfile
@@ -57,10 +57,11 @@ run yield_k_test.cpp : : : <threading>multi : yield_k_test.mt ;
|
||||
run spinlock_test.cpp ;
|
||||
run spinlock_try_test.cpp ;
|
||||
run spinlock_try_test.cpp : : : <threading>multi : spinlock_try_test.mt ;
|
||||
run spinlock_pool_test.cpp : : :
|
||||
# msvc-8.0, 9.0 optimizer codegen bug for `x % 41`
|
||||
<toolset>msvc-8.0,<variant>release:<build>no
|
||||
<toolset>msvc-9.0,<variant>release:<build>no ;
|
||||
run spinlock_pool_test.cpp
|
||||
: : :
|
||||
# msvc-8.0, 9.0 optimizer codegen bug for `x % 41`
|
||||
<toolset>msvc-8.0,<variant>release:<build>no
|
||||
<toolset>msvc-9.0,<variant>release:<build>no ;
|
||||
|
||||
run make_shared_test.cpp ;
|
||||
run make_shared_move_emulation_test.cpp ;
|
||||
@@ -78,7 +79,10 @@ run sp_recursive_assign_test.cpp ;
|
||||
run sp_recursive_assign2_test.cpp ;
|
||||
run sp_recursive_assign_rv_test.cpp ;
|
||||
run sp_recursive_assign2_rv_test.cpp ;
|
||||
compile-fail auto_ptr_lv_fail.cpp : <toolset>gcc-4.4.7:<build>no ;
|
||||
|
||||
compile-fail auto_ptr_lv_fail.cpp
|
||||
: <toolset>gcc-4.4.7:<build>no ;
|
||||
|
||||
run atomic_count_test2.cpp ;
|
||||
run sp_typeinfo_test.cpp ;
|
||||
compile make_shared_fp_test.cpp ;
|
||||
@@ -158,23 +162,33 @@ compile-fail array_fail_dereference.cpp ;
|
||||
compile-fail array_fail_member_access.cpp ;
|
||||
compile-fail array_fail_array_access.cpp ;
|
||||
|
||||
run make_shared_array_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
|
||||
run make_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_arrays_test.cpp ;
|
||||
run make_shared_array_throws_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_esft_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_noinit_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_value_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_test.cpp ;
|
||||
run allocate_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
|
||||
run allocate_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_arrays_test.cpp ;
|
||||
run allocate_shared_array_throws_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_esft_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_noinit_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_value_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
run allocate_shared_array_construct_test.cpp ;
|
||||
|
||||
run make_unique_test.cpp ;
|
||||
run make_unique_args_test.cpp ;
|
||||
run make_unique_value_test.cpp : : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ;
|
||||
run make_unique_value_test.cpp
|
||||
: : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ;
|
||||
run make_unique_noinit_test.cpp ;
|
||||
run make_unique_throws_test.cpp ;
|
||||
run make_unique_array_test.cpp ;
|
||||
@@ -236,7 +250,8 @@ run shared_ptr_fn_test.cpp ;
|
||||
run get_deleter_test2.cpp ;
|
||||
run get_deleter_test3.cpp ;
|
||||
run get_deleter_array_test2.cpp ;
|
||||
run get_deleter_array_test3.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run get_deleter_array_test3.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
|
||||
run sp_convertible_test2.cpp ;
|
||||
|
||||
@@ -258,13 +273,15 @@ run allocate_local_shared_test.cpp ;
|
||||
run allocate_local_shared_esft_test.cpp ;
|
||||
|
||||
run make_local_shared_array_test.cpp ;
|
||||
run make_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
|
||||
run make_local_shared_arrays_test.cpp
|
||||
: : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
|
||||
run make_local_shared_array_throws_test.cpp ;
|
||||
run make_local_shared_array_esft_test.cpp ;
|
||||
run make_local_shared_array_noinit_test.cpp ;
|
||||
run make_local_shared_array_value_test.cpp ;
|
||||
run allocate_local_shared_array_test.cpp ;
|
||||
run allocate_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
|
||||
run allocate_local_shared_arrays_test.cpp
|
||||
: : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
|
||||
run allocate_local_shared_array_throws_test.cpp ;
|
||||
run allocate_local_shared_array_esft_test.cpp ;
|
||||
run allocate_local_shared_array_noinit_test.cpp ;
|
||||
@@ -275,9 +292,11 @@ run local_sp_fn_test.cpp ;
|
||||
run lsp_convertible_test.cpp ;
|
||||
run lsp_convertible_test2.cpp ;
|
||||
|
||||
run make_shared_array_tmp_test.cpp : : : <toolset>msvc-8.0:<build>no ;
|
||||
run make_shared_array_tmp_test.cpp
|
||||
: : : <toolset>msvc-8.0:<build>no ;
|
||||
|
||||
run lw_thread_test.cpp : : : <threading>multi ;
|
||||
run lw_thread_test.cpp
|
||||
: : : <threading>multi ;
|
||||
|
||||
compile sp_windows_h_test.cpp ;
|
||||
compile spinlock_windows_h_test.cpp ;
|
||||
@@ -333,3 +352,10 @@ run allocate_unique_noinit_test.cpp ;
|
||||
run allocate_unique_test.cpp ;
|
||||
run allocate_unique_throws_test.cpp ;
|
||||
run allocate_unique_value_test.cpp ;
|
||||
|
||||
run sp_guides_test.cpp ;
|
||||
run sp_guides_test2.cpp ;
|
||||
run wp_guides_test.cpp ;
|
||||
|
||||
compile-fail shared_from_fail.cpp ;
|
||||
compile-fail weak_from_fail.cpp ;
|
||||
|
18
test/cmake_install_test/CMakeLists.txt
Normal file
18
test/cmake_install_test/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# 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
|
||||
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
find_package(boost_smart_ptr REQUIRED)
|
||||
find_package(boost_core REQUIRED)
|
||||
|
||||
add_executable(quick ../quick.cpp)
|
||||
target_link_libraries(quick Boost::smart_ptr Boost::core)
|
||||
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
@@ -2,7 +2,7 @@
|
||||
# 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
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
@@ -11,7 +11,6 @@ add_subdirectory(../../../assert boostorg/assert)
|
||||
add_subdirectory(../../../config boostorg/config)
|
||||
add_subdirectory(../../../core boostorg/core)
|
||||
add_subdirectory(../../../move boostorg/move)
|
||||
add_subdirectory(../../../predef boostorg/predef)
|
||||
add_subdirectory(../../../static_assert boostorg/static_assert)
|
||||
add_subdirectory(../../../throw_exception boostorg/throw_exception)
|
||||
add_subdirectory(../../../type_traits boostorg/type_traits)
|
||||
|
22
test/shared_from_fail.cpp
Normal file
22
test/shared_from_fail.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/smart_ptr/enable_shared_from.hpp>
|
||||
|
||||
struct X: public boost::enable_shared_from
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(__clang__) && defined(_MSC_VER)
|
||||
// clang-cl claims that it accepts this code for compatibility
|
||||
// with msvc, but no version of msvc accepts it
|
||||
# pragma clang diagnostic error "-Wmicrosoft-using-decl"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::shared_ptr<X> px( new X );
|
||||
px->shared_from_this();
|
||||
}
|
25
test/sp_guides_test.cpp
Normal file
25
test/sp_guides_test.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#if defined(__cpp_deduction_guides)
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::shared_ptr<int> p1( new int );
|
||||
boost::weak_ptr<int> p2( p1 );
|
||||
boost::shared_ptr p3( p2 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
|
||||
|
||||
int main() {}
|
||||
|
||||
#endif
|
23
test/sp_guides_test2.cpp
Normal file
23
test/sp_guides_test2.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#if defined(__cpp_deduction_guides)
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::shared_ptr p2( std::unique_ptr<int>( new int ) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
|
||||
|
||||
int main() {}
|
||||
|
||||
#endif
|
22
test/weak_from_fail.cpp
Normal file
22
test/weak_from_fail.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/smart_ptr/enable_shared_from.hpp>
|
||||
|
||||
struct X: public boost::enable_shared_from
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(__clang__) && defined(_MSC_VER)
|
||||
// clang-cl claims that it accepts this code for compatibility
|
||||
// with msvc, but no version of msvc accepts it
|
||||
# pragma clang diagnostic error "-Wmicrosoft-using-decl"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::shared_ptr<X> px( new X );
|
||||
px->weak_from_this();
|
||||
}
|
24
test/wp_guides_test.cpp
Normal file
24
test/wp_guides_test.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#if defined(__cpp_deduction_guides)
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::shared_ptr<int> p1( new int );
|
||||
boost::weak_ptr p2( p1 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
|
||||
|
||||
int main() {}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user