|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64985 - in trunk/boost: interprocess interprocess/allocators/detail interprocess/containers/container interprocess/containers/container/detail interprocess/detail interprocess/mem_algo interprocess/mem_algo/detail interprocess/streams interprocess/sync interprocess/sync/emulation interprocess/sync/posix interprocess/sync/xsi intrusive intrusive/detail
From: igaztanaga_at_[hidden]
Date: 2010-08-24 13:26:43
Author: igaztanaga
Date: 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
New Revision: 64985
URL: http://svn.boost.org/trac/boost/changeset/64985
Log:
More changes for Boost 1.45
Added:
trunk/boost/intrusive/parent_from_member.hpp (contents, props changed)
Text files modified:
trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp | 2
trunk/boost/interprocess/allocators/detail/allocator_common.hpp | 3
trunk/boost/interprocess/containers/container/deque.hpp | 2
trunk/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp | 56 ++++++++--------
trunk/boost/interprocess/containers/container/detail/advanced_insert_int.hpp | 26 +++---
trunk/boost/interprocess/containers/container/detail/node_pool_impl.hpp | 12 +-
trunk/boost/interprocess/containers/container/string.hpp | 2
trunk/boost/interprocess/detail/intermodule_singleton.hpp | 16 ++--
trunk/boost/interprocess/detail/intersegment_ptr.hpp | 26 +++---
trunk/boost/interprocess/detail/managed_memory_impl.hpp | 2
trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp | 5
trunk/boost/interprocess/detail/os_file_functions.hpp | 2
trunk/boost/interprocess/detail/segment_manager_helper.hpp | 6
trunk/boost/interprocess/detail/workaround.hpp | 7 +
trunk/boost/interprocess/managed_external_buffer.hpp | 6
trunk/boost/interprocess/managed_shared_memory.hpp | 5 +
trunk/boost/interprocess/mapped_region.hpp | 4
trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 21 +++--
trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp | 28 ++++----
trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 28 ++++----
trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 140 ++++++++++++++++++++++-----------------
trunk/boost/interprocess/offset_ptr.hpp | 32 ++++----
trunk/boost/interprocess/permissions.hpp | 17 +++-
trunk/boost/interprocess/segment_manager.hpp | 43 ++++++------
trunk/boost/interprocess/streams/bufferstream.hpp | 2
trunk/boost/interprocess/streams/vectorstream.hpp | 6
trunk/boost/interprocess/sync/emulation/mutex.hpp | 2
trunk/boost/interprocess/sync/emulation/recursive_mutex.hpp | 3
trunk/boost/interprocess/sync/interprocess_condition.hpp | 2
trunk/boost/interprocess/sync/interprocess_mutex.hpp | 2
trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp | 2
trunk/boost/interprocess/sync/named_mutex.hpp | 6
trunk/boost/interprocess/sync/named_semaphore.hpp | 6
trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp | 3
trunk/boost/interprocess/sync/posix/interprocess_condition.hpp | 11 +-
trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp | 5
trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp | 5
trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp | 22 +----
trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp | 5
trunk/boost/intrusive/circular_slist_algorithms.hpp | 2
trunk/boost/intrusive/derivation_value_traits.hpp | 15 +++
trunk/boost/intrusive/detail/any_node_and_algorithms.hpp | 6 +
trunk/boost/intrusive/detail/hashtable_node.hpp | 9 ++
trunk/boost/intrusive/detail/parent_from_member.hpp | 12 +--
trunk/boost/intrusive/detail/utilities.hpp | 62 ++++++++++++++---
trunk/boost/intrusive/hashtable.hpp | 23 +++--
trunk/boost/intrusive/intrusive_fwd.hpp | 83 +++++++++++++----------
trunk/boost/intrusive/options.hpp | 18 +++++
trunk/boost/intrusive/rbtree_algorithms.hpp | 7 ++
trunk/boost/intrusive/unordered_set_hook.hpp | 8 ++
50 files changed, 477 insertions(+), 341 deletions(-)
Modified: trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -29,7 +29,7 @@
#include <cstddef>
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
//!\file
//!Describes the real adaptive pool shared by many Interprocess pool allocators
Modified: trunk/boost/interprocess/allocators/detail/allocator_common.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/allocator_common.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/allocator_common.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -21,6 +21,7 @@
#include <utility> //std::pair
#include <boost/utility/addressof.hpp> //boost::addressof
#include <boost/assert.hpp> //BOOST_ASSERT
+#include <boost/assert.hpp>
#include <boost/interprocess/exceptions.hpp> //bad_alloc
#include <boost/interprocess/sync/scoped_lock.hpp> //scoped_lock
#include <boost/interprocess/containers/allocation_type.hpp> //boost::interprocess::allocation_type
@@ -812,7 +813,7 @@
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- assert(m_header.m_usecount > 0);
+ BOOST_ASSERT(m_header.m_usecount > 0);
return --m_header.m_usecount;
}
Modified: trunk/boost/interprocess/containers/container/deque.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/deque.hpp (original)
+++ trunk/boost/interprocess/containers/container/deque.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -25,7 +25,7 @@
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
#include <cstddef>
#include <iterator>
-#include <cassert>
+#include <boost/assert.hpp>
#include <memory>
#include <algorithm>
#include <stdexcept>
Modified: trunk/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp (original)
+++ trunk/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -26,7 +26,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
-#include <cassert>
+#include <boost/assert.hpp>
#include <cstddef>
namespace boost {
@@ -305,10 +305,10 @@
void swap(private_adaptive_node_pool_impl &other)
{
- assert(m_max_free_blocks == other.m_max_free_blocks);
- assert(m_real_node_size == other.m_real_node_size);
- assert(m_real_block_alignment == other.m_real_block_alignment);
- assert(m_real_num_node == other.m_real_num_node);
+ BOOST_ASSERT(m_max_free_blocks == other.m_max_free_blocks);
+ BOOST_ASSERT(m_real_node_size == other.m_real_node_size);
+ BOOST_ASSERT(m_real_block_alignment == other.m_real_block_alignment);
+ BOOST_ASSERT(m_real_num_node == other.m_real_num_node);
std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
std::swap(m_totally_free_blocks, other.m_totally_free_blocks);
m_block_multiset.swap(other.m_block_multiset);
@@ -329,10 +329,10 @@
; m_totally_free_blocks > max_free_blocks
; --m_totally_free_blocks
){
- assert(!m_block_multiset.empty());
+ BOOST_ASSERT(!m_block_multiset.empty());
block_iterator it = itend;
--it;
- assert(it->free_nodes.size() == m_real_num_node);
+ BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
m_block_multiset.erase_and_dispose(it, block_destroyer(this));
}
}
@@ -345,7 +345,7 @@
chain.pop_front();
priv_invariants();
block_info_t *block_info = this->priv_block_from_node(pElem);
- assert(block_info->free_nodes.size() < m_real_num_node);
+ BOOST_ASSERT(block_info->free_nodes.size() < m_real_num_node);
//We put the node at the beginning of the free node list
node_t * to_deallocate = static_cast<node_t*>(pElem);
block_info->free_nodes.push_front(*to_deallocate);
@@ -382,12 +382,12 @@
node_t *priv_take_first_node()
{
- assert(m_block_multiset.begin() != m_block_multiset.end());
+ BOOST_ASSERT(m_block_multiset.begin() != m_block_multiset.end());
//We take the first free node the multiset can't be empty
free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
node_t *first_node = &free_nodes.front();
const std::size_t free_nodes_count = free_nodes.size();
- assert(0 != free_nodes_count);
+ BOOST_ASSERT(0 != free_nodes_count);
free_nodes.pop_front();
if(free_nodes_count == 1){
m_block_multiset.erase(m_block_multiset.begin());
@@ -417,7 +417,7 @@
{
std::size_t free_nodes = to_deallocate->free_nodes.size();
(void)free_nodes;
- assert(free_nodes == mp_impl->m_real_num_node);
+ BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
mp_impl->mp_segment_mngr_base->deallocate(to_deallocate);
}
@@ -425,8 +425,8 @@
{
std::size_t free_nodes = to_deallocate->free_nodes.size();
(void)free_nodes;
- assert(free_nodes == mp_impl->m_real_num_node);
- assert(0 == to_deallocate->hdr_offset);
+ BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
+ BOOST_ASSERT(0 == to_deallocate->hdr_offset);
hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(containers_detail::get_pointer(to_deallocate));
mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
}
@@ -449,7 +449,7 @@
--prev;
std::size_t sp = prev->free_nodes.size(),
si = it->free_nodes.size();
- assert(sp <= si);
+ BOOST_ASSERT(sp <= si);
(void)sp; (void)si;
}
}
@@ -460,7 +460,7 @@
for(; it != itend; ++it){
total_free_nodes += it->free_nodes.size();
}
- assert(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
+ BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
//Check that the total totally free blocks are correct
it = m_block_multiset.begin();
@@ -469,7 +469,7 @@
for(; it != itend; ++it){
total_free += it->free_nodes.size() == m_real_num_node;
}
- assert(total_free >= m_totally_free_blocks);
+ BOOST_ASSERT(total_free >= m_totally_free_blocks);
if(!AlignOnly){
//Check that header offsets are correct
@@ -477,9 +477,9 @@
for(; it != itend; ++it){
hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it);
for(std::size_t i = 0, max = m_num_subblocks; i < max; ++i){
- assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
hdr_off_holder = reinterpret_cast<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + m_real_block_alignment);
}
}
@@ -498,10 +498,10 @@
std::size_t num_free_nodes = 0;
for(; it != itend; ++it){
//Check for memory leak
- assert(it->free_nodes.size() == m_real_num_node);
+ BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
++num_free_nodes;
}
- assert(num_free_nodes == m_totally_free_blocks);
+ BOOST_ASSERT(num_free_nodes == m_totally_free_blocks);
#endif
//Check for memory leaks
priv_invariants();
@@ -513,11 +513,11 @@
{
hdr_offset_holder *hdr_off_holder =
reinterpret_cast<hdr_offset_holder*>((std::size_t)node & std::size_t(~(m_real_block_alignment - 1)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
block_info_t *block = reinterpret_cast<block_info_t *>
(reinterpret_cast<char*>(hdr_off_holder) + hdr_off_holder->hdr_offset);
- assert(block->hdr_offset == 0);
+ BOOST_ASSERT(block->hdr_offset == 0);
return block;
}
@@ -533,9 +533,9 @@
{
hdr_offset_holder *hdr_off_holder = reinterpret_cast<hdr_offset_holder*>
(reinterpret_cast<char*>(block) - (m_num_subblocks-1)*m_real_block_alignment);
- assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
return hdr_off_holder;
}
@@ -582,7 +582,7 @@
char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
block_info_t *c_info = new(hdr_addr)block_info_t;
//Some structural checks
- assert(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
+ BOOST_ASSERT(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
static_cast<void*>(c_info));
typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
for( std::size_t subblock = 0, maxsubblock = m_num_subblocks - 1
Modified: trunk/boost/interprocess/containers/container/detail/advanced_insert_int.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/detail/advanced_insert_int.hpp (original)
+++ trunk/boost/interprocess/containers/container/detail/advanced_insert_int.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -20,7 +20,7 @@
#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
#include <iterator> //std::iterator_traits
#include <new> //placement new
-#include <cassert>
+#include <boost/assert.hpp>
namespace boost { namespace container { namespace containers_detail {
@@ -98,7 +98,7 @@
void uninitialized_copy_impl(Iterator p, const SizeType n)
{
- assert(n <= count_);
+ BOOST_ASSERT(n <= count_);
Iterator orig_p = p;
SizeType i = 0;
try{
@@ -120,7 +120,7 @@
virtual void copy_all_to(Iterator)
{ //This should never be called with any count
- assert(count_ == 0);
+ BOOST_ASSERT(count_ == 0);
}
virtual void uninitialized_copy_all_to(Iterator p)
@@ -133,7 +133,7 @@
new_count = division_count;
}
else{
- assert(difference_type(count_)>= division_count);
+ BOOST_ASSERT(difference_type(count_)>= division_count);
new_count = count_ - division_count;
}
this->uninitialized_copy_impl(pos, new_count);
@@ -141,17 +141,17 @@
virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
{
- assert(count_ == 0);
+ BOOST_ASSERT(count_ == 0);
SizeType new_count;
if(first_n){
new_count = division_count;
}
else{
- assert(difference_type(count_)>= division_count);
+ BOOST_ASSERT(difference_type(count_)>= division_count);
new_count = count_ - division_count;
}
//This function should never called with a count different to zero
- assert(new_count == 0);
+ BOOST_ASSERT(new_count == 0);
(void)new_count;
}
@@ -222,7 +222,7 @@
template<int ...IdxPack>
void priv_uninitialized_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...);
@@ -234,7 +234,7 @@
template<int ...IdxPack>
void priv_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
*p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
@@ -289,7 +289,7 @@
virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
new(containers_detail::get_pointer(&*p))T();
@@ -300,7 +300,7 @@
virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
value_init<T>v;
@@ -345,7 +345,7 @@
virtual void uninitialized_copy_some_and_update \
(Iterator p, difference_type division_count, bool first_n) \
{ \
- assert(division_count <=1); \
+ BOOST_ASSERT(division_count <=1); \
if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
if(!used_){ \
new(containers_detail::get_pointer(&*p))T \
@@ -358,7 +358,7 @@
virtual void copy_some_and_update \
(Iterator p, difference_type division_count, bool first_n) \
{ \
- assert(division_count <=1); \
+ BOOST_ASSERT(division_count <=1); \
if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
if(!used_){ \
T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
Modified: trunk/boost/interprocess/containers/container/detail/node_pool_impl.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/detail/node_pool_impl.hpp (original)
+++ trunk/boost/interprocess/containers/container/detail/node_pool_impl.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -26,7 +26,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
-#include <cassert>
+#include <boost/assert.hpp>
#include <cstddef>
#include <functional> //std::unary_function
@@ -185,7 +185,7 @@
}
}
//We should have removed all the nodes from the free list
- assert(m_freelist.empty());
+ BOOST_ASSERT(m_freelist.empty());
//Now pass all the node to the free list again
m_freelist.splice_after
@@ -204,7 +204,7 @@
void purge_blocks()
{
//check for memory leaks
- assert(m_allocated==0);
+ BOOST_ASSERT(m_allocated==0);
std::size_t blocksize = get_rounded_size
(m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
typename blockslist_t::iterator
@@ -222,8 +222,8 @@
void swap(private_node_pool_impl &other)
{
- assert(m_nodes_per_block == other.m_nodes_per_block);
- assert(m_real_node_size == other.m_real_node_size);
+ BOOST_ASSERT(m_nodes_per_block == other.m_nodes_per_block);
+ BOOST_ASSERT(m_real_node_size == other.m_real_node_size);
std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
m_blocklist.swap(other.m_blocklist);
m_freelist.swap(other.m_freelist);
@@ -289,7 +289,7 @@
//We put the node at the beginning of the free node list
node_t * to_deallocate = static_cast<node_t*>(pElem);
m_freelist.push_front(*to_deallocate);
- assert(m_allocated>0);
+ BOOST_ASSERT(m_allocated>0);
--m_allocated;
}
Modified: trunk/boost/interprocess/containers/container/string.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/string.hpp (original)
+++ trunk/boost/interprocess/containers/container/string.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -264,7 +264,7 @@
(void)limit_size;
(void)reuse;
if(!(command & allocate_new))
- return std::pair<pointer, bool>(pointer(0), 0);
+ return std::pair<pointer, bool>(pointer(0), false);
received_size = preferred_size;
return std::make_pair(this->alloc().allocate(received_size), false);
}
Modified: trunk/boost/interprocess/detail/intermodule_singleton.hpp
==============================================================================
--- trunk/boost/interprocess/detail/intermodule_singleton.hpp (original)
+++ trunk/boost/interprocess/detail/intermodule_singleton.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -25,7 +25,7 @@
#include <boost/interprocess/detail/tmp_dir_helpers.hpp>
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/detail/mpl.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
#include <cstddef>
#include <cstdio>
#include <cstring>
@@ -765,7 +765,7 @@
intermodule_singleton_helpers::locking_file_serial_id *pserial_id =
mshm_.find<intermodule_singleton_helpers::locking_file_serial_id>
("lock_file_fd").first;
- assert(0 != pserial_id);
+ BOOST_ASSERT(0 != pserial_id);
if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){
int fd = pserial_id->fd;
if(fd > 0){
@@ -863,7 +863,7 @@
}
else{
//This can't be happening!
- assert(0);
+ BOOST_ASSERT(0);
}
}
}
@@ -876,7 +876,7 @@
throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed");
}
}
- assert(ptr != 0);
+ BOOST_ASSERT(ptr != 0);
}
//Now this class is a singleton, initializing the singleton in
@@ -988,15 +988,15 @@
{
ref_count_ptr *rcount = mshm.find<ref_count_ptr>(unique_instance).first;
//The object must exist
- assert(rcount);
+ BOOST_ASSERT(rcount);
//Check if last reference
if(atomic_dec32(&rcount->singleton_ref_count) == 1){
//If last, destroy the object
- assert(rcount->ptr != 0);
+ BOOST_ASSERT(rcount->ptr != 0);
delete rcount->ptr;
//Now destroy shm entry
bool destroyed = mshm.destroy<ref_count_ptr>(unique_instance);
- (void)destroyed; assert(destroyed == true);
+ (void)destroyed; BOOST_ASSERT(destroyed == true);
}
}
managed_shared_memory &mshm;
@@ -1126,7 +1126,7 @@
continue;
open(name);
if(::fnctl(fd, GET_LCK)
- assert(flock.pid != self_pid)
+ BOOST_ASSERT(flock.pid != self_pid)
continue;
shm_remove(bip_gmem_#PID#)
unlink(name);
Modified: trunk/boost/interprocess/detail/intersegment_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/detail/intersegment_ptr.hpp (original)
+++ trunk/boost/interprocess/detail/intersegment_ptr.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -35,7 +35,7 @@
#include <boost/static_assert.hpp> //BOOST_STATIC_ASSERT
#include <climits> //CHAR_BIT
#include <boost/integer/static_log2.hpp>
-#include <cassert> //assert
+#include <boost/assert.hpp> //BOOST_ASSERT
#include <boost/interprocess/detail/multi_segment_services.hpp>
//!\file
@@ -133,7 +133,7 @@
void relative_set_begin_from_base(void *addr)
{
- assert(addr < static_cast<void*>(this));
+ BOOST_ASSERT(addr < static_cast<void*>(this));
std::size_t off = reinterpret_cast<char*>(this) - reinterpret_cast<char*>(addr);
members.relative.beg = off >> align_bits;
}
@@ -144,7 +144,7 @@
{
std::size_t pow = members.relative.pow;
std::size_t size = (std::size_t(1u) << pow);
- assert(pow >= frc_size_bits);
+ BOOST_ASSERT(pow >= frc_size_bits);
size |= members.relative.frc << (pow - frc_size_bits);
return size;
}
@@ -157,7 +157,7 @@
pow = detail::floor_log2(orig_size);
std::size_t low_size = (std::size_t(1) << pow);
std::size_t diff = orig_size - low_size;
- assert(pow >= frc_size_bits);
+ BOOST_ASSERT(pow >= frc_size_bits);
std::size_t rounded = detail::get_rounded_size_po2
(diff, (1u << (pow - frc_size_bits)));
if(rounded == low_size){
@@ -168,7 +168,7 @@
else{
frc = rounded >> (pow - frc_size_bits);
}
- assert(((frc << (pow - frc_size_bits)) & (align-1))==0);
+ BOOST_ASSERT(((frc << (pow - frc_size_bits)) & (align-1))==0);
return low_size + rounded;
}
@@ -177,7 +177,7 @@
void set_mode(std::size_t mode)
{
- assert(mode < is_max_mode);
+ BOOST_ASSERT(mode < is_max_mode);
members.direct.ctrl = mode;
}
@@ -328,7 +328,7 @@
std::size_t pow, frc;
std::size_t s = calculate_size(this_info.size, pow, frc);
(void)s;
- assert(this_info.size == s);
+ BOOST_ASSERT(this_info.size == s);
this->members.relative.pow = pow;
this->members.relative.frc = frc;
}
@@ -397,14 +397,14 @@
void pop_back()
{
- assert(!m_segments.empty());
+ BOOST_ASSERT(!m_segments.empty());
m_segments.erase(--m_segments.end());
}
void *address_of(std::size_t segment_id)
{
- assert(segment_id < (std::size_t)m_segments.size());
+ BOOST_ASSERT(segment_id < (std::size_t)m_segments.size());
return m_segments[segment_id].addr;
}
@@ -451,7 +451,7 @@
~mappings_t()
{
//Check that all mappings have been erased
- assert(m_ptr_to_segment_info.empty());
+ BOOST_ASSERT(m_ptr_to_segment_info.empty());
}
};
@@ -517,7 +517,7 @@
info.id = group_id->get_size();
it_b_t ret = s_map.m_ptr_to_segment_info.insert(value_type(ptr, info));
- assert(ret.second);
+ BOOST_ASSERT(ret.second);
value_eraser<ptr_to_segment_info_t> v_eraser(s_map.m_ptr_to_segment_info, ret.first);
group_id->push_back(ptr, size);
@@ -537,7 +537,7 @@
group_id->pop_back();
std::size_t erased = s_map.m_ptr_to_segment_info.erase(addr);
(void)erased;
- assert(erased);
+ BOOST_ASSERT(erased);
return true;
}
}
@@ -550,7 +550,7 @@
typedef typename segment_groups_t::iterator iterator;
std::pair<iterator, bool> ret =
s_groups.insert(segment_group_t(*services));
- assert(ret.second);
+ BOOST_ASSERT(ret.second);
return &*ret.first;
}
}
Modified: trunk/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_memory_impl.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -35,7 +35,7 @@
#include <utility>
#include <fstream>
#include <new>
-#include <cassert>
+#include <boost/assert.hpp>
//!\file
//!Describes a named shared memory allocation user class.
Modified: trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -33,6 +33,7 @@
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/streams/vectorstream.hpp>
#include <memory>
+#include <boost/assert.hpp>
//!\file
//!Describes a named shared memory object allocation user class.
@@ -196,7 +197,7 @@
}
if(mapped){
bool ret = void_pointer::erase_last_mapping(group);
- assert(ret);(void)ret;
+ BOOST_ASSERT(ret);(void)ret;
}
return false;
}
@@ -372,7 +373,7 @@
//(*itbeg)->close_with_func(close_func(this));
//Delete group. All mappings are erased too.
ret = void_pointer::delete_group(group);
- assert(ret);
+ BOOST_ASSERT(ret);
m_shmem_list.clear();
}
}
Modified: trunk/boost/interprocess/detail/os_file_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_file_functions.hpp (original)
+++ trunk/boost/interprocess/detail/os_file_functions.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -127,7 +127,7 @@
if(!winapi::get_file_size(hnd, filesize))
return false;
- if(size > filesize){
+ if(size > (unsigned long long)filesize){
if(!winapi::set_file_pointer_ex(hnd, filesize, 0, winapi::file_begin)){
return false;
}
Modified: trunk/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ trunk/boost/interprocess/detail/segment_manager_helper.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -29,7 +29,7 @@
#include <string> //char_traits
#include <new> //std::nothrow
#include <utility> //std::pair
-#include <cassert> //assert
+#include <boost/assert.hpp> //BOOST_ASSERT
#include <functional> //unary_function
#ifndef BOOST_NO_EXCEPTIONS
#include <exception>
@@ -178,8 +178,8 @@
get_rounded_size(sizeof(block_header), algn)));
(void)sz;
//Some sanity checks
- assert(hdr->m_value_alignment == algn);
- assert(hdr->m_value_bytes % sz == 0);
+ BOOST_ASSERT(hdr->m_value_alignment == algn);
+ BOOST_ASSERT(hdr->m_value_bytes % sz == 0);
return hdr;
}
Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -46,8 +46,9 @@
# if defined(__CYGWIN__)
#define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
# endif
- //#elif defined(__APPLE__)
- //# define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+ //Some platforms have a limited (name length) named semaphore support
+ #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
+ # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
#endif
#if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
@@ -98,7 +99,7 @@
//portable "/shmname" format does not work due to permission issues
//For those systems we need to form a path to a temporary directory:
// hp-ux tru64 vms freebsd
- #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 8))
+ #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
#define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
#endif
#endif
Modified: trunk/boost/interprocess/managed_external_buffer.hpp
==============================================================================
--- trunk/boost/interprocess/managed_external_buffer.hpp (original)
+++ trunk/boost/interprocess/managed_external_buffer.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -20,7 +20,7 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/managed_memory_impl.hpp>
#include <boost/interprocess/detail/move.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
//!\file
//!Describes a named user memory allocation user class.
@@ -58,7 +58,7 @@
(create_only_t, void *addr, std::size_t size)
{
//Check if alignment is correct
- assert((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
+ BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
if(!base_t::create_impl(addr, size)){
throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor");
}
@@ -69,7 +69,7 @@
(open_only_t, void *addr, std::size_t size)
{
//Check if alignment is correct
- assert((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
+ BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
if(!base_t::open_impl(addr, size)){
throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor");
}
Modified: trunk/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_shared_memory.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -182,6 +182,11 @@
<basic_managed_shared_memory>(shmname);
}
+ bool flush()
+ {
+ return this->base2_t::flush();
+ }
+
/// @cond
//!Tries to find a previous named allocation address. Returns a memory
Modified: trunk/boost/interprocess/mapped_region.hpp
==============================================================================
--- trunk/boost/interprocess/mapped_region.hpp (original)
+++ trunk/boost/interprocess/mapped_region.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -34,7 +34,7 @@
# if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
# include <sys/shm.h> //System V shared memory...
# endif
-# include <cassert>
+# include <boost/assert.hpp>
# else
# error Unknown platform
# endif
@@ -550,7 +550,7 @@
#ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
if(m_is_xsi){
int ret = ::shmdt(m_base);
- assert(ret == 0);
+ BOOST_ASSERT(ret == 0);
(void)ret;
return;
}
Modified: trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -31,6 +31,7 @@
#include <algorithm>
#include <utility>
#include <iterator>
+#include <boost/assert.hpp>
//!\file
//!Implements common operations for memory algorithms.
@@ -119,7 +120,7 @@
//biggest of all possibilities
current_forward = detail::get_truncated_size_po2(received_size, backwards_multiple);
needs_backwards = size_to_achieve - current_forward;
- assert((needs_backwards % backwards_multiple) == 0);
+ BOOST_ASSERT((needs_backwards % backwards_multiple) == 0);
needs_backwards_lcmed = detail::get_rounded_size_po2(needs_backwards, lcm);
lcm_out = lcm;
needs_backwards_lcmed_out = needs_backwards_lcmed;
@@ -131,7 +132,7 @@
current_forward = detail::get_truncated_size(received_size, backwards_multiple);
//No need to round needs_backwards because backwards_multiple == lcm
needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward;
- assert((needs_backwards_lcmed & (Alignment - 1u)) == 0);
+ BOOST_ASSERT((needs_backwards_lcmed & (Alignment - 1u)) == 0);
lcm_out = lcm;
needs_backwards_lcmed_out = needs_backwards_lcmed;
return true;
@@ -144,7 +145,7 @@
if(0 != (needs_backwards_lcmed & (Alignment-1)))
//while(0 != (needs_backwards_lcmed & (Alignment-1)))
needs_backwards_lcmed += backwards_multiple;
- assert((needs_backwards_lcmed % lcm) == 0);
+ BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0);
lcm_out = lcm;
needs_backwards_lcmed_out = needs_backwards_lcmed;
return true;
@@ -165,7 +166,7 @@
needs_backwards_lcmed += (4-remainder)*backwards_multiple;
}
}
- assert((needs_backwards_lcmed % lcm) == 0);
+ BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0);
lcm_out = lcm;
needs_backwards_lcmed_out = needs_backwards_lcmed;
return true;
@@ -178,7 +179,7 @@
//biggest of all possibilities
current_forward = detail::get_truncated_size(received_size, backwards_multiple);
needs_backwards = size_to_achieve - current_forward;
- assert((needs_backwards % backwards_multiple) == 0);
+ BOOST_ASSERT((needs_backwards % backwards_multiple) == 0);
needs_backwards_lcmed = detail::get_rounded_size(needs_backwards, lcm);
lcm_out = lcm;
needs_backwards_lcmed_out = needs_backwards_lcmed;
@@ -279,9 +280,9 @@
//Now obtain the address of the blocks
block_ctrl *first = memory_algo->priv_get_block(buffer);
block_ctrl *second = memory_algo->priv_get_block(pos);
- assert(pos <= (reinterpret_cast<char*>(first) + first->m_size*Alignment));
- assert(first->m_size >= 2*MinBlockUnits);
- assert((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <=
+ BOOST_ASSERT(pos <= (reinterpret_cast<char*>(first) + first->m_size*Alignment));
+ BOOST_ASSERT(first->m_size >= 2*MinBlockUnits);
+ BOOST_ASSERT((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <=
(reinterpret_cast<char*>(first) + first->m_size*Alignment));
//Set the new size of the first block
std::size_t old_size = first->m_size;
@@ -314,7 +315,7 @@
}
else{
second->m_size = old_size - first->m_size;
- assert(second->m_size >= MinBlockUnits);
+ BOOST_ASSERT(second->m_size >= MinBlockUnits);
memory_algo->priv_mark_new_allocated_block(second);
}
@@ -517,7 +518,7 @@
block_address += new_block->m_size*Alignment;
total_used_units += new_block->m_size;
//Check we have enough room to overwrite the intrusive pointer
- assert((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer));
+ BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer));
void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0);
chain.push_back(p);
++low_idx;
Modified: trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -35,7 +35,7 @@
#include <utility>
#include <cstring>
-#include <assert.h>
+#include <boost/assert.hpp>
#include <new>
/*!\file
@@ -247,8 +247,8 @@
inline simple_seq_fit_impl<MutexFamily, VoidPointer>::~simple_seq_fit_impl()
{
//There is a memory leak!
-// assert(m_header.m_allocated == 0);
-// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
+// BOOST_ASSERT(m_header.m_allocated == 0);
+// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
}
template<class MutexFamily, class VoidPointer>
@@ -279,7 +279,7 @@
inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, std::size_t size)
{
//Check size
- assert(!(size < MinBlockSize));
+ BOOST_ASSERT(!(size < MinBlockSize));
if(size < MinBlockSize)
return;
//Construct big block using the new segment
@@ -445,7 +445,7 @@
boost::interprocess::multi_segment_services *p_services =
static_cast<boost::interprocess::multi_segment_services*>
(void_pointer::find_group_data(group));
- assert(p_services);
+ BOOST_ASSERT(p_services);
std::pair<void *, std::size_t> ret =
p_services->create_new_segment(MinBlockSize > nbytes ? MinBlockSize : nbytes);
if(ret.first){
@@ -502,7 +502,7 @@
if((prev->get_user_bytes()) >= needs_backwards){
//Now take all next space. This will succeed
if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){
- assert(0);
+ BOOST_ASSERT(0);
}
//We need a minimum size to split the previous one
@@ -679,7 +679,7 @@
std::size_t old_block_size = block->m_size;
//All used blocks' next is marked with 0 so check it
- assert(block->m_next == 0);
+ BOOST_ASSERT(block->m_next == 0);
//Put this to a safe value
received_size = old_block_size*Alignment - BlockCtrlBytes;
@@ -735,7 +735,7 @@
if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){
//Something very ugly is happening here. This is a bug
//or there is memory corruption
- assert(0);
+ BOOST_ASSERT(0);
return false;
}
return true;
@@ -754,7 +754,7 @@
std::size_t block_size = block->m_size;
//All used blocks' next is marked with 0 so check it
- assert(block->m_next == 0);
+ BOOST_ASSERT(block->m_next == 0);
//Put this to a safe value
received_size = block_size*Alignment - BlockCtrlBytes;
@@ -806,7 +806,7 @@
//Ensure power of 2
if ((alignment & (alignment - std::size_t(1u))) != 0){
//Alignment is not power of two
- assert((alignment & (alignment - std::size_t(1u))) != 0);
+ BOOST_ASSERT((alignment & (alignment - std::size_t(1u))) != 0);
return 0;
}
@@ -885,7 +885,7 @@
//Mark the block as allocated
block->m_next = 0;
//Check alignment
- assert(((reinterpret_cast<char*>(block) - reinterpret_cast<char*>(this))
+ BOOST_ASSERT(((reinterpret_cast<char*>(block) - reinterpret_cast<char*>(this))
% Alignment) == 0 );
return reinterpret_cast<char*>(block) + BlockCtrlBytes;
}
@@ -917,14 +917,14 @@
(reinterpret_cast<char*>(addr) - BlockCtrlBytes);
//All used blocks' next is marked with 0 so check it
- assert(block->m_next == 0);
+ BOOST_ASSERT(block->m_next == 0);
//Check if alignment and block size are right
- assert((reinterpret_cast<char*>(addr) - reinterpret_cast<char*>(this))
+ BOOST_ASSERT((reinterpret_cast<char*>(addr) - reinterpret_cast<char*>(this))
% Alignment == 0 );
std::size_t total_size = Alignment*block->m_size;
- assert(m_header.m_allocated >= total_size);
+ BOOST_ASSERT(m_header.m_allocated >= total_size);
//Update used memory count
m_header.m_allocated -= total_size;
Modified: trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -34,7 +34,7 @@
#include <algorithm>
#include <utility>
#include <cstring>
-#include <cassert>
+#include <boost/assert.hpp>
#include <new>
//!\file
@@ -338,8 +338,8 @@
inline simple_seq_fit_impl<MutexFamily, VoidPointer>::~simple_seq_fit_impl()
{
//There is a memory leak!
-// assert(m_header.m_allocated == 0);
-// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
+// BOOST_ASSERT(m_header.m_allocated == 0);
+// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
}
template<class MutexFamily, class VoidPointer>
@@ -397,21 +397,21 @@
//Check if have only 1 big free block
void *unique_block = 0;
if(!m_header.m_allocated){
- assert(prev == root);
+ BOOST_ASSERT(prev == root);
std::size_t ignore;
unique_block = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
if(!unique_block)
return;
last = detail::get_pointer(m_header.m_root.m_next);
- assert(last_free_end_address == (reinterpret_cast<char*>(last) + last->m_size*Alignment));
+ BOOST_ASSERT(last_free_end_address == (reinterpret_cast<char*>(last) + last->m_size*Alignment));
}
std::size_t last_units = last->m_size;
std::size_t received_size;
void *addr = priv_check_and_allocate(last_units, prev, last, received_size);
(void)addr;
- assert(addr);
- assert(received_size == last_units*Alignment - AllocatedCtrlBytes);
+ BOOST_ASSERT(addr);
+ BOOST_ASSERT(received_size == last_units*Alignment - AllocatedCtrlBytes);
//Shrink it
m_header.m_size /= Alignment;
@@ -452,7 +452,7 @@
{
algo_impl_t::assert_alignment(addr);
//Check size
- assert(!(size < MinBlockSize));
+ BOOST_ASSERT(!(size < MinBlockSize));
if(size < MinBlockSize)
return;
//Construct big block using the new segment
@@ -690,7 +690,7 @@
if((prev->get_user_bytes()) >= needs_backwards){
//Now take all next space. This will succeed
if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){
- assert(0);
+ BOOST_ASSERT(0);
}
//We need a minimum size to split the previous one
@@ -819,7 +819,7 @@
received_size = biggest_block->m_size*Alignment - BlockCtrlUnits;
void *ret = this->priv_check_and_allocate
(biggest_block->m_size, prev_biggest_block, biggest_block, received_size);
- assert(ret != 0);
+ BOOST_ASSERT(ret != 0);
algo_impl_t::assert_alignment(ret);
return return_type(ret, false);
}
@@ -914,7 +914,7 @@
std::size_t old_block_size = block->m_size;
//All used blocks' next is marked with 0 so check it
- assert(block->m_next == 0);
+ BOOST_ASSERT(block->m_next == 0);
//Put this to a safe value
received_size = old_block_size*Alignment - BlockCtrlBytes;
@@ -970,7 +970,7 @@
if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){
//Something very ugly is happening here. This is a bug
//or there is memory corruption
- assert(0);
+ BOOST_ASSERT(0);
return false;
}
return true;
@@ -1045,13 +1045,13 @@
block_ctrl * block = reinterpret_cast<block_ctrl*>(priv_get_block(addr));
//All used blocks' next is marked with 0 so check it
- assert(block->m_next == 0);
+ BOOST_ASSERT(block->m_next == 0);
//Check if alignment and block size are right
algo_impl_t::assert_alignment(addr);
std::size_t total_size = Alignment*block->m_size;
- assert(m_header.m_allocated >= total_size);
+ BOOST_ASSERT(m_header.m_allocated >= total_size);
//Update used memory count
m_header.m_allocated -= total_size;
Modified: trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -37,10 +37,11 @@
#include <algorithm>
#include <utility>
#include <climits>
+#include <boost/assert.hpp>
#include <cstring>
#include <iterator>
-#include <cassert>
+#include <boost/assert.hpp>
#include <new>
#include <boost/intrusive/set.hpp>
@@ -368,7 +369,7 @@
//Now write calculate the offset of the first big block that will
//cover the whole segment
- assert(get_min_size(extra_hdr_bytes) <= size);
+ BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size);
std::size_t block1_off = priv_first_block_offset(this, extra_hdr_bytes);
priv_add_segment(reinterpret_cast<char*>(this) + block1_off, size - block1_off);
}
@@ -377,8 +378,8 @@
inline rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::~rbtree_best_fit()
{
//There is a memory leak!
-// assert(m_header.m_allocated == 0);
-// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
+// BOOST_ASSERT(m_header.m_allocated == 0);
+// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -391,7 +392,7 @@
block_ctrl *first_block = reinterpret_cast<block_ctrl *>
(reinterpret_cast<char*>(this) + block1_off);
block_ctrl *old_end_block = priv_end_block(first_block);
- assert(priv_is_allocated_block(old_end_block));
+ BOOST_ASSERT(priv_is_allocated_block(old_end_block));
std::size_t old_border_offset = (reinterpret_cast<char*>(old_end_block) -
reinterpret_cast<char*>(this)) + EndCtrlBlockBytes;
@@ -399,7 +400,7 @@
m_header.m_size += extra_size;
//We need at least MinBlockUnits blocks to create a new block
-// assert((m_header.m_size - old_end) >= MinBlockUnits);
+// BOOST_ASSERT((m_header.m_size - old_end) >= MinBlockUnits);
if((m_header.m_size - old_border_offset) < MinBlockUnits){
return;
}
@@ -411,18 +412,18 @@
new_end_block->m_size = (reinterpret_cast<char*>(first_block) -
reinterpret_cast<char*>(new_end_block))/Alignment;
first_block->m_prev_size = new_end_block->m_size;
- assert(first_block == priv_next_block(new_end_block));
+ BOOST_ASSERT(first_block == priv_next_block(new_end_block));
priv_mark_new_allocated_block(new_end_block);
- assert(new_end_block == priv_end_block(first_block));
+ BOOST_ASSERT(new_end_block == priv_end_block(first_block));
//The old end block is the new block
block_ctrl *new_block = old_end_block;
new_block->m_size = (reinterpret_cast<char*>(new_end_block) -
reinterpret_cast<char*>(new_block))/Alignment;
- assert(new_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits);
priv_mark_new_allocated_block(new_block);
- assert(priv_next_block(new_block) == new_end_block);
+ BOOST_ASSERT(priv_next_block(new_block) == new_end_block);
m_header.m_allocated += new_block->m_size*Alignment;
@@ -443,7 +444,7 @@
block_ctrl *old_end_block = priv_end_block(first_block);
algo_impl_t::assert_alignment(old_end_block);
- assert(priv_is_allocated_block(old_end_block));
+ BOOST_ASSERT(priv_is_allocated_block(old_end_block));
algo_impl_t::assert_alignment(old_end_block);
@@ -458,10 +459,10 @@
return;
algo_impl_t::assert_alignment(unique_buffer);
block_ctrl *unique_block = priv_get_block(unique_buffer);
- assert(priv_is_allocated_block(unique_block));
+ BOOST_ASSERT(priv_is_allocated_block(unique_block));
algo_impl_t::assert_alignment(unique_block);
last_block = priv_next_block(unique_block);
- assert(!priv_is_allocated_block(last_block));
+ BOOST_ASSERT(!priv_is_allocated_block(last_block));
algo_impl_t::assert_alignment(last_block);
}
else{
@@ -487,7 +488,7 @@
//store the offset to the end block since in the previous
//offset can't be overwritten by a previous block
first_block->m_prev_size = new_end_block->m_size;
- assert(priv_end_block(first_block) == new_end_block);
+ BOOST_ASSERT(priv_end_block(first_block) == new_end_block);
//Update managed buffer's size
m_header.m_size = shrunk_border_offset;
@@ -502,12 +503,12 @@
//Check alignment
algo_impl_t::check_alignment(addr);
//Check size
- assert(size >= (BlockCtrlBytes + EndCtrlBlockBytes));
+ BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes));
//Initialize the first big block and the "end" node
block_ctrl *first_big_block = new(addr)block_ctrl;
first_big_block->m_size = size/Alignment - EndCtrlBlockUnits;
- assert(first_big_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits);
//The "end" node is just a node of size 0 with the "end" bit set
block_ctrl *end_block = static_cast<block_ctrl*>
@@ -519,20 +520,20 @@
(reinterpret_cast<char*>(first_big_block) - reinterpret_cast<char*>(end_block))/Alignment;
priv_mark_as_allocated_block(end_block);
- assert(priv_next_block(first_big_block) == end_block);
- assert(priv_next_block(end_block) == first_big_block);
- assert(priv_end_block(first_big_block) == end_block);
- assert(priv_prev_block(end_block) == first_big_block);
+ BOOST_ASSERT(priv_next_block(first_big_block) == end_block);
+ BOOST_ASSERT(priv_next_block(end_block) == first_big_block);
+ BOOST_ASSERT(priv_end_block(first_big_block) == end_block);
+ BOOST_ASSERT(priv_prev_block(end_block) == first_big_block);
//Some check to validate the algorithm, since it makes some assumptions
//to optimize the space wasted in bookkeeping:
//Check that the sizes of the header are placed before the rbtree
- assert(static_cast<void*>(static_cast<SizeHolder*>(first_big_block))
+ BOOST_ASSERT(static_cast<void*>(static_cast<SizeHolder*>(first_big_block))
< static_cast<void*>(static_cast<TreeHook*>(first_big_block)));
//Check that the alignment is power of two (we use some optimizations based on this)
- //assert((Alignment % 2) == 0);
+ //BOOST_ASSERT((Alignment % 2) == 0);
//Insert it in the intrusive containers
m_header.m_imultiset.insert(*first_big_block);
}
@@ -712,11 +713,19 @@
imultiset_iterator ib(m_header.m_imultiset.begin()), ie(m_header.m_imultiset.end());
//Iterate through all blocks obtaining their size
- for(; ib != ie; ++ib){
- //Just clear user the memory part reserved for the user
- std::memset( reinterpret_cast<char*>(&*ib) + BlockCtrlBytes
- , 0
- , ib->m_size*Alignment - BlockCtrlBytes);
+ while(ib != ie){
+ //Just clear user the memory part reserved for the user
+ volatile char *ptr = reinterpret_cast<char*>(&*ib) + BlockCtrlBytes;
+ std::size_t s = ib->m_size*Alignment - BlockCtrlBytes;
+ while(s--){
+ *ptr++ = 0;
+ }
+
+ //This surprisingly is optimized out by Visual C++ 7.1 in release mode!
+ //std::memset( reinterpret_cast<char*>(&*ib) + BlockCtrlBytes
+ // , 0
+ // , ib->m_size*Alignment - BlockCtrlBytes);
+ ++ib;
}
}
@@ -751,7 +760,7 @@
block_ctrl *reuse = priv_get_block(reuse_ptr);
//Sanity check
- //assert(reuse->m_size == priv_tail_size(reuse));
+ //BOOST_ASSERT(reuse->m_size == priv_tail_size(reuse));
algo_impl_t::assert_alignment(reuse);
block_ctrl *prev_block;
@@ -762,10 +771,10 @@
}
prev_block = priv_prev_block(reuse);
- assert(!priv_is_allocated_block(prev_block));
+ BOOST_ASSERT(!priv_is_allocated_block(prev_block));
//Some sanity checks
- assert(prev_block->m_size == reuse->m_prev_size);
+ BOOST_ASSERT(prev_block->m_size == reuse->m_prev_size);
algo_impl_t::assert_alignment(prev_block);
std::size_t needs_backwards_aligned;
@@ -784,9 +793,9 @@
if(command & boost::interprocess::expand_fwd){
std::size_t received_size2;
if(!priv_expand(reuse_ptr, received_size, received_size, received_size2)){
- assert(0);
+ BOOST_ASSERT(0);
}
- assert(received_size = received_size2);
+ BOOST_ASSERT(received_size = received_size2);
}
//We need a minimum size to split the previous one
if(prev_block->m_size >= (needs_backwards_aligned/Alignment + BlockCtrlUnits)){
@@ -796,12 +805,12 @@
//Free old previous buffer
new_block->m_size =
AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment;
- assert(new_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits);
priv_mark_new_allocated_block(new_block);
prev_block->m_size = (reinterpret_cast<char*>(new_block) -
reinterpret_cast<char*>(prev_block))/Alignment;
- assert(prev_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits);
priv_mark_as_free_block(prev_block);
//Update the old previous block in the free blocks tree
@@ -827,7 +836,7 @@
//first bytes, fill them with a pattern
void *p = priv_get_user_buffer(new_block);
void *user_ptr = reinterpret_cast<char*>(p);
- assert((static_cast<char*>(reuse_ptr) - static_cast<char*>(user_ptr)) % backwards_multiple == 0);
+ BOOST_ASSERT((static_cast<char*>(reuse_ptr) - static_cast<char*>(user_ptr)) % backwards_multiple == 0);
algo_impl_t::assert_alignment(user_ptr);
return user_ptr;
}
@@ -845,13 +854,13 @@
m_header.m_allocated += prev_block->m_size*Alignment;
//Now update sizes
prev_block->m_size = prev_block->m_size + reuse->m_size;
- assert(prev_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits);
priv_mark_new_allocated_block(prev_block);
//If the backwards expansion has remaining bytes in the
//first bytes, fill them with a pattern
void *user_ptr = priv_get_user_buffer(prev_block);
- assert((static_cast<char*>(reuse_ptr) - static_cast<char*>(user_ptr)) % backwards_multiple == 0);
+ BOOST_ASSERT((static_cast<char*>(reuse_ptr) - static_cast<char*>(user_ptr)) % backwards_multiple == 0);
algo_impl_t::assert_alignment(user_ptr);
return user_ptr;
}
@@ -977,8 +986,8 @@
std::size_t old_block_units = block->m_size;
//The block must be marked as allocated and the sizes must be equal
- assert(priv_is_allocated_block(block));
- //assert(old_block_units == priv_tail_size(block));
+ BOOST_ASSERT(priv_is_allocated_block(block));
+ //BOOST_ASSERT(old_block_units == priv_tail_size(block));
//Put this to a safe value
received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
@@ -990,7 +999,7 @@
const std::size_t preferred_user_units = algo_impl_t::ceil_units(preferred_size - UsableByPreviousChunk);
//Some parameter checks
- assert(min_user_units <= preferred_user_units);
+ BOOST_ASSERT(min_user_units <= preferred_user_units);
block_ctrl *next_block;
@@ -1022,7 +1031,7 @@
//This block is bigger than needed, split it in
//two blocks, the first one will be merged and
//the second's size will be the remaining space
- assert(next_block->m_size == priv_next_block(next_block)->m_prev_size);
+ BOOST_ASSERT(next_block->m_size == priv_next_block(next_block)->m_prev_size);
const std::size_t rem_units = merged_units - intended_units;
//Check if we we need to update the old next block in the free blocks tree
@@ -1045,7 +1054,7 @@
(reinterpret_cast<char*>(block) + intended_units*Alignment))block_ctrl;
rem_block->m_size = rem_units;
algo_impl_t::assert_alignment(rem_block);
- assert(rem_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits);
priv_mark_as_free_block(rem_block);
//Now the second part of the fixup
@@ -1056,7 +1065,7 @@
//Write the new length
block->m_size = intended_user_units + AllocatedCtrlUnits;
- assert(block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(block->m_size >= BlockCtrlUnits);
m_header.m_allocated += (intended_units - old_block_units)*Alignment;
}
//There is no free space to create a new node: just merge both blocks
@@ -1066,7 +1075,7 @@
//Write the new length
block->m_size = merged_units;
- assert(block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(block->m_size >= BlockCtrlUnits);
m_header.m_allocated += (merged_units - old_block_units)*Alignment;
}
priv_mark_as_allocated_block(block);
@@ -1079,7 +1088,7 @@
rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_prev_block
(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *ptr)
{
- assert(!ptr->m_prev_allocated);
+ BOOST_ASSERT(!ptr->m_prev_allocated);
return reinterpret_cast<block_ctrl *>
(reinterpret_cast<char*>(ptr) - ptr->m_prev_size*Alignment);
}
@@ -1094,7 +1103,7 @@
else{
block_ctrl *prev = priv_prev_block(ptr);
(void)prev;
- assert(!priv_is_allocated_block(prev));
+ BOOST_ASSERT(!priv_is_allocated_block(prev));
return false;
}
}
@@ -1104,12 +1113,12 @@
rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_end_block
(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *first_segment_block)
{
- assert(first_segment_block->m_prev_allocated);
+ BOOST_ASSERT(first_segment_block->m_prev_allocated);
block_ctrl *end_block = reinterpret_cast<block_ctrl *>
(reinterpret_cast<char*>(first_segment_block) - first_segment_block->m_prev_size*Alignment);
(void)end_block;
- assert(priv_is_allocated_block(end_block));
- assert(end_block > first_segment_block);
+ BOOST_ASSERT(priv_is_allocated_block(end_block));
+ BOOST_ASSERT(end_block > first_segment_block);
return end_block;
}
@@ -1131,7 +1140,7 @@
(reinterpret_cast<char*>(block) + block->m_size*Alignment);
bool next_block_prev_allocated = next_block->m_prev_allocated != 0;
(void)next_block_prev_allocated;
- assert(allocated == next_block_prev_allocated);
+ BOOST_ASSERT(allocated == next_block_prev_allocated);
return allocated;
}
@@ -1139,7 +1148,7 @@
void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_mark_as_allocated_block
(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *block)
{
- //assert(!priv_is_allocated_block(block));
+ //BOOST_ASSERT(!priv_is_allocated_block(block));
block->m_allocated = 1;
reinterpret_cast<block_ctrl *>
(reinterpret_cast<char*>(block)+ block->m_size*Alignment)->m_prev_allocated = 1;
@@ -1152,7 +1161,7 @@
block->m_allocated = 0;
reinterpret_cast<block_ctrl *>
(reinterpret_cast<char*>(block) + block->m_size*Alignment)->m_prev_allocated = 0;
- //assert(!priv_is_allocated_block(ptr));
+ //BOOST_ASSERT(!priv_is_allocated_block(ptr));
priv_next_block(block)->m_prev_size = block->m_size;
}
@@ -1172,14 +1181,14 @@
//the second's size "block->m_size-units"
std::size_t block_old_size = block->m_size;
block->m_size = nunits;
- assert(block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(block->m_size >= BlockCtrlUnits);
//This is the remaining block
block_ctrl *rem_block = new(reinterpret_cast<block_ctrl*>
(reinterpret_cast<char*>(block) + Alignment*nunits))block_ctrl;
algo_impl_t::assert_alignment(rem_block);
rem_block->m_size = block_old_size - nunits;
- assert(rem_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits);
priv_mark_as_free_block(rem_block);
imultiset_iterator it_hint;
@@ -1204,7 +1213,7 @@
m_header.m_imultiset.erase(it_old);
}
else{
- assert(0);
+ BOOST_ASSERT(0);
return 0;
}
//We need block_ctrl for deallocation stuff, so
@@ -1218,7 +1227,16 @@
//Clear the memory occupied by the tree hook, since this won't be
//cleared with zero_free_memory
TreeHook *t = static_cast<TreeHook*>(block);
- std::memset(t, 0, sizeof(*t));
+ //Just clear the memory part reserved for the user
+ std::size_t tree_hook_offset_in_block = (char*)t - (char*)block;
+ //volatile char *ptr =
+ char *ptr = reinterpret_cast<char*>(block)+tree_hook_offset_in_block;
+ const std::size_t s = BlockCtrlBytes - tree_hook_offset_in_block;
+ /*
+ while(s--){
+ *ptr++ = 0;
+ }*/
+ std::memset(ptr, 0, s);
this->priv_next_block(block)->m_prev_size = 0;
return priv_get_user_buffer(block);
}
@@ -1241,14 +1259,14 @@
block_ctrl *block = priv_get_block(addr);
//The blocks must be marked as allocated and the sizes must be equal
- assert(priv_is_allocated_block(block));
-// assert(block->m_size == priv_tail_size(block));
+ BOOST_ASSERT(priv_is_allocated_block(block));
+// BOOST_ASSERT(block->m_size == priv_tail_size(block));
//Check if alignment and block size are right
algo_impl_t::assert_alignment(addr);
std::size_t block_old_size = Alignment*block->m_size;
- assert(m_header.m_allocated >= block_old_size);
+ BOOST_ASSERT(m_header.m_allocated >= block_old_size);
//Update used memory count
m_header.m_allocated -= block_old_size;
@@ -1268,13 +1286,13 @@
//Get the previous block
block_ctrl *prev_block = priv_prev_block(block);
prev_block->m_size += block->m_size;
- assert(prev_block->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits);
block_to_insert = prev_block;
}
//Merge if the next is free
if(merge_with_next){
block_to_insert->m_size += next_block->m_size;
- assert(block_to_insert->m_size >= BlockCtrlUnits);
+ BOOST_ASSERT(block_to_insert->m_size >= BlockCtrlUnits);
if(merge_with_prev)
m_header.m_imultiset.erase(Imultiset::s_iterator_to(*next_block));
}
Modified: trunk/boost/interprocess/offset_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/offset_ptr.hpp (original)
+++ trunk/boost/interprocess/offset_ptr.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -24,6 +24,7 @@
#include <boost/interprocess/detail/mpl.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/assert.hpp>
+#include <boost/assert.hpp>
#include <ostream>
#include <istream>
#include <iterator>
@@ -59,21 +60,17 @@
typedef void (self_t::*unspecified_bool_type)() const;
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
- __declspec(noinline) //this workaround is needed for msvc-8.0 and msvc-9.0
+ __declspec(noinline) //this workaround is needed for msvc > 8.0
#endif
- void set_offset(const volatile void *ptr)
- { set_offset(const_cast<const void*>(ptr)); }
-
- void set_offset(const void *ptr)
+ void set_offset(const PointedType *ptr)
{
- const char *p = static_cast<const char*>(ptr);
//offset == 1 && ptr != 0 is not legal for this pointer
if(!ptr){
- m_offset = 1;
+ internal.m_offset = 1;
}
else{
- m_offset = p - reinterpret_cast<const char*>(this);
- BOOST_ASSERT(m_offset != 1);
+ internal.m_offset = (const char*)ptr - (const char*)(this);
+ BOOST_ASSERT(internal.m_offset != 1);
}
}
@@ -81,15 +78,18 @@
__declspec(noinline) //this workaround is needed for msvc-8.0 and msvc-9.0
#endif
void* get_pointer() const
- { return (m_offset == 1) ? 0 : (const_cast<char*>(reinterpret_cast<const char*>(this)) + m_offset); }
+ { return (internal.m_offset == 1) ? 0 : (const_cast<char*>(reinterpret_cast<const char*>(this)) + internal.m_offset); }
void inc_offset(std::ptrdiff_t bytes)
- { m_offset += bytes; }
+ { internal.m_offset += bytes; }
void dec_offset(std::ptrdiff_t bytes)
- { m_offset -= bytes; }
+ { internal.m_offset -= bytes; }
- std::ptrdiff_t m_offset; //Distance between this object and pointed address
+ union internal_type{
+ std::ptrdiff_t m_offset; //Distance between this object and pointed address
+ PointedType *aliasing_helper;
+ } internal;
/// @endcond
public:
@@ -153,7 +153,7 @@
{ return static_cast<pointer>(this->get_pointer()); }
std::ptrdiff_t get_offset() const
- { return m_offset; }
+ { return internal.m_offset; }
//!Pointer-like -> operator. It can return 0 pointer.
//!Never throws.
@@ -435,7 +435,7 @@
static void set_pointer(pointer &n, pointer p)
{
std::size_t pint = std::size_t(p.get());
- assert(0 == (std::size_t(pint) & Mask));
+ BOOST_ASSERT(0 == (std::size_t(pint) & Mask));
n = reinterpret_cast<T*>(pint | (std::size_t(n.get()) & std::size_t(Mask)));
}
@@ -444,7 +444,7 @@
static void set_bits(pointer &n, std::size_t b)
{
- assert(b < (std::size_t(1) << NumBits));
+ BOOST_ASSERT(b < (std::size_t(1) << NumBits));
n = reinterpret_cast<T*>(std::size_t(get_pointer(n).get()) | (b << 1u));
}
};
Modified: trunk/boost/interprocess/permissions.hpp
==============================================================================
--- trunk/boost/interprocess/permissions.hpp (original)
+++ trunk/boost/interprocess/permissions.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -19,7 +19,7 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
-#if (defined BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
#include <boost/interprocess/detail/win32_api.hpp>
@@ -31,7 +31,7 @@
namespace boost {
namespace interprocess {
-#if (defined BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
namespace detail {
@@ -54,7 +54,7 @@
class permissions
{
/// @cond
- #if (defined BOOST_INTERPROCESS_WINDOWS)
+ #if defined (BOOST_INTERPROCESS_WINDOWS)
typedef void* os_permissions_type;
#else
typedef int os_permissions_type;
@@ -70,11 +70,14 @@
{}
//!Constructs a default permissions object:
- //!A null security descriptor pointer for windows or 0644
+ //!A null security attributes pointer for windows or 0644
//!for UNIX.
permissions()
{ set_default(); }
+ //!Sets permissions to default values:
+ //!A null security attributes pointer for windows or 0644
+ //!for UNIX.
void set_default()
{
#if (defined BOOST_INTERPROCESS_WINDOWS)
@@ -84,6 +87,8 @@
#endif
}
+ //!Sets permissions to unrestricted access:
+ //!A null DACL for windows or 0666 for UNIX.
void set_unrestricted()
{
#if (defined BOOST_INTERPROCESS_WINDOWS)
@@ -93,9 +98,13 @@
#endif
}
+ //!Sets permissions from a user provided os-dependent
+ //!permissions.
void set_permissions(os_permissions_type perm)
{ m_perm = perm; }
+ //!Returns stored os-dependent
+ //!permissions
os_permissions_type get_permissions() const
{ return m_perm; }
};
Modified: trunk/boost/interprocess/segment_manager.hpp
==============================================================================
--- trunk/boost/interprocess/segment_manager.hpp (original)
+++ trunk/boost/interprocess/segment_manager.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -38,6 +38,7 @@
#include <string> //char_traits
#include <new> //std::nothrow
#include <utility> //std::pair
+#include <boost/assert.hpp>
#ifndef BOOST_NO_EXCEPTIONS
#include <exception>
#endif
@@ -94,7 +95,7 @@
segment_manager_base(std::size_t size, std::size_t reserved_bytes)
: MemoryAlgorithm(size, reserved_bytes)
{
- assert((sizeof(segment_manager_base<MemoryAlgorithm>) == sizeof(MemoryAlgorithm)));
+ BOOST_ASSERT((sizeof(segment_manager_base<MemoryAlgorithm>) == sizeof(MemoryAlgorithm)));
}
//!Returns the size of the memory
@@ -300,7 +301,7 @@
if(ctrl_data->alloc_type() != anonymous_type){
//This is not an anonymous object, the pointer is wrong!
- assert(0);
+ BOOST_ASSERT(0);
}
//Call destructors and free memory
@@ -407,7 +408,7 @@
, m_header(static_cast<Base*>(get_this_pointer()))
{
(void) anonymous_instance; (void) unique_instance;
- assert(static_cast<const void*>(this) == static_cast<const void*>(static_cast<Base*>(this)));
+ BOOST_ASSERT(static_cast<const void*>(this) == static_cast<const void*>(static_cast<Base*>(this)));
}
//!Tries to find a previous named allocation. Returns the address
@@ -710,7 +711,7 @@
std::pair<T*, std::size_t> priv_find_impl (const CharType* name, bool lock)
{
//The name can't be null, no anonymous object can be found by name
- assert(name != 0);
+ BOOST_ASSERT(name != 0);
detail::placement_destroy<T> table;
std::size_t size;
void *ret;
@@ -784,7 +785,7 @@
default:
//This type is unknown, bad pointer passed to this function!
- assert(0);
+ BOOST_ASSERT(0);
break;
}
}
@@ -795,22 +796,22 @@
{
boost::interprocess::allocation_type type = ctrl_data->alloc_type();
if(type != named_type){
- assert((type == anonymous_type && ctrl_data->m_num_char == 0) ||
+ BOOST_ASSERT((type == anonymous_type && ctrl_data->m_num_char == 0) ||
(type == unique_type && ctrl_data->m_num_char != 0) );
return 0;
}
CharType *name = static_cast<CharType*>(ctrl_data->template name<CharType>());
//Sanity checks
- assert(ctrl_data->sizeof_char() == sizeof(CharType));
- assert(ctrl_data->m_num_char == std::char_traits<CharType>::length(name));
+ BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharType));
+ BOOST_ASSERT(ctrl_data->m_num_char == std::char_traits<CharType>::length(name));
return name;
}
static std::size_t priv_get_instance_length(block_header_t *ctrl_data, std::size_t sizeofvalue)
{
//Get header
- assert((ctrl_data->value_bytes() %sizeofvalue) == 0);
+ BOOST_ASSERT((ctrl_data->value_bytes() %sizeofvalue) == 0);
return ctrl_data->value_bytes()/sizeofvalue;
}
@@ -819,7 +820,7 @@
static instance_type priv_get_instance_type(block_header_t *ctrl_data)
{
//Get header
- assert((instance_type)ctrl_data->alloc_type() < max_allocation_type);
+ BOOST_ASSERT((instance_type)ctrl_data->alloc_type() < max_allocation_type);
return (instance_type)ctrl_data->alloc_type();
}
@@ -862,8 +863,8 @@
block_header_t *ctrl_data = it->get_block_header();
//Sanity check
- assert((ctrl_data->m_value_bytes % table.size) == 0);
- assert(ctrl_data->sizeof_char() == sizeof(CharT));
+ BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
+ BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharT));
ret_ptr = ctrl_data->value();
length = ctrl_data->m_value_bytes/table.size;
}
@@ -901,8 +902,8 @@
(detail::get_pointer(it->second.m_ptr));
//Sanity check
- assert((ctrl_data->m_value_bytes % table.size) == 0);
- assert(ctrl_data->sizeof_char() == sizeof(CharT));
+ BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
+ BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharT));
ret_ptr = ctrl_data->value();
length = ctrl_data->m_value_bytes/table.size;
}
@@ -958,7 +959,7 @@
//If not found, return false
if(it == index.end()){
//This name is not present in the index, wrong pointer or name!
- //assert(0);
+ //BOOST_ASSERT(0);
return false;
}
@@ -969,8 +970,8 @@
std::size_t num = ctrl_data->m_value_bytes/table.size;
//Sanity check
- assert((ctrl_data->m_value_bytes % table.size) == 0);
- assert(sizeof(CharT) == ctrl_data->sizeof_char());
+ BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
+ BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char());
//Erase node from index
index.erase(it);
@@ -1007,7 +1008,7 @@
//If not found, return false
if(it == index.end()){
//This name is not present in the index, wrong pointer or name!
- //assert(0);
+ //BOOST_ASSERT(0);
return false;
}
return this->priv_generic_named_destroy_impl<CharT>(it, index, table);
@@ -1034,9 +1035,9 @@
void *values = ctrl_data->value();
//Sanity check
- assert((ctrl_data->m_value_bytes % table.size) == 0);
- assert(static_cast<void*>(stored_name) == static_cast<void*>(ctrl_data->template name<CharT>()));
- assert(sizeof(CharT) == ctrl_data->sizeof_char());
+ BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
+ BOOST_ASSERT(static_cast<void*>(stored_name) == static_cast<void*>(ctrl_data->template name<CharT>()));
+ BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char());
//Erase node from index
index.erase(it);
Modified: trunk/boost/interprocess/streams/bufferstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/bufferstream.hpp (original)
+++ trunk/boost/interprocess/streams/bufferstream.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -44,7 +44,7 @@
#include <ostream>
#include <string> // char traits
#include <cstddef> // ptrdiff_t
-#include <cassert>
+#include <boost/assert.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
namespace boost { namespace interprocess {
Modified: trunk/boost/interprocess/streams/vectorstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/vectorstream.hpp (original)
+++ trunk/boost/interprocess/streams/vectorstream.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -46,7 +46,7 @@
#include <string> // char traits
#include <cstddef> // ptrdiff_t
#include <boost/interprocess/interprocess_fwd.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
namespace boost { namespace interprocess {
@@ -186,7 +186,7 @@
int real_size = (int)m_vect.size();
//Then maximize size for high watermarking
m_vect.resize(m_vect.capacity());
- assert(m_vect.size() == m_vect.capacity());
+ BOOST_ASSERT(m_vect.size() == m_vect.capacity());
//Set high watermarking with the expanded size
mp_high_water = m_vect.size() ? (&m_vect[0] + real_size) : 0;
//Now set formatting pointers
@@ -263,7 +263,7 @@
//Insert the new data
m_vect.push_back(CharTraits::to_char_type(c));
m_vect.resize(m_vect.capacity());
- assert(m_vect.size() == m_vect.capacity());
+ BOOST_ASSERT(m_vect.size() == m_vect.capacity());
char_type* p = const_cast<char_type*>(&m_vect[0]);
//A reallocation might have happened, update pointers
base_t::setp(p, p + (dif_t)m_vect.size());
Modified: trunk/boost/interprocess/sync/emulation/mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/emulation/mutex.hpp (original)
+++ trunk/boost/interprocess/sync/emulation/mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -18,7 +18,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
#include <boost/interprocess/detail/atomic.hpp>
#include <boost/cstdint.hpp>
#include <boost/interprocess/detail/os_thread_functions.hpp>
Modified: trunk/boost/interprocess/sync/emulation/recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/emulation/recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/emulation/recursive_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -34,6 +34,7 @@
#include <boost/cstdint.hpp>
#include <boost/interprocess/detail/os_thread_functions.hpp>
#include <boost/interprocess/sync/emulation/mutex.hpp>
+#include <boost/assert.hpp>
namespace boost {
namespace interprocess {
@@ -141,7 +142,7 @@
const handle_t thr_id(detail::get_current_systemwide_thread_id());
(void)old_id;
(void)thr_id;
- assert(detail::equal_systemwide_thread_id(thr_id, old_id));
+ BOOST_ASSERT(detail::equal_systemwide_thread_id(thr_id, old_id));
--m_nLockCount;
if(!m_nLockCount){
const handle_t new_id(detail::get_invalid_systemwide_thread_id());
Modified: trunk/boost/interprocess/sync/interprocess_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_condition.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_condition.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -26,7 +26,7 @@
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/limits.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
#include <pthread.h>
Modified: trunk/boost/interprocess/sync/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -24,7 +24,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
#include <pthread.h>
Modified: trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -36,7 +36,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
(defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined (BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES))
Modified: trunk/boost/interprocess/sync/named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -124,15 +124,15 @@
#if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
inline named_mutex::named_mutex(create_only_t, const char *name, const permissions &perm)
- : m_sem(detail::DoCreate, name, read_write, 1, perm)
+ : m_sem(detail::DoCreate, name, 1, perm)
{}
inline named_mutex::named_mutex(open_or_create_t, const char *name, const permissions &perm)
- : m_sem(detail::DoOpenOrCreate, name, read_write, 1, perm)
+ : m_sem(detail::DoOpenOrCreate, name, 1, perm)
{}
inline named_mutex::named_mutex(open_only_t, const char *name)
- : m_sem(detail::DoOpen, name, read_write, 1, permissions())
+ : m_sem(detail::DoOpen, name, 1, permissions())
{}
inline void named_mutex::dont_close_on_destruction()
Modified: trunk/boost/interprocess/sync/named_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/named_semaphore.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -126,16 +126,16 @@
inline named_semaphore::named_semaphore
(create_only_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_sem(detail::DoCreate, name, read_write, initialCount, perm)
+ : m_sem(detail::DoCreate, name, initialCount, perm)
{}
inline named_semaphore::named_semaphore
(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_sem(detail::DoOpenOrCreate, name, read_write, initialCount, perm)
+ : m_sem(detail::DoOpenOrCreate, name, initialCount, perm)
{}
inline named_semaphore::named_semaphore(open_only_t, const char *name)
- : m_sem(detail::DoOpen, name, read_write, 1, permissions())
+ : m_sem(detail::DoOpen, name, 1, permissions())
{}
inline named_semaphore::~named_semaphore()
Modified: trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -10,6 +10,7 @@
#include<boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/assert.hpp>
namespace boost {
namespace interprocess {
@@ -27,7 +28,7 @@
inline barrier::~barrier()
{
int res = pthread_barrier_destroy(&m_barrier);
- assert(res == 0);(void)res;
+ BOOST_ASSERT(res == 0);(void)res;
}
inline bool barrier::wait()
Modified: trunk/boost/interprocess/sync/posix/interprocess_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_condition.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_condition.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -10,6 +10,7 @@
#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/assert.hpp>
namespace boost {
@@ -39,21 +40,21 @@
{
int res = 0;
res = pthread_cond_destroy(&m_condition);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
inline void interprocess_condition::notify_one()
{
int res = 0;
res = pthread_cond_signal(&m_condition);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
inline void interprocess_condition::notify_all()
{
int res = 0;
res = pthread_cond_broadcast(&m_condition);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
inline void interprocess_condition::do_wait(interprocess_mutex &mut)
@@ -61,7 +62,7 @@
pthread_mutex_t* pmutex = &mut.m_mut;
int res = 0;
res = pthread_cond_wait(&m_condition, pmutex);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
inline bool interprocess_condition::do_timed_wait
@@ -71,7 +72,7 @@
pthread_mutex_t* pmutex = &mut.m_mut;
int res = 0;
res = pthread_cond_timedwait(&m_condition, pmutex, &ts);
- assert(res == 0 || res == ETIMEDOUT);
+ BOOST_ASSERT(res == 0 || res == ETIMEDOUT);
return res != ETIMEDOUT;
}
Modified: trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -30,6 +30,7 @@
#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
# include <boost/interprocess/detail/os_thread_functions.hpp>
#endif
+#include <boost/assert.hpp>
namespace boost {
namespace interprocess {
@@ -44,7 +45,7 @@
inline interprocess_mutex::~interprocess_mutex()
{
int res = pthread_mutex_destroy(&m_mut);
- assert(res == 0);(void)res;
+ BOOST_ASSERT(res == 0);(void)res;
}
inline void interprocess_mutex::lock()
@@ -103,7 +104,7 @@
{
int res = 0;
res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
} //namespace interprocess {
Modified: trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -30,6 +30,7 @@
#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
# include <boost/interprocess/detail/os_thread_functions.hpp>
#endif
+#include <boost/assert.hpp>
namespace boost {
@@ -45,7 +46,7 @@
inline interprocess_recursive_mutex::~interprocess_recursive_mutex()
{
int res = pthread_mutex_destroy(&m_mut);
- assert(res == 0);(void)res;
+ BOOST_ASSERT(res == 0);(void)res;
}
inline void interprocess_recursive_mutex::lock()
@@ -104,7 +105,7 @@
{
int res = 0;
res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
+ BOOST_ASSERT(res == 0);
}
} //namespace interprocess {
Modified: trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp (original)
+++ trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -19,6 +19,7 @@
#include <boost/interprocess/permissions.hpp>
#include <string>
#include <semaphore.h>
+#include <boost/assert.hpp>
#ifdef SEM_FAILED
#define BOOST_INTERPROCESS_POSIX_SEM_FAILED (reinterpret_cast<sem_t*>(SEM_FAILED))
@@ -42,7 +43,7 @@
namespace detail {
inline bool semaphore_open
- (sem_t *&handle, detail::create_enum_t type, const char *origname, mode_t mode,
+ (sem_t *&handle, detail::create_enum_t type, const char *origname,
unsigned int count, const permissions &perm = permissions())
{
std::string name;
@@ -54,17 +55,6 @@
//Create new mapping
int oflag = 0;
- if(mode == read_only){
- oflag |= O_RDONLY;
- }
- else if(mode == read_write){
- oflag |= O_RDWR;
- }
- else{
- error_info err(mode_error);
- throw interprocess_exception(err);
- }
-
switch(type){
case detail::DoOpen:
//No addition
@@ -100,7 +90,7 @@
{
int ret = sem_close(handle);
if(ret != 0){
- assert(0);
+ BOOST_ASSERT(0);
}
}
@@ -135,7 +125,7 @@
{
int ret = sem_destroy(handle);
if(ret != 0){
- assert(0);
+ BOOST_ASSERT(0);
}
}
@@ -205,8 +195,8 @@
public:
named_semaphore_wrapper
- (detail::create_enum_t type, const char *name, mode_t mode, unsigned int count, const permissions &perm = permissions())
- { semaphore_open(mp_sem, type, name, mode, count, perm); }
+ (detail::create_enum_t type, const char *name, unsigned int count, const permissions &perm = permissions())
+ { semaphore_open(mp_sem, type, name, count, perm); }
~named_semaphore_wrapper()
{
Modified: trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -27,9 +27,10 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/sync/xsi/basic_xsi_semaphore.hpp>
#include <cstddef>
-#include <cassert>
+#include <boost/assert.hpp>
#include <boost/cstdint.hpp>
#include <string>
+#include <boost/assert.hpp>
//!\file
//!Describes a class representing a xsi-based named_mutex.
@@ -198,7 +199,7 @@
{
bool success = xsi::simple_sem_op(m_semid, 1);
(void)success;
- assert(success);
+ BOOST_ASSERT(success);
}
inline bool xsi_named_mutex::remove()
Modified: trunk/boost/intrusive/circular_slist_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/circular_slist_algorithms.hpp (original)
+++ trunk/boost/intrusive/circular_slist_algorithms.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -63,7 +63,7 @@
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
- //! <tt>NodeTraits::get_next(this_node) == 0
+ //! <tt>NodeTraits::get_next(this_node) == 0</tt>
//!
//! <b>Complexity</b>: Constant
//!
Modified: trunk/boost/intrusive/derivation_value_traits.hpp
==============================================================================
--- trunk/boost/intrusive/derivation_value_traits.hpp (original)
+++ trunk/boost/intrusive/derivation_value_traits.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -14,6 +14,7 @@
#define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
#include <boost/intrusive/link_mode.hpp>
+#include <boost/pointer_cast.hpp>
#include <iterator>
namespace boost {
@@ -44,10 +45,20 @@
{ return node_ptr(&value); }
static pointer to_value_ptr(node_ptr n)
- { return pointer(static_cast<T*>(detail::boost_intrusive_get_pointer(n))); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<value_type>(n));
+ return pointer(&static_cast<value_type&>(*n));
+ }
static const_pointer to_value_ptr(const_node_ptr n)
- { return const_pointer(static_cast<const T*>(detail::boost_intrusive_get_pointer(n))); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<const value_type>(n));
+ return const_pointer(&static_cast<const value_type&>(*n));
+ }
};
} //namespace intrusive
Modified: trunk/boost/intrusive/detail/any_node_and_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/detail/any_node_and_algorithms.hpp (original)
+++ trunk/boost/intrusive/detail/any_node_and_algorithms.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -19,6 +19,7 @@
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <cstddef>
#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/pointer_cast.hpp>
namespace boost {
namespace intrusive {
@@ -87,7 +88,10 @@
static const bool optimize_multikey = true;
static node_ptr get_next(const_node_ptr n)
- { return node_ptr(&static_cast<node &>(*n->node_ptr_1)); }
+ {
+ using ::boost::static_pointer_cast;
+ return static_pointer_cast<node>(n->node_ptr_1);
+ }
static void set_next(node_ptr n, node_ptr next)
{ n->node_ptr_1 = next; }
Modified: trunk/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/hashtable_node.hpp (original)
+++ trunk/boost/intrusive/detail/hashtable_node.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -22,7 +22,7 @@
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/slist_node.hpp> //remove-me
#include <cstddef>
-
+#include <boost/pointer_cast.hpp>
namespace boost {
namespace intrusive {
namespace detail {
@@ -118,7 +118,12 @@
typedef typename Container::size_type size_type;
static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
- { return typename Container::node_ptr(&static_cast<typename Container::node&>(*p)); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<typename Container::node>(p);
+ return typename Container::node_ptr(&static_cast<typename Container::node&>(*p));
+ }
public:
typedef typename Container::value_type value_type;
Modified: trunk/boost/intrusive/detail/parent_from_member.hpp
==============================================================================
--- trunk/boost/intrusive/detail/parent_from_member.hpp (original)
+++ trunk/boost/intrusive/detail/parent_from_member.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -9,8 +9,8 @@
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
-#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
+#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
+#define BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <cstddef>
@@ -47,15 +47,13 @@
template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
- return (Parent*)((char*)member -
- offset_from_pointer_to_member(ptr_to_member));
+ return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member));
}
template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
- return (const Parent*)((const char*)member -
- offset_from_pointer_to_member(ptr_to_member));
+ return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member));
}
} //namespace detail {
@@ -68,4 +66,4 @@
#include <boost/intrusive/detail/config_end.hpp>
-#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
+#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
Modified: trunk/boost/intrusive/detail/utilities.hpp
==============================================================================
--- trunk/boost/intrusive/detail/utilities.hpp (original)
+++ trunk/boost/intrusive/detail/utilities.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -410,14 +410,10 @@
static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode;
static node_ptr to_node_ptr(reference value)
- {
- return reinterpret_cast<node*>(&(value.*P));
- }
+ { return static_cast<node*>(&(value.*P)); }
static const_node_ptr to_node_ptr(const_reference value)
- {
- return static_cast<const node*>(&(value.*P));
- }
+ { return static_cast<const node*>(&(value.*P)); }
static pointer to_value_ptr(node_ptr n)
{
@@ -432,6 +428,45 @@
}
};
+template<class Functor>
+struct function_hook_traits
+{
+ public:
+ typedef typename Functor::hook_type hook_type;
+ typedef typename Functor::hook_ptr hook_ptr;
+ typedef typename Functor::const_hook_ptr const_hook_ptr;
+ typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
+ typedef typename node_traits::node node;
+ typedef typename Functor::value_type value_type;
+ typedef typename node_traits::node_ptr node_ptr;
+ typedef typename node_traits::const_node_ptr const_node_ptr;
+ typedef typename boost::pointer_to_other<node_ptr, value_type>::type pointer;
+ typedef typename boost::pointer_to_other<node_ptr, const value_type>::type const_pointer;
+ typedef typename std::iterator_traits<pointer>::reference reference;
+ typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode;
+
+ static node_ptr to_node_ptr(reference value)
+ { return static_cast<node*>(&*Functor::to_hook_ptr(value)); }
+
+ static const_node_ptr to_node_ptr(const_reference value)
+ { return static_cast<const node*>(&*Functor::to_hook_ptr(value)); }
+
+ static pointer to_value_ptr(node_ptr n)
+ { return Functor::to_value_ptr(to_hook_ptr(n)); }
+
+ static const_pointer to_value_ptr(const_node_ptr n)
+ { return Functor::to_value_ptr(to_hook_ptr(n)); }
+
+ private:
+ static hook_ptr to_hook_ptr(node_ptr n)
+ { return hook_ptr(&*static_cast<hook_type*>(&*n)); }
+
+ static const_hook_ptr to_hook_ptr(const_node_ptr n)
+ { return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
+};
+
+
//This function uses binary search to discover the
//highest set bit of the integer
inline std::size_t floor_log2 (std::size_t x)
@@ -454,14 +489,19 @@
inline float fast_log2 (float val)
{
- boost::uint32_t * exp_ptr =
- static_cast<boost::uint32_t *>(static_cast<void*>(&val));
- boost::uint32_t x = *exp_ptr;
+ union caster_t
+ {
+ boost::uint32_t x;
+ float val;
+ } caster;
+
+ caster.val = val;
+ boost::uint32_t x = caster.x;
const int log_2 = (int)(((x >> 23) & 255) - 128);
x &= ~(255 << 23);
x += 127 << 23;
- *exp_ptr = x;
-
+ caster.x = x;
+ val = caster.val;
val = ((-1.0f/3) * val + 2) * val - 2.0f/3;
return (val + log_2);
Modified: trunk/boost/intrusive/hashtable.hpp
==============================================================================
--- trunk/boost/intrusive/hashtable.hpp (original)
+++ trunk/boost/intrusive/hashtable.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -23,6 +23,7 @@
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash.hpp>
+#include <boost/pointer_cast.hpp>
//General intrusive utilities
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
@@ -157,26 +158,22 @@
template<class SupposedValueTraits>
struct unordered_bucket_impl
{
- /// @cond
typedef typename
get_slist_impl_from_supposed_value_traits
<SupposedValueTraits>::type slist_impl;
typedef detail::bucket_impl<slist_impl> implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
template<class SupposedValueTraits>
struct unordered_bucket_ptr_impl
{
- /// @cond
typedef typename detail::get_node_traits
<SupposedValueTraits>::type::node_ptr node_ptr;
typedef typename unordered_bucket_impl
<SupposedValueTraits>::type bucket_type;
typedef typename boost::pointer_to_other
<node_ptr, bucket_type>::type implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
@@ -329,7 +326,12 @@
typedef circular_slist_algorithms<group_traits> group_algorithms;
static node_ptr dcast_bucket_ptr(slist_node_ptr p)
- { return node_ptr(&static_cast<node&>(*p)); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(p);
+ return node_ptr(&static_cast<node&>(*p));
+ }
static slist_node_ptr priv_get_bucket_before_begin
(slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p)
@@ -496,7 +498,6 @@
template<class ValueTraitsOrHookOption>
struct unordered_default_bucket_traits
{
- /// @cond
typedef typename ValueTraitsOrHookOption::
template pack<none>::value_traits supposed_value_traits;
typedef typename detail::
@@ -504,7 +505,6 @@
<supposed_value_traits>::type slist_impl;
typedef detail::bucket_traits_impl
<slist_impl> implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
@@ -2322,7 +2322,12 @@
}
static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p)
- { return node_ptr(&static_cast<node&>(*p)); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(p);
+ return node_ptr(&static_cast<node&>(*p));
+ }
std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const
{ return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); }
@@ -2889,7 +2894,6 @@
//Real value traits must be calculated from options
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
- /// @cond
static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value;
typedef typename detail::eval_if_c
@@ -2898,7 +2902,6 @@
, detail::identity<value_traits>
>::type real_value_traits;
typedef typename packed_options::bucket_traits specified_bucket_traits;
- /// @endcond
//Real bucket traits must be calculated from options and calculated value_traits
typedef typename detail::get_slist_impl
Modified: trunk/boost/intrusive/intrusive_fwd.hpp
==============================================================================
--- trunk/boost/intrusive/intrusive_fwd.hpp (original)
+++ trunk/boost/intrusive/intrusive_fwd.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -50,7 +50,7 @@
////////////////////////////
//slist
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -64,7 +64,7 @@
#endif
class slist;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -75,7 +75,7 @@
#endif
class slist_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -87,7 +87,7 @@
class slist_member_hook;
//list
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -99,7 +99,7 @@
#endif
class list;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -110,7 +110,7 @@
#endif
class list_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -121,8 +121,19 @@
#endif
class list_member_hook;
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+template
+ < class O1 = none
+ , class O2 = none
+ , class O3 = none
+ >
+#else
+template<class ...Options>
+#endif
+class list_hook;
+
//rbtree/set/multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -135,7 +146,7 @@
#endif
class rbtree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -148,7 +159,7 @@
#endif
class set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -161,7 +172,7 @@
#endif
class multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -173,7 +184,7 @@
#endif
class set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -186,7 +197,7 @@
class set_member_hook;
//splaytree/splay_set/splay_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -199,7 +210,7 @@
#endif
class splaytree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -212,7 +223,7 @@
#endif
class splay_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -225,7 +236,7 @@
#endif
class splay_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -236,7 +247,7 @@
#endif
class splay_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -248,7 +259,7 @@
class splay_set_member_hook;
//avltree/avl_set/avl_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -261,7 +272,7 @@
#endif
class avltree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -274,7 +285,7 @@
#endif
class avl_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -287,7 +298,7 @@
#endif
class avl_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -299,7 +310,7 @@
#endif
class avl_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -313,7 +324,7 @@
//treap/treap_set/treap_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -326,7 +337,7 @@
#endif
class treap;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -339,7 +350,7 @@
#endif
class treap_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -357,7 +368,7 @@
struct priority_compare;
//sgtree/sg_set/sg_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -370,7 +381,7 @@
#endif
class sgtree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -383,7 +394,7 @@
#endif
class sg_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -396,7 +407,7 @@
#endif
class sg_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -407,7 +418,7 @@
#endif
class bs_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -420,7 +431,7 @@
//hashtable/unordered_set/unordered_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -439,7 +450,7 @@
#endif
class hashtable;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -458,7 +469,7 @@
#endif
class unordered_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -477,7 +488,7 @@
#endif
class unordered_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -489,7 +500,7 @@
#endif
class unordered_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -501,7 +512,7 @@
#endif
class unordered_set_member_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -512,7 +523,7 @@
#endif
class any_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
Modified: trunk/boost/intrusive/options.hpp
==============================================================================
--- trunk/boost/intrusive/options.hpp (original)
+++ trunk/boost/intrusive/options.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -343,6 +343,24 @@
};
+//!This option setter specifies the function object that will
+//!be used to convert between values to be inserted in a container
+//!and the hook to be used for that purpose.
+template< typename Functor>
+struct function_hook
+{
+/// @cond
+ typedef detail::function_hook_traits
+ <Functor> function_value_traits;
+ template<class Base>
+ struct pack : Base
+ {
+ typedef function_value_traits value_traits;
+ };
+/// @endcond
+};
+
+
//!This option setter specifies that the container
//!must use the specified base hook
template<typename BaseHook>
Added: trunk/boost/intrusive/parent_from_member.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/intrusive/parent_from_member.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2010-2010
+//
+// 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)
+//
+// See http://www.boost.org/libs/intrusive for documentation.
+//
+/////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
+#define BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/detail/parent_from_member.hpp>
+
+namespace boost {
+namespace intrusive {
+
+//! Given a pointer to a member and its corresponding pointer to data member,
+//! this function returns the pointer of the parent containing that member.
+//! Note: this function does not work with pointer to members that rely on
+//! virtual inheritance.
+template<class Parent, class Member>
+inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
+{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
+
+//! Given a const pointer to a member and its corresponding const pointer to data member,
+//! this function returns the const pointer of the parent containing that member.
+//! Note: this function does not work with pointer to members that rely on
+//! virtual inheritance.
+template<class Parent, class Member>
+inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
+{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
+
+} //namespace intrusive {
+} //namespace boost {
+
+#include <boost/intrusive/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
Modified: trunk/boost/intrusive/rbtree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree_algorithms.hpp (original)
+++ trunk/boost/intrusive/rbtree_algorithms.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -57,6 +57,9 @@
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/tree_algorithms.hpp>
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#pragma optimize( "g", off )
+#endif
namespace boost {
namespace intrusive {
@@ -905,6 +908,10 @@
} //namespace intrusive
} //namespace boost
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#pragma optimize( "", on )
+#endif
+
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
Modified: trunk/boost/intrusive/unordered_set_hook.hpp
==============================================================================
--- trunk/boost/intrusive/unordered_set_hook.hpp (original)
+++ trunk/boost/intrusive/unordered_set_hook.hpp 2010-08-24 13:26:36 EDT (Tue, 24 Aug 2010)
@@ -16,6 +16,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
+#include <boost/pointer_cast.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/slist_hook.hpp>
@@ -76,7 +77,12 @@
static const bool optimize_multikey = OptimizeMultiKey;
static node_ptr get_next(const_node_ptr n)
- { return node_ptr(&static_cast<node &>(*n->next_)); }
+ {
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(n->next_);
+ return node_ptr(&static_cast<node&>(*n->next_));
+ }
static void set_next(node_ptr n, node_ptr next)
{ n->next_ = next; }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk