diff --git a/bench/bench_alloc.cpp b/bench/bench_alloc.cpp index 713a8b9..a6abef7 100644 --- a/bench/bench_alloc.cpp +++ b/bench/bench_alloc.cpp @@ -13,7 +13,6 @@ #endif #include -#include #include #define BOOST_INTERPROCESS_VECTOR_ALLOC_STATS @@ -63,7 +62,7 @@ void allocation_timing_test(std::size_t num_iterations, std::size_t num_elements dlmalloc_free(first_mem); ++numalloc; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ dlmalloc_command_ret_t ret; for(size_t e = capacity + 1; e < num_elements; ++e){ size_t received_size; @@ -101,11 +100,11 @@ void allocation_timing_test(std::size_t num_iterations, std::size_t num_elements } dlmalloc_free(addr); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ dlmalloc_free(addr); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } assert( dlmalloc_allocated_memory() == 0); diff --git a/bench/bench_alloc_expand_bwd.cpp b/bench/bench_alloc_expand_bwd.cpp index 9a8c4fa..a362d96 100644 --- a/bench/bench_alloc_expand_bwd.cpp +++ b/bench/bench_alloc_expand_bwd.cpp @@ -13,7 +13,6 @@ #endif #include -#include #define BOOST_CONTAINER_VECTOR_ALLOC_STATS @@ -114,7 +113,7 @@ void vector_test_template(std::size_t num_iterations, std::size_t num_elements, bc::vector v; v.reset_alloc_stats(); void *first_mem = 0; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ first_mem = bc::dlmalloc_malloc(sizeof(MyInt)*num_elements*3/2); v.push_back(MyInt(0)); bc::dlmalloc_free(first_mem); @@ -126,11 +125,11 @@ void vector_test_template(std::size_t num_iterations, std::size_t num_elements, numexpand += v.num_expand_bwd; capacity = static_cast(v.capacity()); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ bc::dlmalloc_free(first_mem); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } assert(bc::dlmalloc_allocated_memory() == 0); diff --git a/bench/bench_set.hpp b/bench/bench_set.hpp index 7211b9a..83215d8 100644 --- a/bench/bench_set.hpp +++ b/bench/bench_set.hpp @@ -19,7 +19,6 @@ #include #include #include -#include using boost::move_detail::cpu_timer; using boost::move_detail::cpu_times; diff --git a/bench/bench_static_vector.cpp b/bench/bench_static_vector.cpp index 29da30d..127b79f 100644 --- a/bench/bench_static_vector.cpp +++ b/bench/bench_static_vector.cpp @@ -16,7 +16,6 @@ #include "varray.hpp" #include #include -#include #include "../test/movable_int.hpp" #include diff --git a/bench/detail/varray_util.hpp b/bench/detail/varray_util.hpp index ee247c1..cb2dd77 100644 --- a/bench/detail/varray_util.hpp +++ b/bench/detail/varray_util.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -251,18 +250,18 @@ O uninitialized_move_dispatch(I first, I last, O dst, O o = dst; - BOOST_TRY + BOOST_CONTAINER_TRY { typedef typename boost::container::iterator_traits::value_type value_type; for (; first != last; ++first, ++o ) new (boost::container::dtl::addressof(*o)) value_type(boost::move(*first)); } - BOOST_CATCH(...) + BOOST_CONTAINER_CATCH(...) { destroy(dst, o); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return dst; } @@ -431,17 +430,17 @@ void uninitialized_fill_dispatch(I first, I last, typedef typename ::boost::container::iterator_traits::value_type value_type; I it = first; - BOOST_TRY + BOOST_CONTAINER_TRY { for ( ; it != last ; ++it ) new (boost::container::dtl::addressof(*it)) value_type(); // may throw } - BOOST_CATCH(...) + BOOST_CONTAINER_CATCH(...) { destroy(first, it); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template @@ -600,7 +599,7 @@ inline std::size_t uninitialized_copy_s(I first, I last, F dest, std::size_t max std::size_t count = 0; F it = dest; - BOOST_TRY + BOOST_CONTAINER_TRY { for ( ; first != last ; ++it, ++first, ++count ) { @@ -611,12 +610,12 @@ inline std::size_t uninitialized_copy_s(I first, I last, F dest, std::size_t max construct(0, it, *first); // may throw } } - BOOST_CATCH(...) + BOOST_CONTAINER_CATCH(...) { destroy(dest, it); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return count; } diff --git a/example/doc_custom_devector.cpp b/example/doc_custom_devector.cpp index c5c7974..91ab670 100644 --- a/example/doc_custom_devector.cpp +++ b/example/doc_custom_devector.cpp @@ -7,13 +7,9 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -#include //[doc_custom_devector #include #include -/*<-*/ -#include -/*->*/ //Make sure assertions are active #ifdef NDEBUG @@ -39,7 +35,7 @@ int main () bool exception_thrown = false; /*<-*/ #ifndef BOOST_NO_EXCEPTIONS - BOOST_TRY{ size_optimized_devector_t v(256); } BOOST_CATCH(...){ exception_thrown = true; } BOOST_CATCH_END + BOOST_CONTAINER_TRY{ size_optimized_devector_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END #else exception_thrown = true; #endif //BOOST_NO_EXCEPTIONS diff --git a/example/doc_custom_vector.cpp b/example/doc_custom_vector.cpp index ba3e473..c8db0bb 100644 --- a/example/doc_custom_vector.cpp +++ b/example/doc_custom_vector.cpp @@ -7,11 +7,9 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -#include //[doc_custom_vector #include #include -#include //Make sure assertions are active #ifdef NDEBUG @@ -36,7 +34,7 @@ int main () bool exception_thrown = false; /*<-*/ #ifndef BOOST_NO_EXCEPTIONS - BOOST_TRY{ size_optimized_vector_t v(256); } BOOST_CATCH(...){ exception_thrown = true; } BOOST_CATCH_END + BOOST_CONTAINER_TRY{ size_optimized_vector_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END #else exception_thrown = true; #endif //BOOST_NO_EXCEPTIONS diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 7c7f84d..dafcaa0 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -50,7 +50,6 @@ #include // other #include -#include // std #include @@ -434,16 +433,16 @@ class deque_base ptr_alloc_ptr nstart = this->members_.m_map + difference_type(this->members_.m_map_size - num_nodes) / 2; ptr_alloc_ptr nfinish = nstart + difference_type(num_nodes); - BOOST_TRY { + BOOST_CONTAINER_TRY { this->priv_create_nodes(nstart, nfinish); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); this->members_.m_map = 0; this->members_.m_map_size = 0; - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END this->members_.m_start.priv_set_node(nstart, get_block_size()); this->members_.m_finish.priv_set_node(nfinish - 1, get_block_size()); @@ -455,15 +454,15 @@ class deque_base void priv_create_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) { ptr_alloc_ptr cur = nstart; - BOOST_TRY { + BOOST_CONTAINER_TRY { for (; cur < nfinish; ++cur) *cur = this->priv_allocate_node(); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_destroy_nodes(nstart, cur); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } void priv_destroy_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) BOOST_NOEXCEPT_OR_NOTHROW @@ -2123,15 +2122,15 @@ class deque : protected deque_base::type, const size_type raw_gap = n - elemsafter; ::boost::container::uninitialized_move_alloc (this->alloc(), pos, old_finish, old_finish + difference_type(raw_gap)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ proxy.copy_n_and_update(this->alloc(), pos, elemsafter); proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_destroy_range(old_finish, old_finish + difference_type(elemsafter)); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END this->members_.m_finish = new_finish; } } @@ -2176,7 +2175,7 @@ class deque : protected deque_base::type, void priv_fill_initialize(const value_type& value) { index_pointer cur = this->members_.m_start.m_node; - BOOST_TRY { + BOOST_CONTAINER_TRY { for ( ; cur < this->members_.m_finish.m_node; ++cur){ boost::container::uninitialized_fill_alloc (this->alloc(), *cur, *cur + get_block_ssize(), value); @@ -2184,26 +2183,26 @@ class deque : protected deque_base::type, boost::container::uninitialized_fill_alloc (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur, get_block_size())); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template void priv_range_initialize(InIt first, InIt last, typename iterator_enable_if_tag::type* =0) { this->priv_initialize_map(0); - BOOST_TRY { + BOOST_CONTAINER_TRY { for ( ; first != last; ++first) this->emplace_back(*first); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->clear(); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template @@ -2214,7 +2213,7 @@ class deque : protected deque_base::type, this->priv_initialize_map(n); index_pointer cur_node = this->members_.m_start.m_node; - BOOST_TRY { + BOOST_CONTAINER_TRY { for (; cur_node < this->members_.m_finish.m_node; ++cur_node) { FwdIt mid = first; boost::container::iterator_uadvance(mid, get_block_size()); @@ -2223,11 +2222,11 @@ class deque : protected deque_base::type, } ::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.m_first); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node, get_block_size())); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } // Called only if this->members_.m_finish.m_cur == this->members_.m_finish.m_first. @@ -2268,16 +2267,16 @@ class deque : protected deque_base::type, this->priv_reallocate_map(new_nodes, true); } size_type i = 1; - BOOST_TRY { + BOOST_CONTAINER_TRY { for (; i <= new_nodes; ++i) *(this->members_.m_start.m_node - difference_type(i)) = this->priv_allocate_node(); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { for (size_type j = 1; j < i; ++j) this->priv_deallocate_node(*(this->members_.m_start.m_node - difference_type(j))); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } return this->members_.m_start - difference_type(n); } @@ -2293,16 +2292,16 @@ class deque : protected deque_base::type, this->priv_reallocate_map(new_nodes, false); } size_type i = 1; - BOOST_TRY { + BOOST_CONTAINER_TRY { for (; i <= new_nodes; ++i) *(this->members_.m_finish.m_node + difference_type(i)) = this->priv_allocate_node(); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { for (size_type j = 1; j < i; ++j) this->priv_deallocate_node(*(this->members_.m_finish.m_node + difference_type(j))); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } return this->members_.m_finish + difference_type(n); } diff --git a/include/boost/container/detail/adaptive_node_pool_impl.hpp b/include/boost/container/detail/adaptive_node_pool_impl.hpp index 5342909..e340097 100644 --- a/include/boost/container/detail/adaptive_node_pool_impl.hpp +++ b/include/boost/container/detail/adaptive_node_pool_impl.hpp @@ -42,7 +42,6 @@ #include // other #include -#include #include namespace boost { @@ -760,7 +759,7 @@ class private_adaptive_node_pool_impl_common , const size_type real_num_node, const size_type num_subblocks) { size_type i = 0; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); while(i != n){ //If there are no free nodes we allocate all needed blocks @@ -800,12 +799,12 @@ class private_adaptive_node_pool_impl_common i += num_elems; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->priv_deallocate_nodes(chain, max_free_blocks, real_num_node, num_subblocks, real_block_alignment); this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); } diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index 39df13f..0238805 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -41,7 +41,6 @@ #include // other #include -#include namespace boost { namespace container { namespace dtl { @@ -315,14 +314,14 @@ struct insert_emplace_proxy typename dtl::aligned_storage::value>::type v; alloc_traits::construct(a, move_detail::force_ptr(&v), ::boost::forward(get(this->args_))...); value_type *vp = move_detail::force_ptr(&v); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ *p = ::boost::move(*vp); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ alloc_traits::destroy(a, vp); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END alloc_traits::destroy(a, vp); } }; @@ -438,14 +437,14 @@ struct insert_emplace_proxy_arg##N\ typename dtl::aligned_storage::value>::type v;\ alloc_traits::construct(a, move_detail::force_ptr(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ value_type *vp = move_detail::force_ptr(&v);\ - BOOST_TRY{\ + BOOST_CONTAINER_TRY{\ *p = ::boost::move(*vp);\ }\ - BOOST_CATCH(...){\ + BOOST_CONTAINER_CATCH(...){\ alloc_traits::destroy(a, vp);\ - BOOST_RETHROW\ + BOOST_CONTAINER_RETHROW\ }\ - BOOST_CATCH_END\ + BOOST_CONTAINER_CATCH_END\ alloc_traits::destroy(a, vp);\ }\ };\ diff --git a/include/boost/container/detail/allocator_version_traits.hpp b/include/boost/container/detail/allocator_version_traits.hpp index d82cac1..391f466 100644 --- a/include/boost/container/detail/allocator_version_traits.hpp +++ b/include/boost/container/detail/allocator_version_traits.hpp @@ -29,7 +29,6 @@ #include //allocation_type #include //integral_constant #include //pointer_traits -#include //BOOST_TRY namespace boost { namespace container { @@ -139,15 +138,15 @@ struct allocator_version_traits throw_logic_error("version 1 allocator without allocate_new flag"); } else{ - BOOST_TRY{ + BOOST_CONTAINER_TRY{ ret = a.allocate(prefer_in_recvd_out_size); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ if(!(command & nothrow_allocation)){ - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END reuse = pointer(); } return ret; diff --git a/include/boost/container/detail/copy_move_algo.hpp b/include/boost/container/detail/copy_move_algo.hpp index 58cd05f..a7d23a5 100644 --- a/include/boost/container/detail/copy_move_algo.hpp +++ b/include/boost/container/detail/copy_move_algo.hpp @@ -34,7 +34,6 @@ #include #include // other -#include #include // std #include //for memmove/memcpy @@ -351,19 +350,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc(Allocator &a, I f, I l, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (f != l) { allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); ++f; ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -396,20 +395,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n(Allocator &a, I f, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); ++f; ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -442,20 +441,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n_source(Allocator &a, I f, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); ++f; ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return f; } @@ -488,19 +487,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc(Allocator &a, I f, I l, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (f != l) { allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f); ++f; ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -533,20 +532,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n(Allocator &a, I f, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f); ++f; ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -579,19 +578,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n_source(Allocator &a, I f, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f); ++f; ++r; --n; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return f; } @@ -623,20 +622,20 @@ inline typename dtl::disable_if_memzero_initializable::type uninitialized_value_init_alloc_n(Allocator &a, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r)); ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -675,20 +674,20 @@ template inline F uninitialized_default_init_alloc_n(Allocator &a, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), default_init); ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } @@ -712,19 +711,19 @@ template inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t) { F back = f; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (f != l) { allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(f), t); ++f; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != l; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } @@ -748,20 +747,20 @@ template inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, std::size_t n, F r) { F back = r; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (n) { --n; allocator_traits::construct(a, boost::movelib::iterator_to_raw_pointer(r), v); ++r; } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ for (; back != r; ++back){ allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); } - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return r; } diff --git a/include/boost/container/detail/dispatch_uses_allocator.hpp b/include/boost/container/detail/dispatch_uses_allocator.hpp index 800b1b3..42fd4f4 100644 --- a/include/boost/container/detail/dispatch_uses_allocator.hpp +++ b/include/boost/container/detail/dispatch_uses_allocator.hpp @@ -33,8 +33,6 @@ #endif #include -#include - namespace boost { namespace container { namespace dtl { @@ -228,14 +226,14 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if BOOST_MO , Pair* p) { dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second)); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } @@ -249,14 +247,14 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if BOOST_MO , Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) { dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(x)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(y)); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template < typename ConstructAlloc @@ -296,15 +294,15 @@ typename dtl::enable_if< dtl::is_pair BOOST_MOVE_I void>::type\ (void)p; (void)q;\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ - BOOST_TRY{\ + BOOST_CONTAINER_TRY{\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ }\ - BOOST_CATCH(...) {\ + BOOST_CONTAINER_CATCH(...) {\ allocator_traits::destroy(construct_alloc, dtl::addressof(pair->first));\ - BOOST_RETHROW\ + BOOST_CONTAINER_RETHROW\ }\ - BOOST_CATCH_END\ + BOOST_CONTAINER_CATCH_END\ }\ // BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE) @@ -320,14 +318,14 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO { (void)t1; (void)t2; dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward(get(t1))...); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward(get(t2))...); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ allocator_traits::destroy(construct_alloc, dtl::addressof(pair->first)); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template< typename ConstructAlloc, typename ArgAlloc, class Pair @@ -356,15 +354,15 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO (void)p; (void)q;\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ - BOOST_TRY{\ + BOOST_CONTAINER_TRY{\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ - BOOST_CATCH(...) {\ + BOOST_CONTAINER_CATCH(...) {\ allocator_traits::destroy(construct_alloc, dtl::addressof(pair->first));\ - BOOST_RETHROW\ + BOOST_CONTAINER_RETHROW\ }\ - BOOST_CATCH_END\ + BOOST_CONTAINER_CATCH_END\ }\ // BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE) @@ -391,15 +389,15 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO (void)p; (void)q;\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ - BOOST_TRY{\ + BOOST_CONTAINER_TRY{\ dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ - BOOST_CATCH(...) {\ + BOOST_CONTAINER_CATCH(...) {\ allocator_traits::destroy(construct_alloc, dtl::addressof(pair->first));\ - BOOST_RETHROW\ + BOOST_CONTAINER_RETHROW\ }\ - BOOST_CATCH_END\ + BOOST_CONTAINER_CATCH_END\ }\ // BOOST_MOVE_ITER2D_0TOMAX(BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE) @@ -418,14 +416,14 @@ typename dtl::enable_if< dtl::is_pair, void >::type (ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) { dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(args)...); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } #else @@ -439,14 +437,14 @@ typename dtl::enable_if< dtl::is_pair, void >::type BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k));\ - BOOST_TRY{\ + BOOST_CONTAINER_TRY{\ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ }\ - BOOST_CATCH(...) {\ + BOOST_CONTAINER_CATCH(...) {\ allocator_traits::destroy(construct_alloc, dtl::addressof(p->first));\ - BOOST_RETHROW\ + BOOST_CONTAINER_RETHROW\ }\ - BOOST_CATCH_END\ + BOOST_CONTAINER_CATCH_END\ }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE) diff --git a/include/boost/container/detail/mutex.hpp b/include/boost/container/detail/mutex.hpp index 01e3cb5..2b5e28e 100644 --- a/include/boost/container/detail/mutex.hpp +++ b/include/boost/container/detail/mutex.hpp @@ -30,6 +30,8 @@ // Extremely Light-Weight wrapper classes for OS thread synchronization + + #define BOOST_MUTEX_HELPER_NONE 0 #define BOOST_MUTEX_HELPER_WIN32 1 #define BOOST_MUTEX_HELPER_PTHREAD 2 @@ -50,14 +52,6 @@ defined(__i386__) || defined(__x86_64__))) || \ (defined(_MSC_VER) && _MSC_VER>=1310)) #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_SPINLOCKS - #endif - - #if defined(BOOST_WINDOWS) - #include - #include - #ifndef BOOST_MUTEX_HELPER - #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_WIN32 - #endif #elif defined(BOOST_HAS_UNISTD_H) #include #if !defined(BOOST_MUTEX_HELPER) && (defined(_POSIX_THREADS) || defined(BOOST_HAS_PTHREADS)) @@ -74,11 +68,9 @@ //... #elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS #if defined(_MSC_VER) - #include - #define interlockedcompareexchange _InterlockedCompareExchange + #include #define interlockedexchange _InterlockedExchange #elif defined(WIN32) && defined(__GNUC__) - #define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b) #define interlockedexchange __sync_lock_test_and_set #endif /* Win32 */ @@ -123,8 +115,52 @@ /* How to yield for a spin lock */ #define SPINS_PER_YIELD 63 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + #if !defined( BOOST_USE_WINDOWS_H ) + #if defined (WIN32_PLATFORM_PSPC) + #define BOOST_CONTAINERWINAPI_IMPORT BOOST_SYMBOL_IMPORT + #elif defined (_WIN32_WCE) + #define BOOST_CONTAINERWINAPI_IMPORT + #else + #define BOOST_CONTAINERWINAPI_IMPORT BOOST_SYMBOL_IMPORT + #endif + + #if defined(WINAPI) + #define BOOST_CONTAINERWINAPI_WINAPI_CC WINAPI + #else + #if defined(_M_IX86) || defined(__i386__) + #define BOOST_CONTAINERWINAPI_DETAIL_STDCALL __stdcall + #else + #define BOOST_CONTAINERWINAPI_DETAIL_STDCALL + #endif + #define BOOST_CONTAINERWINAPI_WINAPI_CC BOOST_CONTAINERWINAPI_DETAIL_STDCALL + #endif + + #if !defined(__LP64__) + namespace boost { + namespace container_winapi { + typedef unsigned long DWORD_; + #else + typedef unsigned int DWORD_; + #endif + typedef int BOOL_; + }} + + extern "C" { + BOOST_CONTAINERWINAPI_IMPORT boost::container_winapi::DWORD_ BOOST_CONTAINERWINAPI_WINAPI_CC + SleepEx( + boost::container_winapi::DWORD_ dwMilliseconds, + boost::container_winapi::BOOL_ bAlertable); + } // extern "C" + #endif + + namespace boost { + namespace container_winapi { + using ::SleepEx; + } + } + #define SLEEP_EX_DURATION 50 /* delay for yield/sleep */ - #define SPIN_LOCK_YIELD boost::winapi::SleepEx(SLEEP_EX_DURATION, 0) + #define SPIN_LOCK_YIELD boost::container_winapi::SleepEx(SLEEP_EX_DURATION, 0) #elif defined (__SVR4) && defined (__sun) /* solaris */ #include #define SPIN_LOCK_YIELD thr_yield(); diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp index 3efdb0f..8db384e 100644 --- a/include/boost/container/detail/node_alloc_holder.hpp +++ b/include/boost/container/detail/node_alloc_holder.hpp @@ -45,8 +45,6 @@ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include #endif -// other -#include namespace boost { @@ -417,26 +415,26 @@ struct node_alloc_holder NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key) { NodePtr p = this->allocate_one(); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node; NodeAlloc &na = this->node_alloc(); node_allocator_traits_type::construct (na, dtl::addressof(p->get_real_data().first), boost::forward(key)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ node_allocator_traits_type::construct(na, dtl::addressof(p->get_real_data().second)); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ node_allocator_traits_type::destroy(na, dtl::addressof(p->get_real_data().first)); - BOOST_RETHROW; + BOOST_CONTAINER_RETHROW; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { p->destroy_header(); this->node_alloc().deallocate(p, 1); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return (p); } @@ -470,7 +468,7 @@ struct node_alloc_holder chain.clear(); Node *p = 0; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ Deallocator node_deallocator(NodePtr(), nalloc); dtl::scoped_node_destructor sdestructor(nalloc, 0); while(n){ @@ -490,12 +488,12 @@ struct node_alloc_holder sdestructor.release(); node_deallocator.release(); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ chain.incorporate_after(chain.last(), &*itbeg, &*itlast, n); node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), chain); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } } diff --git a/include/boost/container/detail/node_pool_impl.hpp b/include/boost/container/detail/node_pool_impl.hpp index 3a19ca3..d619656 100644 --- a/include/boost/container/detail/node_pool_impl.hpp +++ b/include/boost/container/detail/node_pool_impl.hpp @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -310,7 +309,7 @@ class private_node_pool_impl size_type blocksize = (get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of::value); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ for(size_type i = 0; i != num_blocks; ++i){ //We allocate a new NodeBlock and put it as first //element in the free Node list @@ -326,11 +325,11 @@ class private_node_pool_impl } } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ //to-do: if possible, an efficient way to deallocate allocated blocks - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } //!Deprecated, use deallocate_free_blocks diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index af6adca..843ad3c 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -53,8 +53,6 @@ #endif #include #include -// other -#include @@ -311,20 +309,20 @@ class RecyclingCloner { if(node_ptr_type p = m_icont.unlink_leftmost_without_rebalance()){ //First recycle a node (this can't throw) - BOOST_TRY{ + BOOST_CONTAINER_TRY{ //This can throw this->do_assign(p, other, bool_()); return p; } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ //If there is an exception destroy the whole source m_holder.destroy_node(p); while((p = m_icont.unlink_leftmost_without_rebalance())){ m_holder.destroy_node(p); } - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } else{ return m_holder.create_node(boost::move(other.get_real_data())); diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp index 22a8ae0..64daa0c 100644 --- a/include/boost/container/detail/workaround.hpp +++ b/include/boost/container/detail/workaround.hpp @@ -161,5 +161,30 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&) }} //namespace boost::container { +#if !(defined BOOST_NO_EXCEPTIONS) +# define BOOST_CONTAINER_TRY { try +# define BOOST_CONTAINER_CATCH(x) catch(x) +# define BOOST_CONTAINER_RETHROW throw; +# define BOOST_CONTAINER_CATCH_END } +#else +# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900 +# define BOOST_CONTAINER_TRY { if (true) +# define BOOST_CONTAINER_CATCH(x) else if (false) +# else +// warning C4127: conditional expression is constant +# define BOOST_CONTAINER_TRY { \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (true) \ + __pragma(warning(pop)) +# define BOOST_CONTAINER_CATCH(x) else \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (false) \ + __pragma(warning(pop)) +# endif +# define BOOST_CONTAINER_RETHROW +# define BOOST_CONTAINER_CATCH_END } +#endif #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/include/boost/container/devector.hpp b/include/boost/container/devector.hpp index 42569bb..eac5b79 100644 --- a/include/boost/container/devector.hpp +++ b/include/boost/container/devector.hpp @@ -48,8 +48,6 @@ #include #include -#include - //std #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include //for std::initializer_list @@ -348,17 +346,17 @@ class devector ) : m_(allocator) { - BOOST_TRY{ + BOOST_CONTAINER_TRY{ while (first != last) { this->emplace_back(*first++); } BOOST_ASSERT(invariants_ok()); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ this->destroy_elements(m_.buffer + m_.front_idx, m_.buffer + m_.back_idx); this->deallocate_buffer(); } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 0a85b9d..cd86255 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -43,8 +43,6 @@ // intrusive #include //pair #include //less, equal -//others -#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index 30c7b83..4669b27 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -46,7 +46,6 @@ #include //less, equal // other #include -#include // std #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/node_handle.hpp b/include/boost/container/node_handle.hpp index d07f3ce..323b79c 100644 --- a/include/boost/container/node_handle.hpp +++ b/include/boost/container/node_handle.hpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include @@ -112,15 +112,16 @@ class node_handle BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle) typedef typename nator_traits::pointer node_pointer; - typedef ::boost::aligned_storage + typedef typename dtl::aligned_storage < sizeof(nallocator_type) - , boost::alignment_of::value> nalloc_storage_t; + , dtl::alignment_of::value + >::type nalloc_storage_t; node_pointer m_ptr; nalloc_storage_t m_nalloc_storage; void move_construct_alloc(nallocator_type &al) - { ::new(m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(::boost::move(al)); } + { ::new((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(::boost::move(al)); } void destroy_deallocate_node() { @@ -132,7 +133,7 @@ class node_handle void move_construct_end(OtherNodeHandle &nh) { if(m_ptr){ - ::new (m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(::boost::move(nh.node_alloc())); + ::new ((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(::boost::move(nh.node_alloc())); node_handle_friend::destroy_alloc(nh); node_handle_friend::get_node_pointer(nh) = node_pointer(); } @@ -140,7 +141,7 @@ class node_handle } void destroy_alloc() BOOST_NOEXCEPT - { static_cast(m_nalloc_storage.address())->~nallocator_type(); } + { static_cast((void*)m_nalloc_storage.data)->~nallocator_type(); } node_pointer &get_node_pointer() BOOST_NOEXCEPT { return m_ptr; } @@ -161,7 +162,7 @@ class node_handle : m_ptr(p) { if(m_ptr){ - ::new (m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(al); + ::new ((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(al); } } @@ -374,7 +375,7 @@ class node_handle nallocator_type &node_alloc() BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); - return *static_cast(m_nalloc_storage.address()); + return *static_cast((void*)m_nalloc_storage.data); } @@ -384,7 +385,7 @@ class node_handle const nallocator_type &node_alloc() const BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); - return *static_cast(m_nalloc_storage.address()); + return *static_cast((const void*)m_nalloc_storage.data); } //! Effects: x.swap(y). diff --git a/include/boost/container/scoped_allocator.hpp b/include/boost/container/scoped_allocator.hpp index e9720fe..3e9c684 100644 --- a/include/boost/container/scoped_allocator.hpp +++ b/include/boost/container/scoped_allocator.hpp @@ -38,8 +38,6 @@ #endif #include -#include - namespace boost { namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index 1adbfba..b660172 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -48,8 +48,6 @@ #endif #include #include -// other -#include // std #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 219dfdd..bf1c7f1 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -60,7 +60,6 @@ #include // other #include -#include // std #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include @@ -2091,38 +2090,38 @@ class stable_vector { node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) node_type(index_traits_type::ptr_to_node_base_ptr(*up_index)); - BOOST_TRY{ + BOOST_CONTAINER_TRY{ //This can throw boost::container::construct_in_place ( this->priv_node_alloc() , praw->get_data_ptr() , it); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { praw->destroy_header(); this->priv_node_alloc().deallocate(p, 1); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible) { node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) node_type; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ //This can throw boost::container::allocator_traits::construct ( this->priv_node_alloc() , p->get_data_ptr() , ::boost::forward(value_convertible)); } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { praw->destroy_header(); this->priv_node_alloc().deallocate(p, 1); - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } void priv_swap_members(stable_vector &x) diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 1a5e893..4474ed4 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -50,7 +50,6 @@ #include #include -#include #include #include // @@ -2969,7 +2968,7 @@ class basic_string const size_type long_size = this->priv_long_size(); const size_type long_storage = this->priv_long_storage(); //We can make this nothrow as chars are always NoThrowCopyables - BOOST_TRY{ + BOOST_CONTAINER_TRY{ pointer reuse = 0; real_cap = long_size+1; const pointer ret = this->allocation_command(allocate_new, long_size+1, real_cap, reuse); @@ -2982,10 +2981,10 @@ class basic_string //And release old buffer this->alloc().deallocate(long_addr, long_storage); } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ return; } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template @@ -3015,20 +3014,20 @@ class basic_string //Save initial position FwdIt init = first; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ //Construct objects for (; count--; ++first){ this->construct(first, val); } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ //Call destructors for (; init != first; ++init){ this->destroy(init); } - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END } template inline @@ -3038,20 +3037,20 @@ class basic_string FwdIt dest_init = dest; size_type constructed = 0; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ //Try to build objects for (; first != last; ++dest, ++first, ++constructed){ this->construct(dest, *first); } } - BOOST_CATCH(...){ + BOOST_CONTAINER_CATCH(...){ //Call destructors for (; constructed--; ++dest_init){ this->destroy(dest_init); } - BOOST_RETHROW + BOOST_CONTAINER_RETHROW } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END return (constructed); } diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index a1f3fb1..1795922 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -62,7 +62,6 @@ #include #include // other -#include #include #include diff --git a/src/global_resource.cpp b/src/global_resource.cpp index f57a572..af273ae 100644 --- a/src/global_resource.cpp +++ b/src/global_resource.cpp @@ -11,7 +11,6 @@ #define BOOST_CONTAINER_SOURCE #include #include -#include #include #include //For global lock #include diff --git a/test/deque_test.cpp b/test/deque_test.cpp index 4593dcc..907bee5 100644 --- a/test/deque_test.cpp +++ b/test/deque_test.cpp @@ -28,7 +28,6 @@ #include "propagate_allocator_test.hpp" #include "vector_test.hpp" #include "default_init_test.hpp" -#include #include "../../intrusive/test/iterator_test.hpp" using namespace boost::container; diff --git a/test/devector_test.cpp b/test/devector_test.cpp index 684ef68..97f0bff 100644 --- a/test/devector_test.cpp +++ b/test/devector_test.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include "dummy_test_allocator.hpp" @@ -636,13 +635,13 @@ template void test_il_assignment() test_elem_throw::on_copy_after(3); - BOOST_TRY + BOOST_CONTAINER_TRY { a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; BOOST_TEST(false); } - BOOST_CATCH(const test_exception&) {} - BOOST_CATCH_END + BOOST_CONTAINER_CATCH(const test_exception&) {} + BOOST_CONTAINER_CATCH_END test_elem_throw::do_not_throw(); test_equal_range(a, {1, 2, 3, 4, 5, 6}); diff --git a/test/global_resource_test.cpp b/test/global_resource_test.cpp index 1b2e740..8535e09 100644 --- a/test/global_resource_test.cpp +++ b/test/global_resource_test.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include "derived_from_memory_resource.hpp" @@ -91,15 +90,15 @@ void test_null_memory_resource() #if !defined(BOOST_NO_EXCEPTIONS) bool bad_allocexception_thrown = false; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ mr->allocate(1, 1); } - BOOST_CATCH(std::bad_alloc&) { + BOOST_CONTAINER_CATCH(std::bad_alloc&) { bad_allocexception_thrown = true; } - BOOST_CATCH(...) { + BOOST_CONTAINER_CATCH(...) { } - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END BOOST_TEST(bad_allocexception_thrown == true); #endif //BOOST_NO_EXCEPTIONS diff --git a/test/memory_resource_test.cpp b/test/memory_resource_test.cpp index 4c4cb51..aad394a 100644 --- a/test/memory_resource_test.cpp +++ b/test/memory_resource_test.cpp @@ -9,7 +9,6 @@ ////////////////////////////////////////////////////////////////////////////// #include #include -#include #include "derived_from_memory_resource.hpp" #include diff --git a/test/static_vector_options_test.cpp b/test/static_vector_options_test.cpp index 6a045ac..b81c5ae 100644 --- a/test/static_vector_options_test.cpp +++ b/test/static_vector_options_test.cpp @@ -10,7 +10,6 @@ #define BOOST_ENABLE_ASSERT_HANDLER #include #include -#include #include //for bad_alloc #include #include @@ -87,16 +86,16 @@ void test_throw_on_overflow() v.resize(Capacity); bool expected_type_thrown = false; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ v.push_back(0); } - BOOST_CATCH(bad_alloc_t&) + BOOST_CONTAINER_CATCH(bad_alloc_t&) { expected_type_thrown = true; } - BOOST_CATCH(...) + BOOST_CONTAINER_CATCH(...) {} - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END BOOST_TEST(expected_type_thrown == true); BOOST_TEST(v.capacity() == Capacity); @@ -115,16 +114,16 @@ void test_throw_on_overflow() v.resize(Capacity); bool expected_type_thrown = false; - BOOST_TRY{ + BOOST_CONTAINER_TRY{ v.push_back(0); } - BOOST_CATCH(throw_on_overflow_off) + BOOST_CONTAINER_CATCH(throw_on_overflow_off) { expected_type_thrown = true; } - BOOST_CATCH(...) + BOOST_CONTAINER_CATCH(...) {} - BOOST_CATCH_END + BOOST_CONTAINER_CATCH_END BOOST_TEST(expected_type_thrown == true); BOOST_TEST(v.capacity() == Capacity); diff --git a/test/static_vector_test.cpp b/test/static_vector_test.cpp index 62d45ff..3046c69 100644 --- a/test/static_vector_test.cpp +++ b/test/static_vector_test.cpp @@ -8,7 +8,6 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include #include #include diff --git a/test/vector_test.hpp b/test/vector_test.hpp index 8ca7201..a8f0ae8 100644 --- a/test/vector_test.hpp +++ b/test/vector_test.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "print_container.hpp"