Compare commits

...

92 Commits

Author SHA1 Message Date
Peter Dimov
5f95fe9848 Fix .travis.yml 2019-01-06 04:37:59 +02:00
Peter Dimov
599d0bbba9 Add test/cmake_subdir_test 2019-01-05 19:43:22 +02:00
Peter Dimov
f769217ca8 Update CMakeLists.txt 2019-01-04 19:40:30 +02:00
Mike Dev
5d5d28a92e [CMake] Generate cmake target that other libraries can use
... to express their dependency on this library and retrieve any
configuration information such as the include directory and
transitive dependencies.
2019-01-02 22:32:38 +01:00
Peter Dimov
85fd341402 Merge pull request #59 from Kojoley/patch-1
Do not include the whole Predef for a single macro
2018-12-29 02:24:02 +02:00
Nikita Kniazev
eac6411867 Do not include the whole Predef for a single macro 2018-12-28 03:03:02 +03:00
Peter Dimov
97ef7970e8 Remove VARIANT from .travis.yml 2018-12-23 16:44:03 +02:00
Peter Dimov
4baa21dd5e Add libstdc++-5 for clang 7-ubsan 2018-12-23 08:17:32 +02:00
Peter Dimov
d0a89a81f0 More g++ warning suppression 2018-12-23 06:21:55 +02:00
Peter Dimov
ab2b977e4a Update clang-5 ubsan to clang-7 2018-12-23 05:19:07 +02:00
Peter Dimov
f380d4466c Avoid some g++ warnings in shared_ptr_test 2018-12-23 05:06:24 +02:00
Peter Dimov
2932ca4203 Change sp_counted_base_nt/_pt to use boost::int_least32_t instead of long (which may be 64 bit) 2018-12-23 01:54:36 +02:00
Peter Dimov
660d26c2c3 Change 03/11 to 98/0x for gcc 4.4 2018-12-23 00:08:32 +02:00
Peter Dimov
a095084492 Improve abi_test 2018-12-23 00:06:13 +02:00
Peter Dimov
a314765b94 Test variant=debug,release on Travis 2018-12-22 23:52:07 +02:00
Peter Dimov
02eba55685 Add abi_test 2018-12-22 22:56:20 +02:00
Peter Dimov
9c2c991291 Update .yml files 2018-12-18 21:53:58 +02:00
Peter Dimov
2e57ddb953 Update documentation of intrusive_ptr (document move ops, fix op<) 2018-11-25 17:54:51 +02:00
Peter Dimov
f6c3508aee Add make_local_shared_const_test 2018-11-10 21:04:22 +02:00
Peter Dimov
b7cca00408 Add make_shared_const_test 2018-11-10 20:44:00 +02:00
Peter Dimov
7e50abb9ec Merge pull request #55 from Romain-Geissler-1A/noexcept
Use BOOST_NOEXCEPT_OR_NOTHROW in public headers to prepare for C++20.
2018-11-10 19:32:01 +02:00
Peter Dimov
e7360779b0 Add g++ 8, clang 6.0, 7 to Travis 2018-11-10 18:35:29 +02:00
Romain Geissler
456da93897 Use BOOST_NOEXCEPT_OR_NOTHROW in public headers to prepare for C++20. 2018-11-09 14:55:34 +00:00
Peter Dimov
04f0847af4 Add --depth 1 to Appveyor 2018-09-21 20:53:27 +03:00
Glen Fernandes
29a08cdff6 Use BOOST_SYMBOL_VISIBLE with local_counted_base and children 2018-09-19 13:50:13 -04:00
Peter Dimov
6d3af760f6 Generously dispense BOOST_SYMBOL_VISIBLE 2018-09-18 03:18:23 +03:00
Peter Dimov
a9f39d2b94 Test make_shared/allocate_shared in dll_test too 2018-09-17 22:04:27 +03:00
Peter Dimov
4e2f236116 Add dll_test (to check for visibility issues) 2018-09-17 21:50:47 +03:00
Peter Dimov
4eb53db537 Use intrin.h under clang-cl 2018-08-12 01:26:59 +03:00
Glen Fernandes
a2b6ba85f3 Simplify exception safety in array construct utilities 2018-08-01 08:45:10 -04:00
Peter Dimov
e37cd4154f Work around ld: unrecognized option '--push-state--no-as-needed' 2018-05-10 16:16:08 +03:00
Peter Dimov
8563fc5c4e Add tests that include <windows.h> 2018-03-11 23:00:50 +02:00
Peter Dimov
67fab5c9ec Clang x64 warns that __stdcall is ignored, so don't use it there 2018-03-08 06:53:28 +02:00
Peter Dimov
f16fbdce26 Fix sp_interlocked on Cygwin 64 2018-03-08 05:15:49 +02:00
Peter Dimov
c3b3835a58 Mingw doesn't have _RTL_CRITICAL_SECTION 2018-03-08 03:34:00 +02:00
Peter Dimov
d1600b8abc Do not define pthread_* in lightweight_thread.hpp; mingw-w64 includes pthread.h in the standard library headers 2018-03-08 01:19:44 +02:00
Peter Dimov
5885763287 Remove clang from Appveyor; doesn't really work. 2018-03-08 00:39:15 +02:00
Peter Dimov
9bb12692b3 Only test C++14 with clang on Appveyor 2018-03-07 21:23:01 +02:00
Peter Dimov
773ef80f5d Add mingw configurations; move LLVM clang in its own VS2017 job 2018-03-07 20:06:04 +02:00
Peter Dimov
704de2bd67 Add Cygwin to Appveyor 2018-03-07 18:27:45 +02:00
Peter Dimov
1caa233faa Add address-model=32,64 to Appveyor 2018-03-07 17:37:28 +02:00
Peter Dimov
605d4a2789 Merge pull request #49 from joaquintides/patch-1
fixed AppVeyor link
2018-03-05 16:28:17 +02:00
joaquintides
6ab9b93088 fixed AppVeyor link 2018-03-05 15:13:18 +01:00
Peter Dimov
4129bb6a5c Use unique_ptr instead of auto_ptr when available 2018-02-19 06:16:11 +02:00
Peter Dimov
3b64e5ecb3 Add lw_thread_test 2018-02-19 02:02:31 +02:00
Peter Dimov
4025698fe8 Change atomic operations to take an arbitrary MemoryOrder type, to fix test breakage caused by transition to scoped enum in Boost.Atomic, tracking C++20 2018-02-07 17:45:07 +02:00
Peter Dimov
2d7ab197a7 Remove variant=debug,release from Travis; too weak, too slow 2018-01-24 15:16:32 +02:00
Peter Dimov
5877b08490 Disable spinlock_pool_test on msvc-9.0/release as well 2018-01-23 21:49:30 +02:00
Peter Dimov
ffe5b46f75 Silence MS warning about strcpy 2018-01-23 21:45:59 +02:00
Peter Dimov
4abc74fe28 Disable spinlock_pool_test on msvc-8.0/release 2018-01-23 19:05:44 +02:00
Peter Dimov
12a646c607 Update .travis.yml, appveyor.yml 2018-01-23 19:02:35 +02:00
Peter Dimov
937a3e0e93 Remove tabs 2018-01-23 06:29:17 +02:00
Peter Dimov
258fa75a7e Add -fsanitize=undefined to Travis 2018-01-20 02:20:35 +02:00
Peter Dimov
93d0d69f5e Add clang-3.3, 3.4 to Travis 2018-01-19 19:43:30 +02:00
Peter Dimov
f173f9c0fb Remove -fno-deduce-init-list from make_shared_arrays_test, allocate_shared_arrays_test; seems no longer needed 2018-01-18 14:36:58 +02:00
Peter Dimov
6a5942f55f Fix make_unique_value_test line 2018-01-18 14:35:15 +02:00
Peter Dimov
293a4ee009 Use full gcc-4.4.7 version 2018-01-18 14:34:06 +02:00
Peter Dimov
8e3aa3a565 make_unique_value_test: add -fno-deduce-init-list for gcc-4.6 2018-01-18 00:13:00 +02:00
Peter Dimov
78bebd5166 Disable auto_ptr_lv_fail on g++ 4.4 (known failure) 2018-01-17 21:17:19 +02:00
Peter Dimov
a47cf35b0f Disable atomic_sp_constexpr_test on libc++ 5.0 as well 2018-01-17 19:17:17 +02:00
Peter Dimov
8d0afb670f atomic_sp_constexpr_test: add pragma messages when skipped 2018-01-17 16:46:54 +02:00
Peter Dimov
77a35856c6 Add g++ 4.4, 4.6 to Travis 2018-01-16 18:50:09 +02:00
Peter Dimov
693109361e Add missing cxxstd=03 to libc++ Travis job 2018-01-16 16:13:41 +02:00
Peter Dimov
6735806863 Add clang++-libc++ to Travis 2018-01-16 16:09:13 +02:00
Peter Dimov
b0dc300154 Merge pull request #47 from wzssyqa/mips-r6-no-set-mips2
disable .set mips2 for mips release r6
2018-01-03 07:18:59 +02:00
Peter Dimov
adc998469a Add container_hash to Travis and Appveyor 2018-01-03 02:59:19 +02:00
YunQiang Su
4252ed31de disable .set mips2 for mips release r6
MIPS r6 changed the encoding for `ll' instruction,
if we `.set mips2', it will generate the old encoding for `ll'.

So here we disable it for r6.
2017-12-31 14:14:11 +08:00
Peter Dimov
279372a784 Merge branch 'develop' 2017-12-18 17:26:13 +02:00
Peter Dimov
b77b7cfd62 Fix intrusive_ptr converting constructor doc issue #46 2017-11-28 20:13:32 +02:00
Peter Dimov
2553a71b79 Fix intrusive_ptr converting constructor doc issue #46 2017-11-28 20:09:52 +02:00
Glen Fernandes
5dfcd2a6e4 Rename parameters to cope with gcc 4.8 -Wshadow 2017-11-27 23:47:13 -05:00
Peter Dimov
6f30b395e4 Add -j 3 to Travis 2017-11-06 05:29:33 +02:00
Peter Dimov
014318a1ba Reduce Appveyor jobs 2017-11-06 02:34:46 +02:00
Peter Dimov
d2c8eea08d Add VS2017 /std:c++17 to Appveyor 2017-11-06 01:49:20 +02:00
Glen Fernandes
4e0d47302b Merge pull request #45 from glywk/contribution
Fix make_unique header filename documentation
2017-11-02 21:46:41 -04:00
glywk
765840cd71 Fix make_unique header filename documentation 2017-11-02 23:07:16 +01:00
Glen Fernandes
cb4a878fa8 Merge pull request #44 from glenfe/develop
sp_array_construct condition for trivial should include has_trivial_destructor
2017-11-02 13:02:05 -04:00
Glen Fernandes
57a585ed46 sp_array_construct condition for trivial should include has_trivial_destructor 2017-11-02 11:53:41 -04:00
Peter Dimov
949338ff18 Add test that verifies no temporaries are created by array make_shared 2017-11-02 17:45:17 +02:00
Peter Dimov
50fbbe91d8 Re-add libstdc++-4.9-dev to clang 3.5, 3.8, 3.9 2017-10-25 00:30:48 +03:00
Peter Dimov
e88227b506 Update .travis.yml 2017-10-24 20:20:15 +03:00
Rene Rivera
410f2ce8d4 Remove redundant local asciidoctor tool spec. 2017-10-22 07:56:41 -05:00
Peter Dimov
4e2e758f58 Merge pull request #42 from grafikrobot/patch-1
Guard against redef of asciidoctor in common b2.
2017-10-19 03:02:10 +03:00
Rene Rivera
9cb8ee086f Guard against redef of asciidoctor in common b2. 2017-10-18 18:43:56 -05:00
Peter Dimov
a054a570c1 Add quick test target 2017-09-04 15:45:07 +03:00
Peter Dimov
219dc523ec Install libstdc++-4.9 for clang 3.5, 3.8, 3.9 in .travis.yml 2017-09-01 23:19:03 +03:00
Peter Dimov
5da882293d Merge branch 'develop' 2017-09-01 16:15:33 +03:00
Peter Dimov
868a870a59 Fix lightweight_mutex w/ BOOST_USE_WINDOWS_H 2017-09-01 13:25:19 +03:00
Peter Dimov
10c6233029 Merge branch 'develop' 2017-08-29 00:44:14 +03:00
Peter Dimov
bcfe1be681 Merge pull request #40 from BenjaminW3/topic-fix-nvcc
fix compilation for nvcc+clang
2017-08-28 10:51:22 +03:00
Benjamin Worpitz
966786e7f9 fix compilation for nvcc+clang
nvcc seems to use the host compiler for preprocessing the source for the device and host compilation.
When compiling the host code with the host compiler (clang), `__builtin_assume` is detected correctly and is also available during compilation.
When compiling the device code with nvcc, this builtin function is not available.
2017-08-28 08:12:48 +02:00
Peter Dimov
087471a232 Bump msvc version checks from <= 1910 to < 1920 2017-08-23 09:16:35 +03:00
63 changed files with 1560 additions and 646 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016-2019 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)
@@ -6,10 +6,6 @@ language: cpp
sudo: false
os:
- linux
- osx
branches:
only:
- master
@@ -28,21 +24,31 @@ matrix:
include:
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++03
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- os: linux
compiler: g++-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++03
compiler: g++-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
addons:
apt:
packages:
- g++-4.7
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.6
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++11
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
addons:
apt:
packages:
@@ -52,37 +58,16 @@ matrix:
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++03
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++03
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
addons:
apt:
packages:
@@ -92,37 +77,7 @@ matrix:
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++03
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++1z
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
@@ -132,7 +87,7 @@ matrix:
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
@@ -141,39 +96,8 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++03
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
@@ -182,31 +106,18 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++11
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- g++-7
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++14
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++17
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
@@ -216,92 +127,39 @@ matrix:
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
apt:
packages:
- clang-3.3
- os: linux
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
apt:
packages:
- clang-3.4
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++1z
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
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
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++1z
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
@@ -312,40 +170,7 @@ matrix:
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++1z
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
addons:
apt:
packages:
@@ -356,95 +181,31 @@ matrix:
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
addons:
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
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++1z
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
addons:
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
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++03
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
@@ -454,53 +215,78 @@ matrix:
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++11
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-4.0
- clang-5.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-trusty-5.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++14
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- clang-4.0
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++1z
compiler: clang++-7
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- clang-4.0
- clang-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-trusty-7
- os: linux
compiler: clang++-7
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- clang-7
- libstdc++-5-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
addons:
apt:
packages:
- libc++-dev
- os: linux
compiler: clang++-libc++
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z
- os: linux
compiler: g++
env: CMAKE_SUBDIR_TEST=1
script:
- cd libs/smart_ptr/test/cmake_subdir_test && mkdir __build__ && cd __build__
- cmake ..
- cmake --build .
- cmake --build . --target check
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
@@ -511,26 +297,27 @@ install:
- git submodule init libs/assert
- git submodule init libs/atomic
- git submodule init libs/config
- git submodule init libs/container_hash
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/move
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/static_assert
- git submodule init libs/throw_exception
- git submodule init libs/type_traits
- git submodule init libs/detail
- git submodule init libs/integer
- git submodule init tools/build
- git submodule update
- git submodule init libs/headers
- git submodule init tools/boost_install
- git submodule update --jobs 3
- cp -r $TRAVIS_BUILD_DIR/* libs/smart_ptr
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
- ./b2 libs/smart_ptr/test toolset=$TOOLSET
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j3 libs/smart_ptr/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
notifications:
email:

26
CMakeLists.txt Normal file
View File

@@ -0,0 +1,26 @@
# Copyright 2018 Mike Dev
# 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)
project(BoostSmartPtr LANGUAGES CXX)
add_library(boost_smart_ptr INTERFACE)
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
)

View File

@@ -2,5 +2,5 @@
Branch | Travis | Appveyor
---------|--------|---------
Develop | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=develop)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=develop&svg=true)](https://ci.appveyor.com/project/pdimov/smart_ptr)
Master | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=master)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=master&svg=true)](https://ci.appveyor.com/project/pdimov/smart_ptr)
Develop | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=develop)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=develop&svg=true)](https://ci.appveyor.com/project/pdimov/smart-ptr)
Master | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=master)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=master&svg=true)](https://ci.appveyor.com/project/pdimov/smart-ptr)

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016-2018 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)
@@ -15,45 +15,62 @@ branches:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-12.0
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
install:
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/align
- git submodule init libs/assert
- git submodule init libs/atomic
- git submodule init libs/config
- git submodule init libs/container_hash
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/move
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/static_assert
- git submodule init libs/throw_exception
- git submodule init libs/type_traits
- git submodule init libs/detail
- git submodule init libs/integer
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\smart_ptr
- git submodule init libs/headers
- git submodule init tools/boost_install
- git submodule update --jobs 3
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\smart_ptr\
- cmd /c bootstrap
- b2 headers
- b2 -d0 headers
build: off
test_script:
- b2 libs/smart_ptr/test toolset=%TOOLSET%
- PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j3 libs/smart_ptr/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release

View File

@@ -1,50 +0,0 @@
# Copyright 2017 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)
import type ;
import scanner ;
import generators ;
import boostbook ;
# File type
type.register ASCIIDOC : asciidoc adoc ;
# Define dependency scanner
class asciidoc-scanner : common-scanner
{
rule pattern ( )
{
return "include::([^[]+)\\[" ;
}
}
scanner.register asciidoc-scanner : include ;
type.set-scanner ASCIIDOC : asciidoc-scanner ;
# Define generators
generators.register-standard asciidoctor.asciidoc-to-html : ASCIIDOC : HTML ;
generators.register-standard asciidoctor.asciidoc-to-pdf : ASCIIDOC : PDF ;
# generators.register-standard asciidoctor.asciidoc-to-docbook : ASCIIDOC : DOCBOOK ;
# Define actions
actions asciidoc-to-html
{
asciidoctor -b html -o $(1) $(2)
}
actions asciidoc-to-pdf
{
asciidoctor -r asciidoctor-pdf -b pdf -o $(1) $(2)
}
actions asciidoc-to-docbook
{
asciidoctor -b docbook -o $(1) $(2)
}

View File

@@ -54,12 +54,18 @@ namespace boost {
intrusive_ptr(intrusive_ptr const & r);
template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r);
intrusive_ptr(intrusive_ptr && r);
template<class Y> intrusive_ptr(intrusive_ptr<Y> && r);
~intrusive_ptr();
intrusive_ptr & operator=(intrusive_ptr const & r);
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> const & r);
intrusive_ptr & operator=(T * r);
intrusive_ptr & operator=(intrusive_ptr && r);
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> && r);
void reset();
void reset(T * r);
void reset(T * r, bool add_ref);
@@ -92,8 +98,8 @@ namespace boost {
template<class T, class U>
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
template<class T, class U>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
template<class T>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) noexcept;
template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept;
@@ -155,9 +161,21 @@ template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r);
[none]
* {blank}
+
Effects:: `if(r.get() != 0) intrusive_ptr_add_ref(r.get());`.
Effects:: `T * p = r.get(); if(p != 0) intrusive_ptr_add_ref(p);`.
Postconditions:: `get() == r.get()`.
```
intrusive_ptr(intrusive_ptr && r);
```
```
template<class Y> intrusive_ptr(intrusive_ptr<Y> && r);
```
[none]
* {blank}
+
Postconditions:: `get()` equals the old value of `r.get()`. `r.get() == 0`.
### destructor
```
@@ -187,6 +205,19 @@ intrusive_ptr & operator=(T * r);
Effects:: Equivalent to `intrusive_ptr(r).swap(*this)`.
Returns:: `*this`.
```
intrusive_ptr & operator=(intrusive_ptr && r);
```
```
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> && r);
```
[none]
* {blank}
+
Effects:: Equivalent to `intrusive_ptr(std::move(r)).swap(*this)`.
Returns:: `*this`.
### reset
```
@@ -361,8 +392,8 @@ template<class T, class U>
Returns:: `a != b.get()`.
```
template<class T, class U>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
template<class T>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) noexcept;
```
[none]

View File

@@ -35,7 +35,7 @@ feature with `std::make_unique`.
## Synopsis
`make_unique` is defined in `<boost/smart_ptr/make_unqiue.hpp>`.
`make_unique` is defined in `<boost/smart_ptr/make_unique.hpp>`.
[subs=+quotes]
```

View File

@@ -62,7 +62,7 @@ int main()
clock_t t = clock();
pthread_t a[ m ];
boost::detail::lw_thread_t a[ m ];
for( int i = 0; i < m; ++i )
{
@@ -71,7 +71,7 @@ int main()
for( int j = 0; j < m; ++j )
{
pthread_join( a[j], 0 );
boost::detail::lw_thread_join( a[j] );
}
t = clock() - t;

View File

@@ -228,7 +228,7 @@ int main( int ac, char const * av[] )
clock_t t = clock();
std::vector<pthread_t> a( m );
std::vector<boost::detail::lw_thread_t> a( m );
for( int i = 0; i < m; ++i )
{
@@ -237,7 +237,7 @@ int main( int ac, char const * av[] )
for( int j = 0; j < m; ++j )
{
pthread_join( a[ j ], 0 );
boost::detail::lw_thread_join( a[ j ] );
}
t = clock() - t;

View File

@@ -165,7 +165,7 @@ int main()
clock_t t = clock();
pthread_t a[ mr+mw ];
boost::detail::lw_thread_t a[ mr+mw ];
for( int i = 0; i < mr; ++i )
{
@@ -179,7 +179,7 @@ int main()
for( int j = 0; j < mr+mw; ++j )
{
pthread_join( a[ j ], 0 );
boost::detail::lw_thread_join( a[ j ] );
}
t = clock() - t;

View File

@@ -100,7 +100,7 @@ int main()
clock_t t = clock();
pthread_t a[ m ];
boost::detail::lw_thread_t a[ m ];
for( int i = 0; i < m; ++i )
{
@@ -111,7 +111,7 @@ int main()
for( int j = 0; j < m; ++j )
{
pthread_join( a[j], 0 );
boost::detail::lw_thread_join( a[j] );
}
t = clock() - t;

View File

@@ -10,30 +10,59 @@
// boost/detail/lightweight_thread.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2008 Peter Dimov
// Copyright (c) 2008, 2018 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
//
//
// typedef /*...*/ lw_thread_t; // as pthread_t
// template<class F> int lw_thread_create( lw_thread_t & th, F f );
// void lw_thread_join( lw_thread_t th );
#include <boost/config.hpp>
#include <memory>
#include <cerrno>
// pthread_create, pthread_join
#if defined( BOOST_HAS_PTHREADS )
#include <pthread.h>
#else
namespace boost
{
namespace detail
{
typedef ::pthread_t lw_thread_t;
inline int lw_thread_create_( lw_thread_t* thread, const pthread_attr_t* attr, void* (*start_routine)( void* ), void* arg )
{
return ::pthread_create( thread, attr, start_routine, arg );
}
inline void lw_thread_join( lw_thread_t th )
{
::pthread_join( th, 0 );
}
} // namespace detail
} // namespace boost
#else // defined( BOOST_HAS_PTHREADS )
#include <windows.h>
#include <process.h>
typedef HANDLE pthread_t;
namespace boost
{
namespace detail
{
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
typedef HANDLE lw_thread_t;
inline int lw_thread_create_( lw_thread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
{
HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
@@ -48,20 +77,20 @@ int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * star
}
}
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
inline void lw_thread_join( lw_thread_t thread )
{
::WaitForSingleObject( thread, INFINITE );
::CloseHandle( thread );
return 0;
}
#endif
} // namespace detail
} // namespace boost
#endif // defined( BOOST_HAS_PTHREADS )
// template<class F> int lw_thread_create( pthread_t & pt, F f );
namespace boost
{
namespace detail
{
@@ -77,8 +106,16 @@ public:
extern "C" void * lw_thread_routine( void * pv )
{
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
#else
std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
#endif
pt->run();
return 0;
@@ -88,8 +125,16 @@ extern "C" void * lw_thread_routine( void * pv )
unsigned __stdcall lw_thread_routine( void * pv )
{
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
#else
std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
#endif
pt->run();
return 0;
@@ -115,11 +160,19 @@ private:
F f_;
};
template<class F> int lw_thread_create( pthread_t & pt, F f )
template<class F> int lw_thread_create( lw_thread_t & th, F f )
{
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
#else
std::unique_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
#endif
int r = lw_thread_create_( &th, 0, lw_thread_routine, p.get() );
if( r == 0 )
{

View File

@@ -30,7 +30,7 @@ struct lsp_if_size_array<T[N]> {
typedef boost::local_shared_ptr<T[N]> type;
};
class lsp_array_base
class BOOST_SYMBOL_VISIBLE lsp_array_base
: public local_counted_base {
public:
void set(sp_counted_base* base) BOOST_SP_NOEXCEPT {

View File

@@ -1,5 +1,5 @@
/*
Copyright 2012-2017 Glen Joseph Fernandes
Copyright 2012-2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
@@ -154,192 +154,143 @@ sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { }
template<bool E, class A, class T>
inline typename sp_enable<!E &&
!boost::has_trivial_destructor<T>::value>::type
sp_array_destroy(A&, T* start, std::size_t size)
sp_array_destroy(A&, T* ptr, std::size_t size)
{
while (size > 0) {
start[--size].~T();
ptr[--size].~T();
}
}
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<bool E, class A, class T>
inline typename sp_enable<E>::type
sp_array_destroy(A& allocator, T* start, std::size_t size)
sp_array_destroy(A& allocator, T* ptr, std::size_t size)
{
while (size > 0) {
std::allocator_traits<A>::destroy(allocator, start + --size);
std::allocator_traits<A>::destroy(allocator, ptr + --size);
}
}
#endif
template<bool E, class A, class T>
class sp_destroyer {
public:
sp_destroyer(A& allocator, T* ptr) BOOST_SP_NOEXCEPT
: allocator_(allocator),
ptr_(ptr),
size_(0) { }
~sp_destroyer() {
sp_array_destroy<E>(allocator_, ptr_, size_);
}
std::size_t& size() BOOST_SP_NOEXCEPT {
return size_;
}
private:
sp_destroyer(const sp_destroyer&);
sp_destroyer& operator=(const sp_destroyer&);
A& allocator_;
T* ptr_;
std::size_t size_;
};
template<bool E, class A, class T>
inline typename sp_enable<!E &&
boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value>::type
sp_array_construct(A&, T* start, std::size_t size)
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value>::type
sp_array_construct(A&, T* ptr, std::size_t size)
{
for (std::size_t i = 0; i < size; ++i) {
start[i] = T();
ptr[i] = T();
}
}
template<bool E, class A, class T>
inline typename sp_enable<!E &&
boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value>::type
sp_array_construct(A&, T* start, std::size_t size, const T* list,
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value>::type
sp_array_construct(A&, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
for (std::size_t i = 0; i < size; ++i) {
start[i] = list[i % count];
}
}
#if !defined(BOOST_NO_EXCEPTIONS)
template<bool E, class A, class T>
inline typename sp_enable<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value)>::type
sp_array_construct(A& none, T* start, std::size_t size)
{
std::size_t i = 0;
try {
for (; i < size; ++i) {
::new(static_cast<void*>(start + i)) T();
}
} catch (...) {
sp_array_destroy<E>(none, start, i);
throw;
ptr[i] = list[i % count];
}
}
template<bool E, class A, class T>
inline typename sp_enable<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value)>::type
sp_array_construct(A& none, T* start, std::size_t size, const T* list,
std::size_t count)
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value)>::type
sp_array_construct(A& none, T* ptr, std::size_t size)
{
std::size_t i = 0;
try {
for (; i < size; ++i) {
::new(static_cast<void*>(start + i)) T(list[i % count]);
}
} catch (...) {
sp_array_destroy<E>(none, start, i);
throw;
}
}
#else
template<bool E, class A, class T>
inline typename sp_enable<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value)>::type
sp_array_construct(A&, T* start, std::size_t size)
{
for (std::size_t i = 0; i < size; ++i) {
::new(static_cast<void*>(start + i)) T();
sp_destroyer<E, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T();
}
hold.size() = 0;
}
template<bool E, class A, class T>
inline typename sp_enable<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value)>::type
sp_array_construct(A&, T* start, std::size_t size, const T* list,
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value)>::type
sp_array_construct(A& none, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
for (std::size_t i = 0; i < size; ++i) {
::new(static_cast<void*>(start + i)) T(list[i % count]);
sp_destroyer<E, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T(list[i % count]);
}
hold.size() = 0;
}
#endif
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#if !defined(BOOST_NO_EXCEPTIONS)
template<bool E, class A, class T>
inline typename sp_enable<E>::type
sp_array_construct(A& allocator, T* start, std::size_t size)
sp_array_construct(A& allocator, T* ptr, std::size_t size)
{
std::size_t i = 0;
try {
for (i = 0; i < size; ++i) {
std::allocator_traits<A>::construct(allocator, start + i);
}
} catch (...) {
sp_array_destroy<E>(allocator, start, i);
throw;
sp_destroyer<E, A, T> hold(allocator, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
std::allocator_traits<A>::construct(allocator, ptr + i);
}
hold.size() = 0;
}
template<bool E, class A, class T>
inline typename sp_enable<E>::type
sp_array_construct(A& allocator, T* start, std::size_t size, const T* list,
sp_array_construct(A& allocator, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
std::size_t i = 0;
try {
for (i = 0; i < size; ++i) {
std::allocator_traits<A>::construct(allocator, start + i,
sp_destroyer<E, A, T> hold(allocator, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
std::allocator_traits<A>::construct(allocator, ptr + i,
list[i % count]);
}
} catch (...) {
sp_array_destroy<E>(allocator, start, i);
throw;
}
hold.size() = 0;
}
#else
template<bool E, class A, class T>
inline typename sp_enable<E>::type
sp_array_construct(A& allocator, T* start, std::size_t size)
{
for (std::size_t i = 0; i < size; ++i) {
std::allocator_traits<A>::construct(allocator, start + i);
}
}
template<bool E, class A, class T>
inline typename sp_enable<E>::type
sp_array_construct(A& allocator, T* start, std::size_t size, const T* list,
std::size_t count)
{
for (std::size_t i = 0; i < size; ++i) {
std::allocator_traits<A>::construct(allocator, start + i,
list[i % count]);
}
}
#endif
#endif
template<class A, class T>
inline typename sp_enable<boost::has_trivial_constructor<T>::value>::type
sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { }
#if !defined(BOOST_NO_EXCEPTIONS)
template<class A, class T>
inline typename sp_enable<!boost::has_trivial_constructor<T>::value>::type
sp_array_default(A& none, T* start, std::size_t size)
sp_array_default(A& none, T* ptr, std::size_t size)
{
std::size_t i = 0;
try {
for (; i < size; ++i) {
::new(static_cast<void*>(start + i)) T;
}
} catch (...) {
sp_array_destroy<false>(none, start, i);
throw;
sp_destroyer<false, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T;
}
hold.size() = 0;
}
#else
template<bool E, class A, class T>
inline typename sp_enable<!boost::has_trivial_constructor<T>::value>::type
sp_array_default(A&, T* start, std::size_t size)
{
for (std::size_t i = 0; i < size; ++i) {
::new(static_cast<void*>(start + i)) T;
}
}
#endif
template<class A>
class sp_array_state {
@@ -347,9 +298,9 @@ public:
typedef A type;
template<class U>
sp_array_state(const U& allocator, std::size_t size) BOOST_SP_NOEXCEPT
: allocator_(allocator),
size_(size) { }
sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT
: allocator_(_allocator),
size_(_size) { }
A& allocator() BOOST_SP_NOEXCEPT {
return allocator_;
@@ -370,8 +321,8 @@ public:
typedef A type;
template<class U>
sp_size_array_state(const U& allocator, std::size_t) BOOST_SP_NOEXCEPT
: allocator_(allocator) { }
sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT
: allocator_(_allocator) { }
A& allocator() BOOST_SP_NOEXCEPT {
return allocator_;
@@ -473,7 +424,7 @@ private:
struct sp_default { };
template<class T, bool E = sp_use_construct<T>::value>
class sp_array_base
class BOOST_SYMBOL_VISIBLE sp_array_base
: public sp_counted_base {
typedef typename T::type allocator;

View File

@@ -97,7 +97,13 @@ public:
return false;
}
shared_ptr<T> load( int = 0 ) const BOOST_SP_NOEXCEPT
shared_ptr<T> load() const BOOST_SP_NOEXCEPT
{
boost::detail::spinlock::scoped_lock lock( l_ );
return p_;
}
template<class M> shared_ptr<T> load( M ) const BOOST_SP_NOEXCEPT
{
boost::detail::spinlock::scoped_lock lock( l_ );
return p_;
@@ -109,13 +115,19 @@ public:
return p_;
}
void store( shared_ptr<T> r, int = 0 ) BOOST_SP_NOEXCEPT
void store( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
{
boost::detail::spinlock::scoped_lock lock( l_ );
p_.swap( r );
}
shared_ptr<T> exchange( shared_ptr<T> r, int = 0 ) BOOST_SP_NOEXCEPT
template<class M> void store( shared_ptr<T> r, M ) BOOST_SP_NOEXCEPT
{
boost::detail::spinlock::scoped_lock lock( l_ );
p_.swap( r );
}
shared_ptr<T> exchange( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
{
{
boost::detail::spinlock::scoped_lock lock( l_ );
@@ -133,44 +145,82 @@ public:
#endif
}
bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, int, int ) BOOST_SP_NOEXCEPT
template<class M> shared_ptr<T> exchange( shared_ptr<T> r, M ) BOOST_SP_NOEXCEPT
{
{
boost::detail::spinlock::scoped_lock lock( l_ );
p_.swap( r );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
return std::move( r );
#else
return r;
#endif
}
template<class M> bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, M, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, int = 0 ) BOOST_SP_NOEXCEPT
template<class M> bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, int, int ) BOOST_SP_NOEXCEPT
bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, int = 0 ) BOOST_SP_NOEXCEPT
template<class M> bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, M, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
template<class M> bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, w );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, int, int ) BOOST_SP_NOEXCEPT
template<class M> bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, M, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}
bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, int = 0 ) BOOST_SP_NOEXCEPT
template<class M> bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}
bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, int, int ) BOOST_SP_NOEXCEPT
bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}
bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, int = 0 ) BOOST_SP_NOEXCEPT
template<class M> bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, M, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}
template<class M> bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, M ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}
bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w ) BOOST_SP_NOEXCEPT
{
return compare_exchange( v, std::move( w ) );
}

View File

@@ -47,7 +47,7 @@ class bad_weak_ptr: public std::exception
{
public:
virtual char const * what() const throw()
virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
{
return "tr1::bad_weak_ptr";
}

View File

@@ -27,7 +27,7 @@ namespace boost
namespace detail
{
class local_counted_base
class BOOST_SYMBOL_VISIBLE local_counted_base
{
private:
@@ -60,12 +60,14 @@ public:
void add_ref() BOOST_SP_NOEXCEPT
{
#if !defined(__NVCC__)
#if defined( __has_builtin )
# if __has_builtin( __builtin_assume )
__builtin_assume( local_use_count_ >= 1 );
# endif
#endif
#endif
local_use_count_ = static_cast<count_type>( local_use_count_ + 1 );
@@ -87,7 +89,7 @@ public:
}
};
class local_counted_impl: public local_counted_base
class BOOST_SYMBOL_VISIBLE local_counted_impl: public local_counted_base
{
private:
@@ -122,7 +124,7 @@ public:
}
};
class local_counted_impl_em: public local_counted_base
class BOOST_SYMBOL_VISIBLE local_counted_impl_em: public local_counted_base
{
public:

View File

@@ -61,10 +61,23 @@ extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRIT
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
#else
typedef ::_RTL_CRITICAL_SECTION rtl_critical_section;
#else // #ifndef BOOST_USE_WINDOWS_H
typedef ::CRITICAL_SECTION critical_section;
#if BOOST_PLAT_WINDOWS_RUNTIME
using ::InitializeCriticalSectionEx;
#else
using ::InitializeCriticalSection;
#endif
using ::EnterCriticalSection;
using ::LeaveCriticalSection;
using ::DeleteCriticalSection;
typedef ::CRITICAL_SECTION rtl_critical_section;
#endif // #ifndef BOOST_USE_WINDOWS_H
class lightweight_mutex
@@ -81,15 +94,15 @@ public:
lightweight_mutex()
{
#if BOOST_PLAT_WINDOWS_RUNTIME
boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0);
boost::detail::InitializeCriticalSectionEx(reinterpret_cast< rtl_critical_section* >(&cs_), 4000, 0);
#else
boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
#endif
}
~lightweight_mutex()
{
boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
boost::detail::DeleteCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
}
class scoped_lock;
@@ -108,12 +121,12 @@ public:
explicit scoped_lock(lightweight_mutex & m): m_(m)
{
boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
boost::detail::EnterCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
}
~scoped_lock()
{
boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
boost::detail::LeaveCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
}
};
};

View File

@@ -16,6 +16,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <machine/sys/inline.h>
namespace boost
@@ -71,7 +72,7 @@ inline int atomic_conditional_increment( int * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -21,6 +21,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <builtins.h>
#include <sys/atomic_op.h>
@@ -63,7 +64,7 @@ inline int32_t atomic_conditional_increment( int32_t * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -16,6 +16,7 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
namespace boost
@@ -63,7 +64,7 @@ inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t *
# pragma clang diagnostic ignored "-Wweak-vtables"
#endif
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -25,6 +25,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -91,7 +92,7 @@ store:
return a;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -26,6 +26,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -79,7 +80,7 @@ inline int atomic_conditional_increment( int * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -17,6 +17,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -78,7 +79,7 @@ inline int atomic_conditional_increment( int * pw )
return rv;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -21,6 +21,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -38,7 +39,9 @@ inline void atomic_increment( int * pw )
(
"0:\n\t"
".set push\n\t"
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
".set mips2\n\t"
#endif
"ll %0, %1\n\t"
"addiu %0, 1\n\t"
"sc %0, %1\n\t"
@@ -59,7 +62,9 @@ inline int atomic_decrement( int * pw )
(
"0:\n\t"
".set push\n\t"
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
".set mips2\n\t"
#endif
"ll %1, %2\n\t"
"addiu %0, %1, -1\n\t"
"sc %0, %2\n\t"
@@ -85,7 +90,9 @@ inline int atomic_conditional_increment( int * pw )
(
"0:\n\t"
".set push\n\t"
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
".set mips2\n\t"
#endif
"ll %0, %2\n\t"
"beqz %0, 1f\n\t"
"addiu %1, %0, 1\n\t"
@@ -102,7 +109,7 @@ inline int atomic_conditional_increment( int * pw )
return rv;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -25,6 +25,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -102,7 +103,7 @@ inline int atomic_conditional_increment( int * pw )
return rv;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -20,6 +20,7 @@
// Thanks to Michael van der Westhuizen
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <inttypes.h> // int32_t
namespace boost
@@ -87,7 +88,7 @@ inline int32_t atomic_conditional_increment( int32_t * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -25,6 +25,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -94,7 +95,7 @@ inline int atomic_conditional_increment( int * pw )
return rv;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -19,6 +19,8 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
namespace boost
{
@@ -26,15 +28,15 @@ namespace boost
namespace detail
{
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:
sp_counted_base( sp_counted_base const & );
sp_counted_base & operator= ( sp_counted_base const & );
long use_count_; // #shared
long weak_count_; // #weak + (#shared != 0)
boost::int_least32_t use_count_; // #shared
boost::int_least32_t weak_count_; // #weak + (#shared != 0)
public:

View File

@@ -20,6 +20,8 @@
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <pthread.h>
namespace boost
@@ -28,15 +30,15 @@ namespace boost
namespace detail
{
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:
sp_counted_base( sp_counted_base const & );
sp_counted_base & operator= ( sp_counted_base const & );
long use_count_; // #shared
long weak_count_; // #weak + (#shared != 0)
boost::int_least32_t use_count_; // #shared
boost::int_least32_t weak_count_; // #weak + (#shared != 0)
mutable pthread_mutex_t m_;
@@ -92,7 +94,7 @@ public:
void release() // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long new_use_count = --use_count_;
boost::int_least32_t new_use_count = --use_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
if( new_use_count == 0 )
@@ -112,7 +114,7 @@ public:
void weak_release() // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long new_weak_count = --weak_count_;
boost::int_least32_t new_weak_count = --weak_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
if( new_weak_count == 0 )
@@ -124,7 +126,7 @@ public:
long use_count() const // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long r = use_count_;
boost::int_least32_t r = use_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
return r;

View File

@@ -20,6 +20,7 @@
// Thanks to Michael van der Westhuizen
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <inttypes.h> // uint32_t
namespace boost
@@ -82,7 +83,7 @@ inline uint32_t atomic_conditional_increment( uint32_t * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -21,6 +21,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <atomic.h>
namespace boost
@@ -29,7 +30,7 @@ namespace boost
namespace detail
{
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -20,6 +20,7 @@
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/spinlock_pool.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -51,7 +52,7 @@ inline int atomic_conditional_increment( int * pw )
return rv;
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -16,6 +16,7 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <atomic>
#include <cstdint>
@@ -57,7 +58,7 @@ inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -16,6 +16,7 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
#include <limits.h>
#if defined( __ia64__ ) && defined( __INTEL_COMPILER )
@@ -76,7 +77,7 @@ inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -22,6 +22,7 @@
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
extern "builtin" void __lwsync(void);
extern "builtin" void __isync(void);
@@ -70,7 +71,7 @@ inline int atomic_conditional_increment( int *pw )
}
}
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -27,6 +27,7 @@
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
{
@@ -34,7 +35,7 @@ namespace boost
namespace detail
{
class sp_counted_base
class BOOST_SYMBOL_VISIBLE sp_counted_base
{
private:

View File

@@ -64,7 +64,7 @@ template<class D> D * get_local_deleter( local_sp_deleter<D> * p );
//
template<class X> class sp_counted_impl_p: public sp_counted_base
template<class X> class BOOST_SYMBOL_VISIBLE sp_counted_impl_p: public sp_counted_base
{
private:
@@ -143,7 +143,7 @@ public:
# pragma option push -Vx-
#endif
template<class P, class D> class sp_counted_impl_pd: public sp_counted_base
template<class P, class D> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pd: public sp_counted_base
{
private:
@@ -216,7 +216,7 @@ public:
#endif
};
template<class P, class D, class A> class sp_counted_impl_pda: public sp_counted_base
template<class P, class D, class A> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pda: public sp_counted_base
{
private:

View File

@@ -32,11 +32,21 @@
// MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
# define BOOST_SP_HAS_INTRIN_H
#elif defined( __LP64__ )
// We have to use intrin.h on Cygwin 64
# define BOOST_SP_HAS_INTRIN_H
// Intel C++ on Windows on VC10+ stdlib
#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520
# define BOOST_SP_HAS_INTRIN_H
// clang-cl on Windows on VC10+ stdlib
#elif defined( __clang__ ) && defined( _MSC_VER ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520
# define BOOST_SP_HAS_INTRIN_H
#endif
#if defined( BOOST_USE_WINDOWS_H )

View File

@@ -25,7 +25,7 @@
//
#include <boost/config.hpp>
#include <boost/predef.h>
#include <boost/predef/platform/windows_runtime.h>
#if BOOST_PLAT_WINDOWS_RUNTIME
#include <thread>
@@ -60,18 +60,24 @@ namespace detail
{
#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
#if !BOOST_COMP_CLANG || !defined __MINGW32__
extern "C" void __stdcall Sleep( unsigned long ms );
#if defined(__clang__) && defined(__x86_64__)
// clang x64 warns that __stdcall is ignored
# define BOOST_SP_STDCALL
#else
#include <_mingw.h>
#if !defined __MINGW64_VERSION_MAJOR
extern "C" void __stdcall Sleep( unsigned long ms );
# define BOOST_SP_STDCALL __stdcall
#endif
#if defined(__LP64__) // Cygwin 64
extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms );
#else
extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms );
#endif
#endif
extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms );
#endif
#undef BOOST_SP_STDCALL
#endif // !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
inline void yield( unsigned k )
{
if( k < 4 )

View File

@@ -13,6 +13,7 @@
#include <boost/smart_ptr/local_shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/config.hpp>
#include <utility>
#include <cstddef>
@@ -186,12 +187,14 @@ template<class T, class A> typename boost::detail::lsp_if_not_array<T>::type all
template<class T, class... Args> typename boost::detail::lsp_if_not_array<T>::type make_local_shared( Args&&... args )
{
return boost::allocate_local_shared<T>( std::allocator<T>(), std::forward<Args>(args)... );
typedef typename boost::remove_const<T>::type T2;
return boost::allocate_local_shared<T2>( std::allocator<T2>(), std::forward<Args>(args)... );
}
template<class T> typename boost::detail::lsp_if_not_array<T>::type make_local_shared_noinit()
{
return boost::allocate_shared_noinit<T>( std::allocator<T>() );
typedef typename boost::remove_const<T>::type T2;
return boost::allocate_shared_noinit<T2>( std::allocator<T2>() );
}
} // namespace boost

View File

@@ -1080,7 +1080,7 @@ template<class T> shared_ptr<T> atomic_load( shared_ptr<T> const * p ) BOOST_SP_
return *p;
}
template<class T> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
template<class T, class M> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
{
return atomic_load( p );
}
@@ -1091,7 +1091,7 @@ template<class T> void atomic_store( shared_ptr<T> * p, shared_ptr<T> r ) BOOST_
p->swap( r );
}
template<class T> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
template<class T, class M> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
{
atomic_store( p, r ); // std::move( r )
}
@@ -1107,7 +1107,7 @@ template<class T> shared_ptr<T> atomic_exchange( shared_ptr<T> * p, shared_ptr<T
return r; // return std::move( r )
}
template<class T> shared_ptr<T> inline atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
template<class T, class M> shared_ptr<T> inline atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
{
return atomic_exchange( p, r ); // std::move( r )
}
@@ -1137,7 +1137,7 @@ template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T>
}
}
template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, /*memory_order success*/ int, /*memory_order failure*/ int ) BOOST_SP_NOEXCEPT
template<class T, class M> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT
{
return atomic_compare_exchange( p, v, w ); // std::move( w )
}

View File

@@ -1,27 +1,38 @@
# Boost.SmartPtr Library test Jamfile
#
# Copyright (c) 2003-2017 Peter Dimov
# Copyright (c) 2003-2018 Peter Dimov
# Copyright (c) 2003 Dave 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)
# bring in rules for testing
import testing ;
project
: requirements
<toolset>gcc:<cxxflags>-Wno-non-virtual-dtor
<toolset>gcc:<cxxflags>-Wno-deprecated-declarations
#<toolset>gcc:<cxxflags>-Wno-delete-non-virtual-dtor (not in 4.4/4.6)
;
# quick test (for CI)
run quick.cpp ;
# full test suite
run smart_ptr_test.cpp ;
run shared_ptr_basic_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-non-virtual-dtor ;
run shared_ptr_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-non-virtual-dtor ;
run shared_ptr_basic_test.cpp ;
run shared_ptr_test.cpp ;
run weak_ptr_test.cpp ;
run weak_ptr_move_test.cpp ;
run shared_from_this_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-non-virtual-dtor ;
run shared_from_this_test.cpp ;
run get_deleter_test.cpp ;
run intrusive_ptr_test.cpp ;
run intrusive_ptr_move_test.cpp ;
run intrusive_ref_counter_test.cpp ;
run atomic_count_test.cpp ;
run lw_mutex_test.cpp ;
run lw_mutex_test.cpp : : : <define>BOOST_USE_WINDOWS_H : lw_mutex_test.win_h ;
compile-fail shared_ptr_assign_fail.cpp ;
compile-fail shared_ptr_delete_fail.cpp ;
compile-fail shared_ptr_compare_fail.cpp ;
@@ -46,7 +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 ;
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 ;
run make_shared_perfect_forwarding_test.cpp ;
@@ -63,7 +78,7 @@ 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 ;
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 ;
@@ -144,13 +159,13 @@ compile-fail array_fail_member_access.cpp ;
compile-fail array_fail_array_access.cpp ;
run make_shared_array_test.cpp ;
run make_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
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 ;
run make_shared_array_esft_test.cpp ;
run make_shared_array_noinit_test.cpp ;
run make_shared_array_value_test.cpp ;
run allocate_shared_array_test.cpp ;
run allocate_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
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 ;
run allocate_shared_array_esft_test.cpp ;
run allocate_shared_array_noinit_test.cpp ;
@@ -159,7 +174,7 @@ run allocate_shared_array_construct_test.cpp ;
run make_unique_test.cpp ;
run make_unique_args_test.cpp ;
run make_unique_value_test.cpp ;
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 ;
@@ -259,3 +274,35 @@ run allocate_local_shared_array_construct_test.cpp ;
run local_sp_fn_test.cpp ;
run lsp_convertible_test.cpp ;
run lsp_convertible_test2.cpp ;
run make_shared_array_tmp_test.cpp ;
run lw_thread_test.cpp : : : <threading>multi ;
compile sp_windows_h_test.cpp ;
compile spinlock_windows_h_test.cpp ;
compile yield_k_windows_h_test.cpp ;
lib dll_test : dll_test_lib.cpp : <link>shared:<define>DLL_TEST_DYN_LINK=1 ;
explicit dll_test ;
run dll_test_main.cpp dll_test : : : <link>static : dll_test_static ;
run dll_test_main.cpp dll_test : : : <link>shared : dll_test_shared ;
run make_shared_const_test.cpp ;
run make_local_shared_const_test.cpp ;
lib abi_test_mt : abi_test_lib.cpp : <link>static ;
explicit abi_test_mt ;
obj abi_test_lib_nt : abi_test_lib.cpp : <define>BOOST_DISABLE_THREADS ;
explicit abi_test_lib_nt ;
lib abi_test_nt : abi_test_lib_nt : <link>static ;
explicit abi_test_nt ;
run abi_test_main.cpp abi_test_mt : : : <define>BOOST_DISABLE_THREADS : abi_test_nt_mt ;
run abi_test_main.cpp abi_test_nt : : : : abi_test_mt_nt ;
run abi_test_main.cpp abi_test_mt/<cxxstd>0x : : : <cxxstd>98 : abi_test_03_11 ;
run abi_test_main.cpp abi_test_mt/<cxxstd>98 : : : <cxxstd>0x : abi_test_11_03 ;

43
test/abi_test_lib.cpp Normal file
View File

@@ -0,0 +1,43 @@
// Copyright 2018 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 <boost/shared_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/pragma_message.hpp>
#if defined(BOOST_DISABLE_THREADS)
BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is defined" )
#else
BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is not defined" )
#endif
#if defined(BOOST_NO_CXX11_HDR_ATOMIC)
BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is defined" )
#else
BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is not defined" )
#endif
void abi_test_1( boost::shared_ptr<void> & p )
{
BOOST_TEST_EQ( p.use_count(), 1 );
p.reset();
BOOST_TEST_EQ( p.use_count(), 0 );
}
boost::shared_ptr<void> abi_test_2( boost::shared_ptr<void> const & p )
{
BOOST_TEST_EQ( p.use_count(), 1 );
return p;
}
boost::shared_ptr<void> abi_test_3()
{
return boost::shared_ptr<void>( static_cast<int*>( 0 ) );
}

82
test/abi_test_main.cpp Normal file
View File

@@ -0,0 +1,82 @@
// Copyright 2018 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 <boost/shared_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/pragma_message.hpp>
#if defined(BOOST_DISABLE_THREADS)
BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is defined" )
#else
BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is not defined" )
#endif
#if defined(BOOST_NO_CXX11_HDR_ATOMIC)
BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is defined" )
#else
BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is not defined" )
#endif
void abi_test_1( boost::shared_ptr<void> & p );
boost::shared_ptr<void> abi_test_2( boost::shared_ptr<void> const & p );
boost::shared_ptr<void> abi_test_3();
static int deleter_called;
void deleter( void* )
{
++deleter_called;
}
int main()
{
{
deleter_called = 0;
boost::shared_ptr<void> p( static_cast<void*>( 0 ), deleter );
BOOST_TEST_EQ( p.use_count(), 1 );
abi_test_1( p );
BOOST_TEST_EQ( p.use_count(), 0 );
BOOST_TEST_EQ( deleter_called, 1 );
}
{
deleter_called = 0;
boost::shared_ptr<void> p1( static_cast<void*>( 0 ), deleter );
BOOST_TEST_EQ( p1.use_count(), 1 );
boost::shared_ptr<void> p2 = abi_test_2( p1 );
BOOST_TEST_EQ( p1.use_count(), 2 );
BOOST_TEST_EQ( p2.use_count(), 2 );
p1.reset();
BOOST_TEST_EQ( p2.use_count(), 1 );
p2.reset();
BOOST_TEST_EQ( deleter_called, 1 );
}
{
boost::shared_ptr<void> p = abi_test_3();
BOOST_TEST_EQ( p.use_count(), 1 );
p.reset();
BOOST_TEST_EQ( p.use_count(), 0 );
}
return boost::report_errors();
}

View File

@@ -1,7 +1,7 @@
//
// atomic_sp_constexpr_test.cpp
//
// Copyright 2017 Peter Dimov
// Copyright 2017, 2018 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
@@ -9,32 +9,37 @@
//
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#define HAVE_CONSTEXPR_INIT
#include <boost/config/workaround.hpp>
#include <boost/config/pragma_message.hpp>
#include <boost/config/helper_macros.hpp>
#if defined( BOOST_NO_CXX11_CONSTEXPR )
# undef HAVE_CONSTEXPR_INIT
#endif
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1910 )
# undef HAVE_CONSTEXPR_INIT
#endif
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_NO_CXX11_CONSTEXPR")
int main() {}
#if defined(__clang__) && defined( BOOST_NO_CXX14_CONSTEXPR )
# undef HAVE_CONSTEXPR_INIT
#endif
#elif BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
// MSVC does not implement static initialization for constexpr
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_MSVC < 1920")
int main() {}
#elif defined(__clang__) && defined( BOOST_NO_CXX14_CONSTEXPR )
// Clang only implements static initialization for constexpr in C++14 mode
BOOST_PRAGMA_MESSAGE("Skipping test due to __clang__ and BOOST_NO_CXX14_CONSTEXPR")
int main() {}
#elif defined( _LIBCPP_VERSION ) && ( _LIBCPP_VERSION < 6000 )
#if defined( _LIBCPP_VERSION ) && ( _LIBCPP_VERSION < 5000 )
// in libc++, atomic_flag has a non-constexpr constructor from bool
# undef HAVE_CONSTEXPR_INIT
#endif
BOOST_PRAGMA_MESSAGE("Skipping test due to _LIBCPP_VERSION " BOOST_STRINGIZE(_LIBCPP_VERSION))
int main() {}
#if !defined( HAVE_CONSTEXPR_INIT ) || defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX )
#elif defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX )
int main()
{
}
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX")
int main() {}
#else
@@ -69,4 +74,4 @@ int main()
return boost::report_errors();
}
#endif // #if defined( BOOST_NO_CXX11_CONSEXPR )
#endif

View File

@@ -0,0 +1,25 @@
# 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)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../.. boostorg/smart_ptr)
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)
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>)

42
test/dll_test_lib.cpp Normal file
View File

@@ -0,0 +1,42 @@
// Copyright 2018 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 <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/config.hpp>
#include <memory>
#if defined(DLL_TEST_DYN_LINK)
# define EXPORT BOOST_SYMBOL_EXPORT
#else
# define EXPORT
#endif
EXPORT boost::shared_ptr<int> dll_test_41()
{
return boost::shared_ptr<int>( new int( 41 ) );
}
EXPORT boost::shared_ptr<int> dll_test_42()
{
return boost::make_shared<int>( 42 );
}
EXPORT boost::shared_ptr<int> dll_test_43()
{
return boost::allocate_shared<int>( std::allocator<int>(), 43 );
}
EXPORT boost::shared_ptr<int[]> dll_test_44()
{
return boost::make_shared<int[1]>( 44 );
}
EXPORT boost::shared_ptr<int[]> dll_test_45()
{
return boost::allocate_shared<int[1]>( std::allocator<int>(), 45 );
}

45
test/dll_test_main.cpp Normal file
View File

@@ -0,0 +1,45 @@
// Copyright 2018 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 <boost/shared_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
boost::shared_ptr<int> dll_test_41();
boost::shared_ptr<int> dll_test_42();
boost::shared_ptr<int> dll_test_43();
boost::shared_ptr<int[]> dll_test_44();
boost::shared_ptr<int[]> dll_test_45();
int main()
{
{
boost::shared_ptr<int> p = dll_test_41();
BOOST_TEST_EQ( *p, 41 );
}
{
boost::shared_ptr<int> p = dll_test_42();
BOOST_TEST_EQ( *p, 42 );
}
{
boost::shared_ptr<int> p = dll_test_43();
BOOST_TEST_EQ( *p, 43 );
}
{
boost::shared_ptr<int[]> p = dll_test_44();
BOOST_TEST_EQ( p[0], 44 );
}
{
boost::shared_ptr<int[]> p = dll_test_45();
BOOST_TEST_EQ( p[0], 45 );
}
return boost::report_errors();
}

36
test/lw_thread_test.cpp Normal file
View File

@@ -0,0 +1,36 @@
// lw_thread_test.cpp
//
// Copyright 2018 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
#include <boost/detail/lightweight_thread.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/smart_ptr/detail/atomic_count.hpp>
boost::detail::atomic_count count( 0 );
void f()
{
++count;
}
int main()
{
int const N = 4;
boost::detail::lw_thread_t th[ N ] = {};
for( int i = 0; i < N; ++i )
{
boost::detail::lw_thread_create( th[ i ], f );
}
for( int i = 0; i < N; ++i )
{
boost::detail::lw_thread_join( th[ i ] );
}
BOOST_TEST_EQ( count, N );
return boost::report_errors();
}

View File

@@ -0,0 +1,262 @@
// make_local_shared_const_test.cpp
//
// Copyright 2007-2009, 2017, 2018 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 <boost/config.hpp>
#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) || defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES )
int main()
{
}
#else
#include <boost/core/lightweight_test.hpp>
#include <boost/smart_ptr/make_local_shared.hpp>
#include <boost/smart_ptr/local_shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <cstddef>
class X
{
private:
X( X const & );
X & operator=( X const & );
void * operator new( std::size_t n )
{
// lack of this definition causes link errors on Comeau C++
BOOST_ERROR( "private X::new called" );
return ::operator new( n );
}
void operator delete( void * p )
{
// lack of this definition causes link errors on MSVC
BOOST_ERROR( "private X::delete called" );
::operator delete( p );
}
public:
static int instances;
int v;
explicit X( int a1 = 0, int a2 = 0, int a3 = 0, int a4 = 0, int a5 = 0, int a6 = 0, int a7 = 0, int a8 = 0, int a9 = 0 ): v( a1+a2+a3+a4+a5+a6+a7+a8+a9 )
{
++instances;
}
~X()
{
--instances;
}
};
int X::instances = 0;
template<class T> static long use_count( boost::local_shared_ptr<T> const & p )
{
return boost::shared_ptr<T>( p ).use_count() - 1;
}
int main()
{
{
boost::local_shared_ptr<int const> pi = boost::make_local_shared<int const>();
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( *pi == 0 );
}
{
boost::local_shared_ptr<int const> pi = boost::make_local_shared<int const>( 5 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( *pi == 5 );
}
BOOST_TEST( X::instances == 0 );
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>();
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 0 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared_noinit<X const>();
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 0 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4, 5 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4, 5, 6 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4, 5, 6, 7 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4, 5, 6, 7, 8 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7+8 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::local_shared_ptr<X const> pi = boost::make_local_shared<X const>( 1, 2, 3, 4, 5, 6, 7, 8, 9 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.local_use_count() == 1 );
BOOST_TEST( use_count( pi ) == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7+8+9 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
return boost::report_errors();
}
#endif

View File

@@ -0,0 +1,43 @@
// make_shared_array_tmp_test.cpp
//
// Copyright 2017 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 <boost/make_shared.hpp>
#include <boost/core/lightweight_test.hpp>
struct X
{
static int destroyed;
~X()
{
++destroyed;
}
};
int X::destroyed = 0;
int main()
{
{
X::destroyed = 0;
boost::make_shared< X[3] >();
BOOST_TEST_EQ( X::destroyed, 3 );
}
{
X::destroyed = 0;
boost::make_shared< X[] >( 3 );
BOOST_TEST_EQ( X::destroyed, 3 );
}
return boost::report_errors();
}

View File

@@ -0,0 +1,232 @@
// make_shared_const_test.cpp
//
// Copyright 2007-2009, 2018 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 <boost/core/lightweight_test.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <cstddef>
class X
{
private:
X( X const & );
X & operator=( X const & );
void * operator new( std::size_t n )
{
// lack of this definition causes link errors on Comeau C++
BOOST_ERROR( "private X::new called" );
return ::operator new( n );
}
void operator delete( void * p )
{
// lack of this definition causes link errors on MSVC
BOOST_ERROR( "private X::delete called" );
::operator delete( p );
}
public:
static int instances;
int v;
explicit X( int a1 = 0, int a2 = 0, int a3 = 0, int a4 = 0, int a5 = 0, int a6 = 0, int a7 = 0, int a8 = 0, int a9 = 0 ): v( a1+a2+a3+a4+a5+a6+a7+a8+a9 )
{
++instances;
}
~X()
{
--instances;
}
};
int X::instances = 0;
int main()
{
{
boost::shared_ptr<int const> pi = boost::make_shared<int const>();
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( *pi == 0 );
}
{
boost::shared_ptr<int const> pi = boost::make_shared<int const>( 5 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( *pi == 5 );
}
BOOST_TEST( X::instances == 0 );
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>();
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 0 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared_noinit<X const>();
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 0 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4, 5 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4, 5, 6 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4, 5, 6, 7 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4, 5, 6, 7, 8 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7+8 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
{
boost::shared_ptr<X const> pi = boost::make_shared<X const>( 1, 2, 3, 4, 5, 6, 7, 8, 9 );
boost::weak_ptr<X const> wp( pi );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( pi.get() != 0 );
BOOST_TEST( pi.use_count() == 1 );
BOOST_TEST( pi->v == 1+2+3+4+5+6+7+8+9 );
pi.reset();
BOOST_TEST( X::instances == 0 );
}
return boost::report_errors();
}

80
test/quick.cpp Normal file
View File

@@ -0,0 +1,80 @@
//
// quick.cpp - a quick (CI) test for Boost.SmartPtr
//
// Copyright 2017 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 <boost/smart_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
class X
{
private:
X( X const & );
X & operator=( X const & );
public:
static int instances;
X()
{
++instances;
}
~X()
{
--instances;
}
};
int X::instances = 0;
int main()
{
{
boost::shared_ptr<X> p1( new X );
BOOST_TEST_EQ( X::instances, 1 );
BOOST_TEST_EQ( p1.use_count(), 1 );
boost::shared_ptr<X> p2( p1 );
BOOST_TEST_EQ( p2.use_count(), 2 );
boost::weak_ptr<X> wp( p1 );
BOOST_TEST_EQ( wp.use_count(), 2 );
p1.reset();
BOOST_TEST_EQ( wp.use_count(), 1 );
p2.reset();
BOOST_TEST_EQ( wp.use_count(), 0 );
BOOST_TEST_EQ( X::instances, 0 );
}
{
boost::shared_ptr<X> p1 = boost::make_shared<X>();
BOOST_TEST_EQ( X::instances, 1 );
BOOST_TEST_EQ( p1.use_count(), 1 );
boost::shared_ptr<X> p2( p1 );
BOOST_TEST_EQ( p2.use_count(), 2 );
boost::weak_ptr<X> wp( p1 );
BOOST_TEST_EQ( wp.use_count(), 2 );
p1.reset();
BOOST_TEST_EQ( wp.use_count(), 1 );
p2.reset();
BOOST_TEST_EQ( wp.use_count(), 0 );
BOOST_TEST_EQ( X::instances, 0 );
}
return boost::report_errors();
}

View File

@@ -764,7 +764,7 @@ void weak_ptr_constructor()
boost::shared_ptr<Y> p2(wp);
BOOST_ERROR("shared_ptr<Y> p2(wp) failed to throw");
}
catch(boost::bad_weak_ptr)
catch(boost::bad_weak_ptr const&)
{
}
@@ -773,7 +773,7 @@ void weak_ptr_constructor()
boost::shared_ptr<X> p3(wp);
BOOST_ERROR("shared_ptr<X> p3(wp) failed to throw");
}
catch(boost::bad_weak_ptr)
catch(boost::bad_weak_ptr const&)
{
}
}
@@ -829,7 +829,7 @@ void weak_ptr_constructor()
boost::shared_ptr<Y> p2(wp);
BOOST_ERROR("shared_ptr<Y> p2(wp) failed to throw");
}
catch(boost::bad_weak_ptr)
catch(boost::bad_weak_ptr const&)
{
}
@@ -838,7 +838,7 @@ void weak_ptr_constructor()
boost::shared_ptr<X> p3(wp);
BOOST_ERROR("shared_ptr<X> p3(wp) failed to throw");
}
catch(boost::bad_weak_ptr)
catch(boost::bad_weak_ptr const&)
{
}
}

View File

@@ -14,6 +14,8 @@
// 20 Jul 99 header name changed to .hpp
// 20 Apr 99 additional error tests added.
#define _CRT_SECURE_NO_WARNINGS
#include <boost/config.hpp>
#if defined(BOOST_MSVC)

View File

@@ -17,7 +17,7 @@
# undef HAVE_CONSTEXPR_INIT
#endif
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1910 )
#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
# undef HAVE_CONSTEXPR_INIT
#endif

View File

@@ -17,7 +17,7 @@
# undef HAVE_CONSTEXPR_INIT
#endif
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1910 )
#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
# undef HAVE_CONSTEXPR_INIT
#endif

View File

@@ -13,9 +13,20 @@
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
#include <boost/detail/lightweight_test.hpp>
#ifndef __LP64__
typedef long long_type;
#else
// On Cygwin 64, long is 64 bit
typedef int long_type;
#endif
int main()
{
long x = 0, r;
long_type x = 0, r;
r = BOOST_SP_INTERLOCKED_INCREMENT( &x );

View File

@@ -0,0 +1,11 @@
// Copyright 2018 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <windows.h>
# include <boost/shared_ptr.hpp>
#endif
int main()
{
}

View File

@@ -0,0 +1,11 @@
// Copyright 2018 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <windows.h>
# include <boost/smart_ptr/detail/spinlock.hpp>
#endif
int main()
{
}

View File

@@ -0,0 +1,11 @@
// Copyright 2018 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <windows.h>
# include <boost/smart_ptr/detail/yield_k.hpp>
#endif
int main()
{
}