exception.hpp (pb_ds): Modify for -fno-exceptions.

2006-11-07  Benjamin Kosnik  <bkoz@redhat.com>

	* include/ext/pb_ds/exception.hpp (pb_ds): Modify for -fno-exceptions.
	(__throw_container_error): New. Conditionalize based on __EXCEPTIONS.
	(__throw_insert_error): New.
	(__throw_join_error): New.
	(__throw_resize_error): New.
	* include/ext/pb_ds/detail/resize_policy/
	hash_prime_size_policy_imp.hpp: Use them.
	* include/ext/pb_ds/detail/resize_policy/
	hash_exponential_size_policy_imp.hpp: Same.
	* include/ext/pb_ds/detail/resize_policy/
	hash_load_check_resize_trigger_imp.hpp: Same.
	* include/ext/pb_ds/detail/resize_policy/
	hash_standard_resize_policy_imp.hpp: Same.
	* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
	* include/ext/pb_ds/detail/cc_hash_table_map_/
	constructor_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
	* include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
	* include/ext/pb_ds/detail/pat_trie_/
	constructors_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/bin_search_tree_/
	constructors_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/bin_search_tree_/
	split_join_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	insert_no_store_hash_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	resize_store_hash_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	insert_store_hash_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	constructor_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	resize_no_store_hash_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/binary_heap_/
	constructors_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
	constructors_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/list_update_map_/
	constructor_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/exception.hpp: Same.	
	* src/functexcept.cc: Qualify abort with std.

From-SVN: r118554
This commit is contained in:
Benjamin Kosnik 2006-11-07 16:55:49 +00:00 committed by Benjamin Kosnik
parent 8f81c3c650
commit 8fafc2d3a0
25 changed files with 185 additions and 154 deletions

View file

@ -1,3 +1,51 @@
2006-11-07 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/pb_ds/exception.hpp (pb_ds): Modify for -fno-exceptions.
(__throw_container_error): New. Conditionalize based on __EXCEPTIONS.
(__throw_insert_error): New.
(__throw_join_error): New.
(__throw_resize_error): New.
* include/ext/pb_ds/detail/resize_policy/
hash_prime_size_policy_imp.hpp: Use them.
* include/ext/pb_ds/detail/resize_policy/
hash_exponential_size_policy_imp.hpp: Same.
* include/ext/pb_ds/detail/resize_policy/
hash_load_check_resize_trigger_imp.hpp: Same.
* include/ext/pb_ds/detail/resize_policy/
hash_standard_resize_policy_imp.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
* include/ext/pb_ds/detail/cc_hash_table_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
* include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
* include/ext/pb_ds/detail/pat_trie_/
constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/
constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/
split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
insert_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
resize_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
insert_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
resize_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/
constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/exception.hpp: Same.
* src/functexcept.cc: Qualify abort with std.
2006-11-07 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/pb_ds/exception.hpp: Add translation support to

View file

@ -107,7 +107,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
{
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)
s_node_allocator.deallocate(m_p_head, 1);
throw;
__throw_exception_again;
}
_GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
}
@ -170,7 +170,7 @@ recursive_copy_node(const node_pointer p_nd)
catch(...)
{
s_node_allocator.deallocate(p_ret, 1);
throw;
__throw_exception_again;
}
p_ret->m_p_left = p_ret->m_p_right = NULL;
@ -183,7 +183,7 @@ recursive_copy_node(const node_pointer p_nd)
catch(...)
{
clear_imp(p_ret);
throw;
__throw_exception_again;
}
if (p_ret->m_p_left != NULL)

View file

@ -50,37 +50,29 @@ PB_DS_CLASS_C_DEC::
join_prep(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
if (other.m_size == 0)
return (false);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
if (other.m_size == 0)
return false;
if (m_size == 0)
{
value_swap(other);
return (false);
return false;
}
const bool greater = Cmp_Fn::operator()(
PB_DS_V2F(m_p_head->m_p_right->m_value),
PB_DS_V2F(other.m_p_head->m_p_left->m_value));
const bool greater = Cmp_Fn::operator()(PB_DS_V2F(m_p_head->m_p_right->m_value), PB_DS_V2F(other.m_p_head->m_p_left->m_value));
const bool lesser = Cmp_Fn::operator()(
PB_DS_V2F(other.m_p_head->m_p_right->m_value),
PB_DS_V2F(m_p_head->m_p_left->m_value));
const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(other.m_p_head->m_p_right->m_value), PB_DS_V2F(m_p_head->m_p_left->m_value));
if (!greater&& !lesser)
throw join_error();
if (!greater && !lesser)
__throw_join_error();
if (lesser)
value_swap(other);
m_size += other.m_size;
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)
return (true);
return true;
}
PB_DS_CLASS_T_DEC
@ -89,7 +81,6 @@ PB_DS_CLASS_C_DEC::
join_finish(PB_DS_CLASS_C_DEC& other)
{
initialize_min_max();
other.initialize();
}
@ -99,53 +90,41 @@ PB_DS_CLASS_C_DEC::
split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
other.clear();
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
other.clear();
if (m_size == 0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return (false);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return false;
}
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value)))
{
value_swap(other);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return (false);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return false;
}
if (!Cmp_Fn::operator()(
r_key,
PB_DS_V2F(m_p_head->m_p_right->m_value)))
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value)))
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return (false);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return false;
}
if (m_size == 1)
{
value_swap(other);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return (false);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
return false;
}
_GLIBCXX_DEBUG_ONLY(map_debug_base::split(
r_key,(Cmp_Fn& )(*this),
other);)
return (true);
_GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
return true;
}
PB_DS_CLASS_T_DEC
@ -154,28 +133,20 @@ PB_DS_CLASS_C_DEC::
split_finish(PB_DS_CLASS_C_DEC& other)
{
other.initialize_min_max();
other.m_size =
std::distance(other.begin(), other.end());
other.m_size = std::distance(other.begin(), other.end());
m_size -= other.m_size;
initialize_min_max();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
recursive_count(node_pointer p_nd) const
recursive_count(node_pointer p) const
{
if (p_nd == NULL)
return (0);
return (1 +
recursive_count(p_nd->m_p_left) +
recursive_count(p_nd->m_p_right));
if (p == NULL)
return 0;
return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);
}

View file

@ -65,14 +65,13 @@ copy_from_range(It first_it, It last_it)
while (first_it != last_it)
{
insert_value(*first_it, s_no_throw_copies_ind);
++first_it;
}
std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
@ -82,7 +81,7 @@ binary_heap_() :
m_a_entries(s_entry_allocator.allocate(m_actual_size))
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
@ -93,7 +92,7 @@ binary_heap_(const Cmp_Fn& r_cmp_fn) :
m_a_entries(s_entry_allocator.allocate(m_actual_size))
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
@ -105,7 +104,7 @@ binary_heap_(const PB_DS_CLASS_C_DEC& other) :
m_a_entries(s_entry_allocator.allocate(m_actual_size))
{
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
const_iterator first_it = other.begin();
const_iterator last_it = other.end();
@ -115,7 +114,6 @@ binary_heap_(const PB_DS_CLASS_C_DEC& other) :
while (first_it != last_it)
{
insert_value(*first_it, s_no_throw_copies_ind);
++first_it;
}
}
@ -125,12 +123,10 @@ binary_heap_(const PB_DS_CLASS_C_DEC& other) :
erase_at(m_a_entries, i, s_no_throw_copies_ind);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
throw;
__throw_exception_again;
}
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
void
@ -138,16 +134,14 @@ PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
value_swap(other);
std::swap((entry_cmp& )(*this), (entry_cmp& )other);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
PB_DS_CLASS_T_DEC
void
@ -155,12 +149,9 @@ PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
std::swap(m_a_entries, other.m_a_entries);
std::swap(m_size, other.m_size);
std::swap(m_actual_size, other.m_actual_size);
static_cast<resize_policy* >(this)->swap(other);
static_cast<resize_policy*>(this)->swap(other);
}
PB_DS_CLASS_T_DEC
@ -169,7 +160,6 @@ PB_DS_CLASS_C_DEC::
{
for (size_type i = 0; i < m_size; ++i)
erase_at(m_a_entries, i, s_no_throw_copies_ind);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
}

View file

@ -91,7 +91,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
if (a_other_entries != NULL)
s_entry_allocator.deallocate(a_other_entries, other_actual_size);
throw;
__throw_exception_again;
};
for (size_type i = 0; i < other.m_size; ++i)
@ -129,9 +129,9 @@ PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
const size_type size = m_size + other.m_size;
const size_type size = m_size + other.m_size;
const size_type actual_size = resize_policy::get_new_size_for_arbitrary(size);
entry_pointer a_entries = NULL;
@ -140,7 +140,6 @@ join(PB_DS_CLASS_C_DEC& other)
try
{
a_entries = s_entry_allocator.allocate(actual_size);
a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
}
catch(...)
@ -151,7 +150,7 @@ join(PB_DS_CLASS_C_DEC& other)
if (a_other_entries != NULL)
s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
throw;
__throw_exception_again;
}
std::copy(m_a_entries, m_a_entries + m_size, a_entries);
@ -174,6 +173,6 @@ join(PB_DS_CLASS_C_DEC& other)
other.notify_arbitrary(resize_policy::min_size);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}

View file

@ -146,7 +146,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
catch(...)
{
deallocate_all();
throw;
__throw_exception_again;
}
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
}

View file

@ -103,7 +103,7 @@ resize_imp(size_type new_size)
catch(...)
{
ranged_hash_fn_base::notify_resized(old_size);
throw;
__throw_exception_again;
}
// At this point no exceptions can be thrown.

View file

@ -164,7 +164,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
catch(...)
{
deallocate_all();
throw;
__throw_exception_again;
}
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
}

View file

@ -92,7 +92,7 @@ find_ins_pos(const_key_reference r_key, false_type)
}
resize_base::notify_insert_search_end();
if (ins_pos == m_num_e)
throw insert_error();
__throw_insert_error();
return ins_pos;
}

View file

@ -97,7 +97,7 @@ find_ins_pos(const_key_reference r_key, true_type)
}
resize_base::notify_insert_search_end();
if (ins_pos == m_num_e)
throw insert_error();
__throw_insert_error();
return std::make_pair(ins_pos, pos_hash_pair.second);
}

View file

@ -114,7 +114,7 @@ resize_imp(size_type new_size)
m_num_e = old_size;
s_entry_allocator.deallocate(a_entries_resized, new_size);
ranged_probe_fn_base::notify_resized(old_size);
throw;
__throw_exception_again;
}
// At this point no exceptions can be thrown.

View file

@ -73,6 +73,6 @@ resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
_GLIBCXX_DEBUG_ASSERT(0);
};
}
throw insert_error();
__throw_insert_error();
}

View file

@ -75,6 +75,6 @@ resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
_GLIBCXX_DEBUG_ASSERT(0);
};
}
throw insert_error();
__throw_insert_error();
}

View file

@ -59,7 +59,7 @@ left_child_next_sibling_heap_() :
m_size(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
@ -69,25 +69,19 @@ left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
m_size(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other) :
Cmp_Fn(other),
m_p_root(NULL),
m_size(0)
left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other)
: Cmp_Fn(other), m_p_root(NULL), m_size(0)
{
m_size = other.m_size;
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
m_p_root = recursive_copy_node(other.m_p_root);
m_p_root = recursive_copy_node(other.m_p_root);
m_size = other.m_size;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
}
PB_DS_CLASS_T_DEC
void
@ -95,15 +89,12 @@ PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
value_swap(other);
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
value_swap(other);
std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
}
PB_DS_CLASS_T_DEC
void
@ -111,7 +102,6 @@ PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
std::swap(m_p_root, other.m_p_root);
std::swap(m_size, other.m_size);
}
@ -139,8 +129,7 @@ recursive_copy_node(const_node_pointer p_nd)
catch(...)
{
s_node_allocator.deallocate(p_ret, 1);
throw;
__throw_exception_again;
}
p_ret->m_p_l_child = p_ret->m_p_next_sibling =
@ -149,14 +138,12 @@ recursive_copy_node(const_node_pointer p_nd)
try
{
p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);
p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);
}
catch(...)
{
clear_imp(p_ret);
throw;
__throw_exception_again;
}
if (p_ret->m_p_l_child != NULL)
@ -164,10 +151,8 @@ recursive_copy_node(const_node_pointer p_nd)
if (p_ret->m_p_next_sibling != NULL)
p_ret->m_p_next_sibling->m_p_prev_or_parent =
p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd?
p_ret :
NULL;
p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL;
return (p_ret);
return p_ret;
}

View file

@ -107,7 +107,7 @@ m_p_l(NULL)
catch(...)
{
deallocate_all();
throw;
__throw_exception_again;
}
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}

View file

@ -122,8 +122,8 @@ join(PB_DS_CLASS_C_DEC& other)
const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)),
PB_DS_V2F(*begin()));
if (!greater&& !lesser)
throw join_error();
if (!greater && !lesser)
__throw_join_error();
PB_DS_CLASS_C_DEC new_this(*this, *this);

View file

@ -103,7 +103,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
catch(...)
{
s_head_allocator.deallocate(m_p_head, 1);
throw;
__throw_exception_again;
}
m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
@ -203,7 +203,7 @@ recursive_copy_node(const_node_pointer p_other_nd)
{
while (child_i-- > 0)
clear_imp(a_p_children[child_i]);
throw;
__throw_exception_again;
}
new (p_ret) internal_node(p_other_internal_nd->get_e_ind(),

View file

@ -95,7 +95,7 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
other.m_p_head->m_p_max)->value()),PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value()));
if (!greater && !lesser)
throw join_error();
__throw_join_error();
rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)

View file

@ -67,7 +67,7 @@ public:
catch(...)
{
s_internal_node_allocator.deallocate(p_nd, 1);
throw;
__throw_exception_again;
}
}

View file

@ -70,7 +70,7 @@ get_nearest_larger_size(size_type size) const
{
const size_type next_ret = ret* m_grow_factor;
if (next_ret < ret)
throw insert_error();
__throw_insert_error();
ret = next_ret;
}
return ret;
@ -86,7 +86,7 @@ get_nearest_smaller_size(size_type size) const
{
const size_type next_ret = ret* m_grow_factor;
if (next_ret < ret)
throw resize_error();
__throw_resize_error();
if (next_ret >= size)
return (ret);
ret = next_ret;

View file

@ -275,7 +275,7 @@ set_loads(std::pair<float, float> load_pair)
m_next_shrink_size = old_next_shrink_size;
m_next_grow_size = old_next_grow_size;
m_resize_needed = old_resize_needed;
throw;
__throw_exception_again;
}
}

View file

@ -145,7 +145,7 @@ get_nearest_larger_size(size_type n) const
detail::g_a_sizes + detail::num_distinct_sizes, n);
if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes)
throw resize_error();
__throw_resize_error();
return *p_upper;
}

View file

@ -200,7 +200,7 @@ resize(size_type new_size)
const size_type pot = size_policy_base::get_nearest_larger_size(actual_size);
if (pot == actual_size && pot < new_size)
throw resize_error();
__throw_resize_error();
actual_size = pot;
}
@ -215,12 +215,12 @@ resize(size_type new_size)
catch(insert_error& )
{
m_size = old_size;
throw resize_error();
__throw_resize_error();
}
catch(...)
{
m_size = old_size;
throw;
__throw_exception_again;
}
}

View file

@ -51,6 +51,8 @@
namespace pb_ds
{
#if __EXCEPTIONS
// Base class for exceptions.
struct container_error : public std::logic_error
{
@ -69,6 +71,42 @@ namespace pb_ds
// A container cannot be resized.
struct resize_error : public container_error { };
void
__throw_container_error(void)
{ throw container_error(); }
void
__throw_insert_error(void)
{ throw insert_error(); }
void
__throw_join_error(void)
{ throw join_error(); }
void
__throw_resize_error(void)
{ throw resize_error(); }
#else
void
__throw_container_error(void)
{ std::abort(); }
void
__throw_insert_error(void)
{ std::abort(); }
void
__throw_join_error(void)
{ std::abort(); }
void
__throw_resize_error(void)
{ std::abort(); }
#endif
} // namespace pb_ds
#endif

View file

@ -101,59 +101,59 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#else
void
__throw_bad_exception(void)
{ abort(); }
{ std::abort(); }
void
__throw_bad_alloc(void)
{ abort(); }
{ std::abort(); }
void
__throw_bad_cast(void)
{ abort(); }
{ std::abort(); }
void
__throw_bad_typeid(void)
{ abort(); }
{ std::abort(); }
void
__throw_logic_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_domain_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_invalid_argument(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_length_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_out_of_range(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_runtime_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_range_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_overflow_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_underflow_error(const char*)
{ abort(); }
{ std::abort(); }
void
__throw_ios_failure(const char*)
{ abort(); }
{ std::abort(); }
#endif //__EXCEPTIONS
_GLIBCXX_END_NAMESPACE