Boost C++ Libraries: Ticket #4557: Boost.Interprocess fails to compile when BOOST_ENABLE_ASSERT_HANDLER is defined https://svn.boost.org/trac10/ticket/4557 <p> Some boost.interprocess files fail to compile with BOOST_ENABLE_ASSERT_HANDLER defined. The files seem to all include boost/assert.hpp and use the BOOST_ASSERT macro in places, yet also use the regular assert() occasionally. However with BOOST_ENABLE_ASSERT_HANDLER defined assert.h is never included and we get a compile error. </p> <p> boost_1_44_0/boost/interprocess $ grep -R assert\( * allocators/detail/allocator_common.hpp: assert(m_header.m_usecount &gt; 0); containers/container/detail/advanced_insert_int.hpp: assert(n &lt;= count_); containers/container/detail/advanced_insert_int.hpp: assert(count_ == 0); containers/container/detail/advanced_insert_int.hpp: assert(difference_type(count_)&gt;= division_count); containers/container/detail/advanced_insert_int.hpp: assert(count_ == 0); containers/container/detail/advanced_insert_int.hpp: assert(difference_type(count_)&gt;= division_count); containers/container/detail/advanced_insert_int.hpp: assert(new_count == 0); containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); \ containers/container/detail/advanced_insert_int.hpp: assert(division_count &lt;=1); \ containers/container/detail/node_pool_impl.hpp: assert(m_freelist.empty()); containers/container/detail/node_pool_impl.hpp: assert(m_allocated==0); containers/container/detail/node_pool_impl.hpp: assert(m_nodes_per_block == other.m_nodes_per_block); containers/container/detail/node_pool_impl.hpp: assert(m_real_node_size == other.m_real_node_size); containers/container/detail/node_pool_impl.hpp: assert(m_allocated&gt;0); containers/container/detail/adaptive_node_pool_impl.hpp: assert(m_max_free_blocks == other.m_max_free_blocks); containers/container/detail/adaptive_node_pool_impl.hpp: assert(m_real_node_size == other.m_real_node_size); containers/container/detail/adaptive_node_pool_impl.hpp: assert(m_real_block_alignment == other.m_real_block_alignment); containers/container/detail/adaptive_node_pool_impl.hpp: assert(m_real_num_node == other.m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(!m_block_multiset.empty()); containers/container/detail/adaptive_node_pool_impl.hpp: assert(it-&gt;free_nodes.size() == m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(block_info-&gt;free_nodes.size() &lt; m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(m_block_multiset.begin() != m_block_multiset.end()); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 != free_nodes_count); containers/container/detail/adaptive_node_pool_impl.hpp: assert(free_nodes == mp_impl-&gt;m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(free_nodes == mp_impl-&gt;m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == to_deallocate-&gt;hdr_offset); containers/container/detail/adaptive_node_pool_impl.hpp: assert(sp &lt;= si); containers/container/detail/adaptive_node_pool_impl.hpp: assert(total_free_nodes &gt;= m_totally_free_blocks*m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(total_free &gt;= m_totally_free_blocks); containers/container/detail/adaptive_node_pool_impl.hpp: assert(hdr_off_holder-&gt;hdr_offset == std::size_t(reinterpret_cast&lt;char*&gt;(&amp;*it)- reinterpret_cast&lt;char*&gt;(hdr_off_holder))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == ((std::size_t)hdr_off_holder &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == (hdr_off_holder-&gt;hdr_offset &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(it-&gt;free_nodes.size() == m_real_num_node); containers/container/detail/adaptive_node_pool_impl.hpp: assert(num_free_nodes == m_totally_free_blocks); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == ((std::size_t)hdr_off_holder &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == (hdr_off_holder-&gt;hdr_offset &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(block-&gt;hdr_offset == 0); containers/container/detail/adaptive_node_pool_impl.hpp: assert(hdr_off_holder-&gt;hdr_offset == std::size_t(reinterpret_cast&lt;char*&gt;(block) - reinterpret_cast&lt;char*&gt;(hdr_off_holder))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == ((std::size_t)hdr_off_holder &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(0 == (hdr_off_holder-&gt;hdr_offset &amp; (m_real_block_alignment - 1))); containers/container/detail/adaptive_node_pool_impl.hpp: assert(static_cast&lt;void*&gt;(&amp;static_cast&lt;hdr_offset_holder*&gt;(c_info)-&gt;hdr_offset) == detail/segment_manager_helper.hpp: assert(hdr-&gt;m_value_alignment == algn); detail/segment_manager_helper.hpp: assert(hdr-&gt;m_value_bytes % sz == 0); detail/intersegment_ptr.hpp: assert(addr &lt; static_cast&lt;void*&gt;(this)); detail/intersegment_ptr.hpp: assert(pow &gt;= frc_size_bits); detail/intersegment_ptr.hpp: assert(pow &gt;= frc_size_bits); detail/intersegment_ptr.hpp: assert(((frc &lt;&lt; (pow - frc_size_bits)) &amp; (align-1))==0); detail/intersegment_ptr.hpp: assert(mode &lt; is_max_mode); detail/intersegment_ptr.hpp: assert(this_info.size == s); detail/intersegment_ptr.hpp: assert(!m_segments.empty()); detail/intersegment_ptr.hpp: assert(segment_id &lt; (std::size_t)m_segments.size()); detail/intersegment_ptr.hpp: assert(m_ptr_to_segment_info.empty()); detail/intersegment_ptr.hpp: assert(ret.second); detail/intersegment_ptr.hpp: assert(erased); detail/intersegment_ptr.hpp: assert(ret.second); detail/managed_multi_shared_memory.hpp: assert(ret);(void)ret; detail/managed_multi_shared_memory.hpp: assert(ret); managed_external_buffer.hpp: assert((0 == (((std::size_t)addr) &amp; (AllocationAlgorithm::Alignment - std::size_t(1u))))); managed_external_buffer.hpp: assert((0 == (((std::size_t)addr) &amp; (AllocationAlgorithm::Alignment - std::size_t(1u))))); mapped_region.hpp: assert(ret == 0); mem_algo/detail/mem_algo_common.hpp: assert((needs_backwards % backwards_multiple) == 0); mem_algo/detail/mem_algo_common.hpp: assert((needs_backwards_lcmed &amp; (Alignment - 1u)) == 0); mem_algo/detail/mem_algo_common.hpp: assert((needs_backwards_lcmed % lcm) == 0); mem_algo/detail/mem_algo_common.hpp: assert((needs_backwards_lcmed % lcm) == 0); mem_algo/detail/mem_algo_common.hpp: assert((needs_backwards % backwards_multiple) == 0); mem_algo/detail/mem_algo_common.hpp: assert(pos &lt;= (reinterpret_cast&lt;char*&gt;(first) + first-&gt;m_size*Alignment)); mem_algo/detail/mem_algo_common.hpp: assert(first-&gt;m_size &gt;= 2*<a class="missing wiki">MinBlockUnits</a>); mem_algo/detail/mem_algo_common.hpp: assert((pos + <a class="missing wiki">MinBlockUnits</a>*Alignment - <a class="missing wiki">AllocatedCtrlBytes</a> + nbytes*<a class="missing wiki">Alignment/Alignment</a>) &lt;= mem_algo/detail/mem_algo_common.hpp: assert(second-&gt;m_size &gt;= <a class="missing wiki">MinBlockUnits</a>); mem_algo/detail/mem_algo_common.hpp: assert((new_block-&gt;m_size*Alignment - <a class="missing wiki">AllocatedCtrlUnits</a>) &gt;= sizeof(void_pointer)); mem_algo/detail/multi_simple_seq_fit_impl.hpp:// assert(m_header.m_allocated == 0); mem_algo/detail/multi_simple_seq_fit_impl.hpp:// assert(m_header.m_root.m_next-&gt;m_next == block_ctrl_ptr(&amp;m_header.m_root)); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(!(size &lt; <a class="missing wiki">MinBlockSize</a>)); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(p_services); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(block-&gt;m_next == 0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(block-&gt;m_next == 0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert((alignment &amp; (alignment - std::size_t(1u))) != 0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(((reinterpret_cast&lt;char*&gt;(block) - reinterpret_cast&lt;char*&gt;(this)) mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(block-&gt;m_next == 0); mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert((reinterpret_cast&lt;char*&gt;(addr) - reinterpret_cast&lt;char*&gt;(this)) mem_algo/detail/multi_simple_seq_fit_impl.hpp: assert(m_header.m_allocated &gt;= total_size); mem_algo/detail/simple_seq_fit_impl.hpp:// assert(m_header.m_allocated == 0); mem_algo/detail/simple_seq_fit_impl.hpp:// assert(m_header.m_root.m_next-&gt;m_next == block_ctrl_ptr(&amp;m_header.m_root)); mem_algo/detail/simple_seq_fit_impl.hpp: assert(prev == root); mem_algo/detail/simple_seq_fit_impl.hpp: assert(last_free_end_address == (reinterpret_cast&lt;char*&gt;(last) + last-&gt;m_size*Alignment)); mem_algo/detail/simple_seq_fit_impl.hpp: assert(addr); mem_algo/detail/simple_seq_fit_impl.hpp: assert(received_size == last_units*Alignment - <a class="missing wiki">AllocatedCtrlBytes</a>); mem_algo/detail/simple_seq_fit_impl.hpp: assert(!(size &lt; <a class="missing wiki">MinBlockSize</a>)); mem_algo/detail/simple_seq_fit_impl.hpp: assert(0); mem_algo/detail/simple_seq_fit_impl.hpp: assert(ret != 0); mem_algo/detail/simple_seq_fit_impl.hpp: assert(block-&gt;m_next == 0); mem_algo/detail/simple_seq_fit_impl.hpp: assert(0); mem_algo/detail/simple_seq_fit_impl.hpp: assert(block-&gt;m_next == 0); mem_algo/detail/simple_seq_fit_impl.hpp: assert(m_header.m_allocated &gt;= total_size); mem_algo/rbtree_best_fit.hpp: assert(get_min_size(extra_hdr_bytes) &lt;= size); mem_algo/rbtree_best_fit.hpp:// assert(m_header.m_allocated == 0); mem_algo/rbtree_best_fit.hpp:// assert(m_header.m_root.m_next-&gt;m_next == block_ctrl_ptr(&amp;m_header.m_root)); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(old_end_block)); mem_algo/rbtree_best_fit.hpp:// assert((m_header.m_size - old_end) &gt;= <a class="missing wiki">MinBlockUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(first_block == priv_next_block(new_end_block)); mem_algo/rbtree_best_fit.hpp: assert(new_end_block == priv_end_block(first_block)); mem_algo/rbtree_best_fit.hpp: assert(new_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(priv_next_block(new_block) == new_end_block); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(old_end_block)); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(unique_block)); mem_algo/rbtree_best_fit.hpp: assert(!priv_is_allocated_block(last_block)); mem_algo/rbtree_best_fit.hpp: assert(priv_end_block(first_block) == new_end_block); mem_algo/rbtree_best_fit.hpp: assert(size &gt;= (<a class="missing wiki">BlockCtrlBytes</a> + <a class="missing wiki">EndCtrlBlockBytes</a>)); mem_algo/rbtree_best_fit.hpp: assert(first_big_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(priv_next_block(first_big_block) == end_block); mem_algo/rbtree_best_fit.hpp: assert(priv_next_block(end_block) == first_big_block); mem_algo/rbtree_best_fit.hpp: assert(priv_end_block(first_big_block) == end_block); mem_algo/rbtree_best_fit.hpp: assert(priv_prev_block(end_block) == first_big_block); mem_algo/rbtree_best_fit.hpp: assert(static_cast&lt;void*&gt;(static_cast&lt;<a class="missing wiki">SizeHolder</a>*&gt;(first_big_block)) mem_algo/rbtree_best_fit.hpp: <em>assert((Alignment % 2) == 0); mem_algo/rbtree_best_fit.hpp: </em>assert(reuse-&gt;m_size == priv_tail_size(reuse)); mem_algo/rbtree_best_fit.hpp: assert(!priv_is_allocated_block(prev_block)); mem_algo/rbtree_best_fit.hpp: assert(prev_block-&gt;m_size == reuse-&gt;m_prev_size); mem_algo/rbtree_best_fit.hpp: assert(0); mem_algo/rbtree_best_fit.hpp: assert(received_size = received_size2); mem_algo/rbtree_best_fit.hpp: assert(new_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(prev_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert((static_cast&lt;char*&gt;(reuse_ptr) - static_cast&lt;char*&gt;(user_ptr)) % backwards_multiple == 0); mem_algo/rbtree_best_fit.hpp: assert(prev_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert((static_cast&lt;char*&gt;(reuse_ptr) - static_cast&lt;char*&gt;(user_ptr)) % backwards_multiple == 0); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(block)); mem_algo/rbtree_best_fit.hpp: <em>assert(old_block_units == priv_tail_size(block)); mem_algo/rbtree_best_fit.hpp: assert(min_user_units &lt;= preferred_user_units); mem_algo/rbtree_best_fit.hpp: assert(next_block-&gt;m_size == priv_next_block(next_block)-&gt;m_prev_size); mem_algo/rbtree_best_fit.hpp: assert(rem_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(!ptr-&gt;m_prev_allocated); mem_algo/rbtree_best_fit.hpp: assert(!priv_is_allocated_block(prev)); mem_algo/rbtree_best_fit.hpp: assert(first_segment_block-&gt;m_prev_allocated); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(end_block)); mem_algo/rbtree_best_fit.hpp: assert(end_block &gt; first_segment_block); mem_algo/rbtree_best_fit.hpp: assert(allocated == next_block_prev_allocated); mem_algo/rbtree_best_fit.hpp: </em>assert(!priv_is_allocated_block(block)); mem_algo/rbtree_best_fit.hpp: <em>assert(!priv_is_allocated_block(ptr)); mem_algo/rbtree_best_fit.hpp: assert(block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(rem_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(0); mem_algo/rbtree_best_fit.hpp: assert(priv_is_allocated_block(block)); mem_algo/rbtree_best_fit.hpp:// assert(block-&gt;m_size == priv_tail_size(block)); mem_algo/rbtree_best_fit.hpp: assert(m_header.m_allocated &gt;= block_old_size); mem_algo/rbtree_best_fit.hpp: assert(prev_block-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); mem_algo/rbtree_best_fit.hpp: assert(block_to_insert-&gt;m_size &gt;= <a class="missing wiki">BlockCtrlUnits</a>); offset_ptr.hpp: assert(0 == (std::size_t(pint) &amp; Mask)); offset_ptr.hpp: assert(b &lt; (std::size_t(1) &lt;&lt; <a class="missing wiki">NumBits</a>)); segment_manager.hpp: assert((sizeof(segment_manager_base&lt;<a class="missing wiki">MemoryAlgorithm</a>&gt;) == sizeof(<a class="missing wiki">MemoryAlgorithm</a>))); segment_manager.hpp: assert(0); segment_manager.hpp: assert(static_cast&lt;const void*&gt;(this) == static_cast&lt;const void*&gt;(static_cast&lt;Base*&gt;(this))); segment_manager.hpp: assert(name != 0); segment_manager.hpp: assert(0); </em></p> <table class="wiki"> <tr>segment_manager.hpp: assert((type == anonymous_type &amp;&amp; ctrl_data-&gt;m_num_char == 0) </tr></table> <p> segment_manager.hpp: assert(ctrl_data-&gt;sizeof_char() == sizeof(<a class="missing wiki">CharType</a>)); segment_manager.hpp: assert(ctrl_data-&gt;m_num_char == std::char_traits&lt;<a class="missing wiki">CharType</a>&gt;::length(name)); segment_manager.hpp: assert((ctrl_data-&gt;value_bytes() %sizeofvalue) == 0); segment_manager.hpp: assert((instance_type)ctrl_data-&gt;alloc_type() &lt; max_allocation_type); segment_manager.hpp: assert((ctrl_data-&gt;m_value_bytes % table.size) == 0); segment_manager.hpp: assert(ctrl_data-&gt;sizeof_char() == sizeof(CharT)); segment_manager.hpp: assert((ctrl_data-&gt;m_value_bytes % table.size) == 0); segment_manager.hpp: assert(ctrl_data-&gt;sizeof_char() == sizeof(CharT)); segment_manager.hpp: <em>assert(0); segment_manager.hpp: assert((ctrl_data-&gt;m_value_bytes % table.size) == 0); segment_manager.hpp: assert(sizeof(CharT) == ctrl_data-&gt;sizeof_char()); segment_manager.hpp: </em>assert(0); segment_manager.hpp: assert((ctrl_data-&gt;m_value_bytes % table.size) == 0); segment_manager.hpp: assert(static_cast&lt;void*&gt;(stored_name) == static_cast&lt;void*&gt;(ctrl_data-&gt;template name&lt;CharT&gt;())); segment_manager.hpp: assert(sizeof(CharT) == ctrl_data-&gt;sizeof_char()); streams/vectorstream.hpp: assert(m_vect.size() == m_vect.capacity()); streams/vectorstream.hpp: assert(m_vect.size() == m_vect.capacity()); sync/xsi/xsi_named_mutex.hpp: assert(success); sync/emulation/interprocess_recursive_mutex.hpp: assert(detail::equal_systemwide_thread_id(thr_id, old_id)); sync/posix/interprocess_recursive_mutex.hpp: assert(res == 0);(void)res; sync/posix/interprocess_recursive_mutex.hpp: assert(res == 0); sync/posix/interprocess_barrier.hpp: assert(res == 0);(void)res; sync/posix/interprocess_mutex.hpp: assert(res == 0);(void)res; sync/posix/interprocess_mutex.hpp: assert(res == 0); sync/posix/interprocess_condition.hpp: assert(res == 0); sync/posix/interprocess_condition.hpp: assert(res == 0); sync/posix/interprocess_condition.hpp: assert(res == 0); sync/posix/interprocess_condition.hpp: assert(res == 0); </p> <table class="wiki"> <tr>sync/posix/interprocess_condition.hpp: assert(res == 0 <td> res == ETIMEDOUT); </td></tr></table> <p> sync/posix/semaphore_wrapper.hpp: assert(0); sync/posix/semaphore_wrapper.hpp: assert(0); </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4557 Trac 1.4.3 Ion Gaztañaga Thu, 26 Aug 2010 10:25:47 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/4557#comment:1 https://svn.boost.org/trac10/ticket/4557#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost-1.45.0</span> </li> </ul> <p> Replaced all asserts with BOOST_ASSERT for Boost 1.45 in release branch </p> Ticket chetanreddy@… Wed, 17 Apr 2013 15:02:11 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/4557#comment:2 https://svn.boost.org/trac10/ticket/4557#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> There is still one usage of assert in boost/interprocess/mapped_region.hpp (line 328) . This causes compilation to fail when BOOST_DISABLE_ASSERTS is set. Could you please either change it to BOOST_ASSERT, or include assert.h? </p> Ticket Ion Gaztañaga Thu, 18 Apr 2013 20:03:25 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4557#comment:3 https://svn.boost.org/trac10/ticket/4557#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83959" title="Fixes #4557">[83959]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4557" title="#4557: Bugs: Boost.Interprocess fails to compile when BOOST_ENABLE_ASSERT_HANDLER ... (closed: fixed)">#4557</a> </p> Ticket