From c4f08cc046c816611d1a1ccae7b9f3cdc0699cbd Mon Sep 17 00:00:00 2001
From: bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 7 Nov 2006 16:55:49 +0000
Subject: [PATCH] 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.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118554 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libstdc++-v3/ChangeLog                        | 48 ++++++++++
 .../constructors_destructor_fn_imps.hpp       |  6 +-
 .../bin_search_tree_/split_join_fn_imps.hpp   | 87 +++++++------------
 .../constructors_destructor_fn_imps.hpp       | 32 +++----
 .../binary_heap_/split_join_fn_imps.hpp       | 13 ++-
 .../constructor_destructor_fn_imps.hpp        |  2 +-
 .../cc_hash_table_map_/resize_fn_imps.hpp     |  2 +-
 .../constructor_destructor_fn_imps.hpp        |  2 +-
 .../insert_no_store_hash_fn_imps.hpp          |  2 +-
 .../insert_store_hash_fn_imps.hpp             |  2 +-
 .../gp_hash_table_map_/resize_fn_imps.hpp     |  2 +-
 .../resize_no_store_hash_fn_imps.hpp          |  2 +-
 .../resize_store_hash_fn_imps.hpp             |  2 +-
 .../constructors_destructor_fn_imps.hpp       | 43 +++------
 .../constructor_destructor_fn_imps.hpp        |  2 +-
 .../ov_tree_map_/split_join_fn_imps.hpp       |  4 +-
 .../constructors_destructor_fn_imps.hpp       |  4 +-
 .../detail/pat_trie_/insert_join_fn_imps.hpp  |  2 +-
 .../pat_trie_/split_join_branch_bag.hpp       |  2 +-
 .../hash_exponential_size_policy_imp.hpp      |  4 +-
 .../hash_load_check_resize_trigger_imp.hpp    |  2 +-
 .../hash_prime_size_policy_imp.hpp            |  2 +-
 .../hash_standard_resize_policy_imp.hpp       |  6 +-
 libstdc++-v3/include/ext/pb_ds/exception.hpp  | 38 ++++++++
 libstdc++-v3/src/functexcept.cc               | 28 +++---
 25 files changed, 185 insertions(+), 154 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 374fbf6a50da..caca3e7a9451 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
index 454d46b6f5cd..a6ee92001279 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
@@ -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)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
index ee7e2e8a3c3b..2c8e77dedf52 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
@@ -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);
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
index ada9c2af083a..b43529beeb3d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
@@ -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);
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
index 1cca3818139a..936d825e3249 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
@@ -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();)
+}
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
index 4bb1e12059ea..7da4d8a1e791 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -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();)
 }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
index ea30fe73a972..57f8b970d520 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
@@ -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.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
index fea41777067a..1491a91671ec 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -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();)
 }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
index 48e7aa0f0571..98d597051bdc 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -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;
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
index 9d794d6069aa..b6445fae2e61 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -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);
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
index 05c9e8c2c526..4368d12d6261 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
@@ -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.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
index 33f0da5f99ee..2f4126a12d1e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
@@ -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();
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
index 0cced8eca5aa..ac2ce14cc05e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
@@ -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();
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
index 0d310d511d4a..85d2511cac6c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -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;
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
index 932b3412390e..a311a79757de 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
@@ -107,7 +107,7 @@ m_p_l(NULL)
   catch(...)
     {
       deallocate_all();
-      throw;
+      __throw_exception_again;
     }
   _GLIBCXX_DEBUG_ONLY(assert_valid();)
 }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
index 7f6e5d48f7cb..3b6abcd6c773 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
@@ -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);
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
index 5664eb0bef9b..a5a96a5a3893 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
@@ -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(),
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
index c4290156ab19..4916ae34ff68 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
@@ -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);)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
index 6b20fe64680b..bf04cb4ab7cb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
@@ -67,7 +67,7 @@ public:
     catch(...)
       {
 	s_internal_node_allocator.deallocate(p_nd, 1);
-	throw;
+	__throw_exception_again;
       }
   }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
index ccd7221ebd5a..51cfc457c7d6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
@@ -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;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
index 9d6795916bb8..f3c597f93408 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
@@ -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;
     }
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
index 18f24bd7b294..3328c9158ac2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -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;
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
index e6edf0254b8e..b8489915c843 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
@@ -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;
     }
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/exception.hpp b/libstdc++-v3/include/ext/pb_ds/exception.hpp
index 4d1b05394569..d8eff1749d14 100644
--- a/libstdc++-v3/include/ext/pb_ds/exception.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/exception.hpp
@@ -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
diff --git a/libstdc++-v3/src/functexcept.cc b/libstdc++-v3/src/functexcept.cc
index 80a2d9ec34d7..5e53f052d84d 100644
--- a/libstdc++-v3/src/functexcept.cc
+++ b/libstdc++-v3/src/functexcept.cc
@@ -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
-- 
GitLab