summaryrefslogtreecommitdiff
path: root/boost/smart_ptr/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/smart_ptr/detail')
-rw-r--r--boost/smart_ptr/detail/array_allocator.hpp318
-rw-r--r--boost/smart_ptr/detail/array_count_impl.hpp67
-rw-r--r--boost/smart_ptr/detail/array_traits.hpp60
-rw-r--r--boost/smart_ptr/detail/array_utility.hpp214
-rw-r--r--boost/smart_ptr/detail/shared_count.hpp62
-rw-r--r--boost/smart_ptr/detail/sp_counted_base.hpp2
-rw-r--r--boost/smart_ptr/detail/sp_counted_impl.hpp8
-rw-r--r--boost/smart_ptr/detail/sp_has_sync.hpp6
-rw-r--r--boost/smart_ptr/detail/sp_if_array.hpp34
-rw-r--r--boost/smart_ptr/detail/sp_noexcept.hpp30
10 files changed, 38 insertions, 763 deletions
diff --git a/boost/smart_ptr/detail/array_allocator.hpp b/boost/smart_ptr/detail/array_allocator.hpp
deleted file mode 100644
index 71479967bc..0000000000
--- a/boost/smart_ptr/detail/array_allocator.hpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Glen Joseph Fernandes
- * glenfe at live dot com
- *
- * 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)
- */
-#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_ALLOCATOR_HPP
-#define BOOST_SMART_PTR_DETAIL_ARRAY_ALLOCATOR_HPP
-
-#include <boost/align/align.hpp>
-#include <boost/smart_ptr/detail/array_traits.hpp>
-#include <boost/smart_ptr/detail/array_utility.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-
-namespace boost {
- namespace detail {
- struct ms_init_tag { };
- struct ms_noinit_tag { };
-
- template<class T>
- struct ms_allocator_state;
-
- template<class T>
- struct ms_allocator_state<T[]> {
- typedef typename array_base<T>::type type;
-
- ms_allocator_state(std::size_t size_,
- type** result_)
- : size(size_ * array_total<T>::size),
- result(result_) {
- }
-
- std::size_t size;
-
- union {
- type** result;
- type* object;
- };
- };
-
- template<class T, std::size_t N>
- struct ms_allocator_state<T[N]> {
- typedef typename array_base<T>::type type;
-
- ms_allocator_state(type** result_)
- : result(result_) {
- }
-
- enum {
- size = array_total<T[N]>::size
- };
-
- union {
- type** result;
- type* object;
- };
- };
-
- template<class A, class T, class R>
- class as_allocator
- : public A {
- template<class A_, class T_, class R_>
- friend class as_allocator;
-
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- typedef std::allocator_traits<A> AT;
- typedef typename AT::template rebind_alloc<char> CA;
- typedef typename AT::template rebind_traits<char> CT;
-#else
- typedef typename A::template rebind<char>::other CA;
-#endif
-
- public:
- typedef A allocator_type;
-
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- typedef typename AT::value_type value_type;
- typedef typename AT::pointer pointer;
- typedef typename AT::const_pointer const_pointer;
- typedef typename AT::void_pointer void_pointer;
- typedef typename AT::const_void_pointer const_void_pointer;
- typedef typename AT::size_type size_type;
- typedef typename AT::difference_type difference_type;
-#else
- typedef typename A::value_type value_type;
- typedef typename A::pointer pointer;
- typedef typename A::const_pointer const_pointer;
- typedef typename A::size_type size_type;
- typedef typename A::difference_type difference_type;
- typedef typename A::reference reference;
- typedef typename A::const_reference const_reference;
- typedef void* void_pointer;
- typedef const void* const_void_pointer;
-#endif
-
- template<class U>
- struct rebind {
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- typedef as_allocator<typename AT::
- template rebind_alloc<U>, T, R> other;
-#else
- typedef as_allocator<typename A::
- template rebind<U>::other, T, R> other;
-#endif
- };
-
- typedef typename array_base<T>::type type;
-
- as_allocator(const A& allocator_, type** result)
- : A(allocator_),
- data(result) {
- }
-
- as_allocator(const A& allocator_, std::size_t size,
- type** result)
- : A(allocator_),
- data(size, result) {
- }
-
- template<class U>
- as_allocator(const as_allocator<U, T, R>& other)
- : A(other.allocator()),
- data(other.data) {
- }
-
- pointer allocate(size_type count, const_void_pointer = 0) {
- enum {
- M = boost::alignment_of<type>::value
- };
- std::size_t n1 = count * sizeof(value_type);
- std::size_t n2 = data.size * sizeof(type);
- std::size_t n3 = n2 + M;
- CA ca(allocator());
- void* p1 = ca.allocate(n1 + n3);
- void* p2 = static_cast<char*>(p1) + n1;
- (void)boost::alignment::align(M, n2, p2, n3);
- *data.result = static_cast<type*>(p2);
- return static_cast<value_type*>(p1);
- }
-
- void deallocate(pointer memory, size_type count) {
- enum {
- M = boost::alignment_of<type>::value
- };
- std::size_t n1 = count * sizeof(value_type);
- std::size_t n2 = data.size * sizeof(type) + M;
- char* p1 = reinterpret_cast<char*>(memory);
- CA ca(allocator());
- ca.deallocate(p1, n1 + n2);
- }
-
- const A& allocator() const {
- return static_cast<const A&>(*this);
- }
-
- A& allocator() {
- return static_cast<A&>(*this);
- }
-
- void set(type* memory) {
- data.object = memory;
- }
-
- void operator()() {
- if (data.object) {
- R tag;
- release(tag);
- }
- }
-
- private:
- void release(ms_init_tag) {
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- as_destroy(allocator(), data.object, data.size);
-#else
- ms_destroy(data.object, data.size);
-#endif
- }
-
- void release(ms_noinit_tag) {
- ms_destroy(data.object, data.size);
- }
-
- ms_allocator_state<T> data;
- };
-
- template<class A1, class A2, class T, class R>
- bool operator==(const as_allocator<A1, T, R>& a1,
- const as_allocator<A2, T, R>& a2) {
- return a1.allocator() == a2.allocator();
- }
-
- template<class A1, class A2, class T, class R>
- bool operator!=(const as_allocator<A1, T, R>& a1,
- const as_allocator<A2, T, R>& a2) {
- return a1.allocator() != a2.allocator();
- }
-
- template<class T, class Y = char>
- class ms_allocator;
-
- template<class T, class Y>
- class ms_allocator {
- template<class T_, class Y_>
- friend class ms_allocator;
-
- public:
- typedef typename array_base<T>::type type;
-
- typedef Y value_type;
- typedef Y* pointer;
- typedef const Y* const_pointer;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef Y& reference;
- typedef const Y& const_reference;
-
- template<class U>
- struct rebind {
- typedef ms_allocator<T, U> other;
- };
-
- ms_allocator(type** result)
- : data(result) {
- }
-
- ms_allocator(std::size_t size, type** result)
- : data(size, result) {
- }
-
- template<class U>
- ms_allocator(const ms_allocator<T, U>& other)
- : data(other.data) {
- }
-
- pointer allocate(size_type count, const void* = 0) {
- enum {
- M = boost::alignment_of<type>::value
- };
- std::size_t n1 = count * sizeof(Y);
- std::size_t n2 = data.size * sizeof(type);
- std::size_t n3 = n2 + M;
- void* p1 = ::operator new(n1 + n3);
- void* p2 = static_cast<char*>(p1) + n1;
- (void)boost::alignment::align(M, n2, p2, n3);
- *data.result = static_cast<type*>(p2);
- return static_cast<Y*>(p1);
- }
-
- void deallocate(pointer memory, size_type) {
- void* p1 = memory;
- ::operator delete(p1);
- }
-
-#if defined(BOOST_NO_CXX11_ALLOCATOR)
- pointer address(reference value) const {
- return &value;
- }
-
- const_pointer address(const_reference value) const {
- return &value;
- }
-
- size_type max_size() const {
- enum {
- N = static_cast<std::size_t>(-1) / sizeof(Y)
- };
- return N;
- }
-
- void construct(pointer memory, const_reference value) {
- void* p1 = memory;
- ::new(p1) Y(value);
- }
-
- void destroy(pointer memory) {
- (void)memory;
- memory->~Y();
- }
-#endif
-
- void set(type* memory) {
- data.object = memory;
- }
-
- void operator()() {
- if (data.object) {
- ms_destroy(data.object, data.size);
- }
- }
-
- private:
- ms_allocator_state<T> data;
- };
-
- template<class T, class Y1, class Y2>
- bool operator==(const ms_allocator<T, Y1>&,
- const ms_allocator<T, Y2>&) {
- return true;
- }
-
- template<class T, class Y1, class Y2>
- bool operator!=(const ms_allocator<T, Y1>&,
- const ms_allocator<T, Y2>&) {
- return false;
- }
-
- class ms_in_allocator_tag {
- public:
- void operator()(const void*) {
- }
- };
- }
-}
-
-#endif
diff --git a/boost/smart_ptr/detail/array_count_impl.hpp b/boost/smart_ptr/detail/array_count_impl.hpp
deleted file mode 100644
index b7c9617f0b..0000000000
--- a/boost/smart_ptr/detail/array_count_impl.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2014 Glen Joseph Fernandes
- * glenfe at live dot com
- *
- * 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)
- */
-#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
-#define BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
-
-#include <boost/smart_ptr/detail/array_allocator.hpp>
-#include <boost/smart_ptr/detail/sp_counted_impl.hpp>
-
-namespace boost {
- namespace detail {
- template<class P, class A>
- class sp_counted_impl_pda<P, ms_in_allocator_tag, A>
- : public sp_counted_base {
- typedef ms_in_allocator_tag D;
- typedef sp_counted_impl_pda<P, D, A> Y;
- public:
- sp_counted_impl_pda(P, D, const A& allocator_)
- : allocator(allocator_) {
- }
-
- virtual void dispose() {
- allocator();
- }
-
- virtual void destroy() {
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- typedef typename std::allocator_traits<A>::
- template rebind_alloc<Y> YA;
- typedef typename std::allocator_traits<A>::
- template rebind_traits<Y> YT;
-#else
- typedef typename A::template rebind<Y>::other YA;
-#endif
- YA a1(allocator);
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- YT::destroy(a1, this);
- YT::deallocate(a1, this, 1);
-#else
- this->~Y();
- a1.deallocate(this, 1);
-#endif
- }
-
- virtual void* get_deleter(const sp_typeinfo&) {
- return &reinterpret_cast<char&>(allocator);
- }
-
- virtual void* get_untyped_deleter() {
- return &reinterpret_cast<char&>(allocator);
- }
-
- private:
- sp_counted_impl_pda(const sp_counted_impl_pda&);
- sp_counted_impl_pda& operator=(const sp_counted_impl_pda&);
-
- A allocator;
- };
- }
-}
-
-#endif
diff --git a/boost/smart_ptr/detail/array_traits.hpp b/boost/smart_ptr/detail/array_traits.hpp
deleted file mode 100644
index 819c5ba619..0000000000
--- a/boost/smart_ptr/detail/array_traits.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Glen Joseph Fernandes
- * glenfe at live dot com
- *
- * 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)
- */
-#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
-#define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
-
-#include <boost/type_traits/remove_cv.hpp>
-
-namespace boost {
- namespace detail {
- template<class T>
- struct array_base {
- typedef typename boost::remove_cv<T>::type type;
- };
-
- template<class T>
- struct array_base<T[]> {
- typedef typename array_base<T>::type type;
- };
-
- template<class T, std::size_t N>
- struct array_base<T[N]> {
- typedef typename array_base<T>::type type;
- };
-
- template<class T>
- struct array_total {
- enum {
- size = 1
- };
- };
-
- template<class T, std::size_t N>
- struct array_total<T[N]> {
- enum {
- size = N * array_total<T>::size
- };
- };
-
- template<class T>
- struct array_inner;
-
- template<class T>
- struct array_inner<T[]> {
- typedef T type;
- };
-
- template<class T, std::size_t N>
- struct array_inner<T[N]> {
- typedef T type;
- };
- }
-}
-
-#endif
diff --git a/boost/smart_ptr/detail/array_utility.hpp b/boost/smart_ptr/detail/array_utility.hpp
deleted file mode 100644
index 84029a1d77..0000000000
--- a/boost/smart_ptr/detail/array_utility.hpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Glen Joseph Fernandes
- * glenfe at live dot com
- *
- * 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)
- */
-#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_UTILITY_HPP
-#define BOOST_SMART_PTR_DETAIL_ARRAY_UTILITY_HPP
-
-#include <boost/config.hpp>
-#include <boost/type_traits/has_trivial_constructor.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
-#include <memory>
-#endif
-
-namespace boost {
- namespace detail {
- typedef boost::true_type ms_is_trivial;
- typedef boost::false_type ms_no_trivial;
-
- template<class T>
- inline void ms_destroy(T*, std::size_t, ms_is_trivial) {
- }
-
- template<class T>
- inline void ms_destroy(T* memory, std::size_t size, ms_no_trivial) {
- for (std::size_t i = size; i > 0;) {
- memory[--i].~T();
- }
- }
-
- template<class T>
- inline void ms_destroy(T* memory, std::size_t size) {
- boost::has_trivial_destructor<T> trivial;
- ms_destroy(memory, size, trivial);
- }
-
- template<class T>
- inline void ms_init(T* memory, std::size_t size, ms_is_trivial) {
- for (std::size_t i = 0; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T();
- }
- }
-
- template<class T>
- inline void ms_init(T* memory, std::size_t size, ms_no_trivial) {
-#if !defined(BOOST_NO_EXCEPTIONS)
- std::size_t i = 0;
- try {
- for (; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T();
- }
- } catch (...) {
- ms_destroy(memory, i);
- throw;
- }
-#else
- for (std::size_t i = 0; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T();
- }
-#endif
- }
-
- template<class T>
- inline void ms_init(T* memory, std::size_t size) {
- boost::has_trivial_default_constructor<T> trivial;
- ms_init(memory, size, trivial);
- }
-
- template<class T, std::size_t N>
- inline void ms_init(T* memory, std::size_t size, const T* list) {
-#if !defined(BOOST_NO_EXCEPTIONS)
- std::size_t i = 0;
- try {
- for (; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T(list[i % N]);
- }
- } catch (...) {
- ms_destroy(memory, i);
- throw;
- }
-#else
- for (std::size_t i = 0; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T(list[i % N]);
- }
-#endif
- }
-
-#if !defined(BOOST_NO_CXX11_ALLOCATOR)
- template<class T, class A>
- inline void as_destroy(const A& allocator, T* memory,
- std::size_t size) {
- typedef typename std::allocator_traits<A>::
- template rebind_alloc<T> TA;
- typedef typename std::allocator_traits<A>::
- template rebind_traits<T> TT;
- TA a2(allocator);
- for (std::size_t i = size; i > 0;) {
- TT::destroy(a2, &memory[--i]);
- }
- }
-
- template<class T, class A>
- inline void as_init(const A& allocator, T* memory, std::size_t size,
- ms_is_trivial) {
- typedef typename std::allocator_traits<A>::
- template rebind_alloc<T> TA;
- typedef typename std::allocator_traits<A>::
- template rebind_traits<T> TT;
- TA a2(allocator);
- for (std::size_t i = 0; i < size; i++) {
- TT::construct(a2, memory + i);
- }
- }
-
- template<class T, class A>
- inline void as_init(const A& allocator, T* memory, std::size_t size,
- ms_no_trivial) {
- typedef typename std::allocator_traits<A>::
- template rebind_alloc<T> TA;
- typedef typename std::allocator_traits<A>::
- template rebind_traits<T> TT;
- TA a2(allocator);
-#if !defined(BOOST_NO_EXCEPTIONS)
- std::size_t i = 0;
- try {
- for (; i < size; i++) {
- TT::construct(a2, memory + i);
- }
- } catch (...) {
- as_destroy(a2, memory, i);
- throw;
- }
-#else
- for (std::size_t i = 0; i < size; i++) {
- TT::construct(a2, memory + i);
- }
-#endif
- }
-
- template<class T, class A>
- inline void as_init(const A& allocator, T* memory, std::size_t size) {
- boost::has_trivial_default_constructor<T> trivial;
- as_init(allocator, memory, size, trivial);
- }
-
- template<class T, class A, std::size_t N>
- inline void as_init(const A& allocator, T* memory, std::size_t size,
- const T* list) {
- typedef typename std::allocator_traits<A>::
- template rebind_alloc<T> TA;
- typedef typename std::allocator_traits<A>::
- template rebind_traits<T> TT;
- TA a2(allocator);
-#if !defined(BOOST_NO_EXCEPTIONS)
- std::size_t i = 0;
- try {
- for (; i < size; i++) {
- TT::construct(a2, memory + i, list[i % N]);
- }
- } catch (...) {
- as_destroy(a2, memory, i);
- throw;
- }
-#else
- for (std::size_t i = 0; i < size; i++) {
- TT::construct(a2, memory + i, list[i % N]);
- }
-#endif
- }
-#endif
-
- template<class T>
- inline void ms_noinit(T*, std::size_t, ms_is_trivial) {
- }
-
- template<class T>
- inline void ms_noinit(T* memory, std::size_t size, ms_no_trivial) {
-#if !defined(BOOST_NO_EXCEPTIONS)
- std::size_t i = 0;
- try {
- for (; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T;
- }
- } catch (...) {
- ms_destroy(memory, i);
- throw;
- }
-#else
- for (std::size_t i = 0; i < size; i++) {
- void* p1 = memory + i;
- ::new(p1) T;
- }
-#endif
- }
-
- template<class T>
- inline void ms_noinit(T* memory, std::size_t size) {
- boost::has_trivial_default_constructor<T> trivial;
- ms_noinit(memory, size, trivial);
- }
- }
-}
-
-#endif
diff --git a/boost/smart_ptr/detail/shared_count.hpp b/boost/smart_ptr/detail/shared_count.hpp
index 7996aa4325..9813842300 100644
--- a/boost/smart_ptr/detail/shared_count.hpp
+++ b/boost/smart_ptr/detail/shared_count.hpp
@@ -249,18 +249,8 @@ public:
try
{
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
- pi_ = pi;
- std::allocator_traits<A2>::construct( a2, pi, p, d, a );
-
-#else
-
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
+ pi_ = a2.allocate( 1 );
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
-
-#endif
}
catch(...)
{
@@ -276,28 +266,11 @@ public:
#else
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
- pi_ = pi;
-
-#else
-
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
-
-#endif
+ pi_ = a2.allocate( 1 );
if( pi_ != 0 )
{
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- std::allocator_traits<A2>::construct( a2, pi, p, d, a );
-
-#else
-
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
-
-#endif
}
else
{
@@ -333,18 +306,8 @@ public:
try
{
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
- pi_ = pi;
- std::allocator_traits<A2>::construct( a2, pi, p, a );
-
-#else
-
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
+ pi_ = a2.allocate( 1 );
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
-
-#endif
}
catch(...)
{
@@ -360,28 +323,11 @@ public:
#else
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
- pi_ = pi;
-
-#else
-
- pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
-
-#endif
+ pi_ = a2.allocate( 1 );
if( pi_ != 0 )
{
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- std::allocator_traits<A2>::construct( a2, pi, p, a );
-
-#else
-
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
-
-#endif
}
else
{
diff --git a/boost/smart_ptr/detail/sp_counted_base.hpp b/boost/smart_ptr/detail/sp_counted_base.hpp
index 83ede23173..438613765b 100644
--- a/boost/smart_ptr/detail/sp_counted_base.hpp
+++ b/boost/smart_ptr/detail/sp_counted_base.hpp
@@ -20,7 +20,7 @@
#include <boost/config.hpp>
#include <boost/smart_ptr/detail/sp_has_sync.hpp>
-#if defined( __clang__ ) && defined( __has_extension )
+#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension )
# if __has_extension( __c_atomic__ )
# define BOOST_SP_HAS_CLANG_C11_ATOMICS
# endif
diff --git a/boost/smart_ptr/detail/sp_counted_impl.hpp b/boost/smart_ptr/detail/sp_counted_impl.hpp
index 1222f3c9f4..b29769e3af 100644
--- a/boost/smart_ptr/detail/sp_counted_impl.hpp
+++ b/boost/smart_ptr/detail/sp_counted_impl.hpp
@@ -236,16 +236,8 @@ public:
A2 a2( a_ );
-#if !defined( BOOST_NO_CXX11_ALLOCATOR )
-
- std::allocator_traits<A2>::destroy( a2, this );
-
-#else
-
this->~this_type();
-#endif
-
a2.deallocate( this, 1 );
}
diff --git a/boost/smart_ptr/detail/sp_has_sync.hpp b/boost/smart_ptr/detail/sp_has_sync.hpp
index 16de21d379..e1debf0cc9 100644
--- a/boost/smart_ptr/detail/sp_has_sync.hpp
+++ b/boost/smart_ptr/detail/sp_has_sync.hpp
@@ -22,15 +22,15 @@
#ifndef BOOST_SP_NO_SYNC
-#if defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 )
+#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 )
# define BOOST_SP_HAS_SYNC
-#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 )
+#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ )
# define BOOST_SP_HAS_SYNC
-#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
+#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
#define BOOST_SP_HAS_SYNC
diff --git a/boost/smart_ptr/detail/sp_if_array.hpp b/boost/smart_ptr/detail/sp_if_array.hpp
deleted file mode 100644
index 9a2c1e0baa..0000000000
--- a/boost/smart_ptr/detail/sp_if_array.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Glen Joseph Fernandes
- * glenfe at live dot com
- *
- * 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)
- */
-#ifndef BOOST_SMART_PTR_DETAIL_SP_IF_ARRAY_HPP
-#define BOOST_SMART_PTR_DETAIL_SP_IF_ARRAY_HPP
-
-#include <boost/smart_ptr/shared_ptr.hpp>
-
-namespace boost {
- namespace detail {
- template<class T>
- struct sp_if_array;
-
- template<class T>
- struct sp_if_array<T[]> {
- typedef boost::shared_ptr<T[]> type;
- };
-
- template<class T>
- struct sp_if_size_array;
-
- template<class T, std::size_t N>
- struct sp_if_size_array<T[N]> {
- typedef boost::shared_ptr<T[N]> type;
- };
- }
-}
-
-#endif
diff --git a/boost/smart_ptr/detail/sp_noexcept.hpp b/boost/smart_ptr/detail/sp_noexcept.hpp
new file mode 100644
index 0000000000..6818dce38d
--- /dev/null
+++ b/boost/smart_ptr/detail/sp_noexcept.hpp
@@ -0,0 +1,30 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// detail/sp_noexcept.hpp
+//
+// Copyright 2016 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_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900
+
+#define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW
+
+#else
+
+#define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT
+
+#endif
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED