Patchwork [v3] Add _GLIBCXX_THROW_OR_ABORT

login
register
mail settings
Submitter Paolo Carlini
Date Nov. 7, 2012, 10:12 a.m.
Message ID <509A33F7.6090804@oracle.com>
Download mbox | patch
Permalink /patch/197645/
State New
Headers show

Comments

Paolo Carlini - Nov. 7, 2012, 10:12 a.m.
Hi,

instead of writing again and again the same conditional, I'm finishing 
testing the below, will install soon if everything goes well.

Thanks,
Paolo.

////////////////////
2012-11-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/debug/array (_GLIBCXX_THROW_OR_ABORT): Move...
	* include/bits/c++config: ... here.
	* include/bits/shared_ptr_base.h (__throw_bad_weak_ptr): Use it.
	* include/ext/pb_ds/exception.hpp: Likewise.
	* include/ext/throw_allocator.h (__throw_forced_error): Likewise.
	* include/ext/concurrence.h (__throw_concurrence_lock_error,
	__throw_concurrence_unlock_error, __throw_concurrence_broadcast_error,
	__throw_concurrence_wait_error): Likewise.
	* include/tr1/shared_ptr.h (__throw_bad_weak_ptr): Likewise.
	* include/tr1/functional (function<_Res(_ArgTypes...)>::operator()
	(_ArgTypes...)): Likewise.
	* libsupc++/eh_aux_runtime.cc (__cxxabiv1::__cxa_bad_cast,
	__cxxabiv1::__cxa_bad_typeid): Likewise.
	* libsupc++/vec.cc (compute_size): Likewise.
	* libsupc++/new_op.cc (operator new (std::size_t)): Likewise.
	* src/c++11/functexcept.cc: Likewise.
	* testsuite/util/io/illegal_input_error.hpp
	(__throw_illegal_input_error): Likewise.
	* libsupc++/eh_personality.cc: Avoid warning with -fno-exceptions.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
	numbers.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Likewise.
	* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Likewise.
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.

Patch

Index: include/bits/c++config
===================================================================
--- include/bits/c++config	(revision 193278)
+++ include/bits/c++config	(working copy)
@@ -1,7 +1,6 @@ 
 // Predefined symbols and macros -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+// Copyright (C) 1997-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -115,6 +114,14 @@ 
 # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
 #endif
 
+#ifndef _GLIBCXX_THROW_OR_ABORT
+# if __EXCEPTIONS
+#  define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
+# else
+#  define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())
+# endif
+#endif
+
 // Macro for extern template, ie controling template linkage via use
 // of extern keyword on template declaration. As documented in the g++
 // manual, it inhibits all implicit instantiations and is used
Index: include/bits/shared_ptr_base.h
===================================================================
--- include/bits/shared_ptr_base.h	(revision 193278)
+++ include/bits/shared_ptr_base.h	(working copy)
@@ -73,13 +73,7 @@ 
   // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
   inline void
   __throw_bad_weak_ptr()
-  {
-#if __EXCEPTIONS
-    throw bad_weak_ptr();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); }
 
   using __gnu_cxx::_Lock_policy;
   using __gnu_cxx::__default_lock_policy;
Index: include/debug/array
===================================================================
--- include/debug/array	(revision 193278)
+++ include/debug/array	(working copy)
@@ -33,14 +33,6 @@ 
 
 #include <debug/safe_sequence.h>
 
-#ifndef _GLIBCXX_THROW_OR_ABORT
-# if __EXCEPTIONS
-#  define _GLIBCXX_THROW_OR_ABORT(_Exc) (throw (_Exc))
-# else
-#  define _GLIBCXX_THROW_OR_ABORT(_Exc) (__builtin_abort())
-# endif
-#endif
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 namespace __debug
@@ -165,7 +157,7 @@ 
       operator[](size_type __n) const noexcept
       {
 	return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
-	 : (_GLIBCXX_THROW_OR_ABORT (_Array_check_subscript<_Nm>(__n)),
+	 : (_GLIBCXX_THROW_OR_ABORT(_Array_check_subscript<_Nm>(__n)),
 	    _AT_Type::_S_ref(_M_elems, 0));
       }
 
@@ -198,7 +190,7 @@ 
       front() const
       {
 	return _Nm ? _AT_Type::_S_ref(_M_elems, 0)
-	  : (_GLIBCXX_THROW_OR_ABORT (_Array_check_nonempty<_Nm>()),
+	  : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()),
 	     _AT_Type::_S_ref(_M_elems, 0));
       }
 
@@ -213,7 +205,7 @@ 
       back() const
       {
 	return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
-	  : (_GLIBCXX_THROW_OR_ABORT (_Array_check_nonempty<_Nm>()),
+	  : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()),
 	     _AT_Type::_S_ref(_M_elems, 0));
       }
 
@@ -316,6 +308,4 @@ 
     };
 } // namespace std
 
-#undef _GLIBCXX_THROW_OR_ABORT
-
 #endif // _GLIBCXX_DEBUG_ARRAY
Index: include/ext/pb_ds/exception.hpp
===================================================================
--- include/ext/pb_ds/exception.hpp	(revision 193278)
+++ include/ext/pb_ds/exception.hpp	(working copy)
@@ -1,7 +1,6 @@ 
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2005-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -73,39 +72,21 @@ 
   /// A container cannot be resized.
   struct resize_error : public container_error { };
 
-#if __EXCEPTIONS
   inline void
-  __throw_container_error(void)
-  { throw container_error(); }
+  __throw_container_error()
+  { _GLIBCXX_THROW_OR_ABORT(container_error()); }
 
   inline void
-  __throw_insert_error(void)
-  { throw insert_error(); }
+  __throw_insert_error()
+  { _GLIBCXX_THROW_OR_ABORT(insert_error()); }
 
   inline void
-  __throw_join_error(void)
-  { throw join_error(); }
+  __throw_join_error()
+  { _GLIBCXX_THROW_OR_ABORT(join_error()); }
 
   inline void
-  __throw_resize_error(void)
-  { throw resize_error(); }
-#else
-  inline void
-  __throw_container_error(void)
-  { std::abort(); }
-
-  inline void
-  __throw_insert_error(void)
-  { std::abort(); }
-
-  inline void
-  __throw_join_error(void)
-  { std::abort(); }
-
-  inline void
-  __throw_resize_error(void)
-  { std::abort(); }
-#endif
+  __throw_resize_error()
+  { _GLIBCXX_THROW_OR_ABORT(resize_error()); }
   //@}
 } // namespace __gnu_pbds
 
Index: include/ext/throw_allocator.h
===================================================================
--- include/ext/throw_allocator.h	(revision 193278)
+++ include/ext/throw_allocator.h	(working copy)
@@ -77,15 +77,8 @@ 
   // Substitute for forced_error object when -fno-exceptions.
   inline void
   __throw_forced_error()
-  {
-#if __EXCEPTIONS
-    throw forced_error();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(forced_error()); }
 
-
   /**
    *  @brief Base class for checking address and label information
    *  about allocations. Create a std::map between the allocated
Index: include/ext/concurrence.h
===================================================================
--- include/ext/concurrence.h	(revision 193278)
+++ include/ext/concurrence.h	(working copy)
@@ -99,45 +99,21 @@ 
   // Substitute for concurrence_error object in the case of -fno-exceptions.
   inline void
   __throw_concurrence_lock_error()
-  {
-#if __EXCEPTIONS
-    throw __concurrence_lock_error();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(__concurrence_lock_error()); }
 
   inline void
   __throw_concurrence_unlock_error()
-  {
-#if __EXCEPTIONS
-    throw __concurrence_unlock_error();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(__concurrence_unlock_error()); }
 
 #ifdef __GTHREAD_HAS_COND
   inline void
   __throw_concurrence_broadcast_error()
-  {
-#if __EXCEPTIONS
-    throw __concurrence_broadcast_error();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(__concurrence_broadcast_error()); }
 
   inline void
   __throw_concurrence_wait_error()
-  {
-#if __EXCEPTIONS
-    throw __concurrence_wait_error();
-#else
-    __builtin_abort();
+  { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); }
 #endif
-  }
-#endif
  
   class __mutex 
   {
Index: include/tr1/shared_ptr.h
===================================================================
--- include/tr1/shared_ptr.h	(revision 193278)
+++ include/tr1/shared_ptr.h	(working copy)
@@ -1,7 +1,6 @@ 
 // <tr1/shared_ptr.h> -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
-// Free Software Foundation, Inc.
+// Copyright (C) 2007-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -71,13 +70,7 @@ 
   // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
   inline void
   __throw_bad_weak_ptr()
-  {
-#if __EXCEPTIONS
-    throw bad_weak_ptr();
-#else
-    __builtin_abort();
-#endif
-  }
+  { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); }
 
   using __gnu_cxx::_Lock_policy;
   using __gnu_cxx::__default_lock_policy;
Index: include/tr1/functional
===================================================================
--- include/tr1/functional	(revision 193278)
+++ include/tr1/functional	(working copy)
@@ -1,7 +1,6 @@ 
 // TR1 functional header -*- C++ -*-
 
-// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2004-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -2144,13 +2143,7 @@ 
     operator()(_ArgTypes... __args) const
     {
       if (_M_empty())
-        {
-#if __EXCEPTIONS
-          throw bad_function_call();
-#else
-          __builtin_abort();
-#endif
-        }
+	_GLIBCXX_THROW_OR_ABORT(bad_function_call());
       return _M_invoker(_M_functor, __args...);
     }
 
Index: libsupc++/eh_aux_runtime.cc
===================================================================
--- libsupc++/eh_aux_runtime.cc	(revision 193278)
+++ libsupc++/eh_aux_runtime.cc	(working copy)
@@ -1,6 +1,5 @@ 
 // -*- C++ -*- Common throw conditions.
-// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2009, 2011
-// Free Software Foundation
+// Copyright (C) 1994-2012 Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -31,21 +30,9 @@ 
 
 extern "C" void
 __cxxabiv1::__cxa_bad_cast ()
-{
-#ifdef __EXCEPTIONS  
-  throw std::bad_cast();
-#else
-  std::abort();
-#endif
-}
+{ _GLIBCXX_THROW_OR_ABORT(std::bad_cast()); }
 
 extern "C" void
 __cxxabiv1::__cxa_bad_typeid ()
-{
-#ifdef __EXCEPTIONS  
-  throw std::bad_typeid();
-#else
-  std::abort();
-#endif
-}
+{ _GLIBCXX_THROW_OR_ABORT(std::bad_typeid()); }
 
Index: libsupc++/vec.cc
===================================================================
--- libsupc++/vec.cc	(revision 193278)
+++ libsupc++/vec.cc	(working copy)
@@ -28,7 +28,6 @@ 
 #include <cxxabi.h>
 #include <new>
 #include <exception>
-#include <cstdlib>
 #include <bits/exception_defines.h>
 #include "unwind-cxx.h"
 
@@ -66,18 +65,10 @@ 
 			     std::size_t padding_size)
     {
       if (element_size && element_count > std::size_t(-1) / element_size)
-#ifdef __EXCEPTIONS
-	throw std::bad_alloc();
-#else
-        std::abort();
-#endif
+	_GLIBCXX_THROW_OR_ABORT(std::bad_alloc());
       std::size_t size = element_count * element_size;
       if (size + padding_size < size)
-#ifdef __EXCEPTIONS
-	throw std::bad_alloc();
-#else
-        std::abort();
-#endif
+	_GLIBCXX_THROW_OR_ABORT(std::bad_alloc());
       return size + padding_size;
     }
   }
Index: libsupc++/eh_personality.cc
===================================================================
--- libsupc++/eh_personality.cc	(revision 193278)
+++ libsupc++/eh_personality.cc	(working copy)
@@ -768,7 +768,7 @@ 
       if (check_exception_spec (&info, __get_exception_header_from_obj
                                   (new_ptr)->exceptionType,
 				new_ptr, xh_switch_value))
-	__throw_exception_again;
+	{ __throw_exception_again; }
 
       // If the exception spec allows std::bad_exception, throw that.
       // We don't have a thrown object to compare against, but since
Index: libsupc++/new_op.cc
===================================================================
--- libsupc++/new_op.cc	(revision 193278)
+++ libsupc++/new_op.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Support routines for the -*- C++ -*- dynamic memory management.
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2009, 2011
-// Free Software Foundation
+// Copyright (C) 1997-2012 Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -54,11 +53,7 @@ 
     {
       new_handler handler = __new_handler;
       if (! handler)
-#ifdef __EXCEPTIONS
-	throw bad_alloc();
-#else
-        std::abort();
-#endif
+	_GLIBCXX_THROW_OR_ABORT(bad_alloc());
       handler ();
       p = (void *) malloc (sz);
     }
Index: testsuite/ext/profile/mutex_extensions_neg.cc
===================================================================
--- testsuite/ext/profile/mutex_extensions_neg.cc	(revision 193278)
+++ testsuite/ext/profile/mutex_extensions_neg.cc	(working copy)
@@ -6,7 +6,7 @@ 
 // Otherwise we may get *multiple* errors.
 #undef _GLIBCXX_PARALLEL
 
-// Copyright (C) 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2006-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -25,4 +25,4 @@ 
 
 #include <vector>
 
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 262 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 269 }
Index: testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc
===================================================================
--- testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc	(revision 193278)
+++ testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc	(working copy)
@@ -1,6 +1,6 @@ 
 // { dg-do compile }
 
-// Copyright (C) 2010, 2012 Free Software Foundation
+// Copyright (C) 2010-2012 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -30,9 +30,8 @@ 
 {
   X* px = 0;
   std::tr1::shared_ptr<X> p1(px);   // { dg-error "here" }
-  // { dg-error "incomplete" "" { target *-*-* } 563 }
+  // { dg-error "incomplete" "" { target *-*-* } 556 }
 
   std::tr1::shared_ptr<X> p9(ap());  // { dg-error "here" }
-  // { dg-error "incomplete" "" { target *-*-* } 602 }
-
+  // { dg-error "incomplete" "" { target *-*-* } 595 }
 }
Index: testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
===================================================================
--- testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc	(revision 193278)
+++ testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc	(working copy)
@@ -23,4 +23,4 @@ 
 
 typedef std::tuple_element<1, std::array<int, 1>>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 314 }
+// { dg-error "static assertion failed" "" { target *-*-* } 306 }
Index: testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
===================================================================
--- testsuite/23_containers/array/tuple_interface/get_debug_neg.cc	(revision 193278)
+++ testsuite/23_containers/array/tuple_interface/get_debug_neg.cc	(working copy)
@@ -28,6 +28,6 @@ 
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 274 }
+// { dg-error "static assertion failed" "" { target *-*-* } 266 }
+// { dg-error "static assertion failed" "" { target *-*-* } 275 }
 // { dg-error "static assertion failed" "" { target *-*-* } 283 }
-// { dg-error "static assertion failed" "" { target *-*-* } 291 }
Index: testsuite/util/io/illegal_input_error.hpp
===================================================================
--- testsuite/util/io/illegal_input_error.hpp	(revision 193278)
+++ testsuite/util/io/illegal_input_error.hpp	(working copy)
@@ -1,6 +1,6 @@ 
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -17,7 +17,6 @@ 
 // along with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-
 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
 
 // Permission to use, copy, modify, sell, and distribute this software
@@ -49,13 +48,7 @@ 
     // Substitute for concurrence_error object in the case of -fno-exceptions.
     inline void
     __throw_illegal_input_error()
-    {
-#if __EXCEPTIONS
-      throw illegal_input_error();
-#else
-      __builtin_abort();
-#endif
-    }
+    { _GLIBCXX_THROW_OR_ABORT(illegal_input_error()); }
   } // namespace test
 } // namespace __gnu_pbds
 
Index: testsuite/20_util/shared_ptr/cons/43820_neg.cc
===================================================================
--- testsuite/20_util/shared_ptr/cons/43820_neg.cc	(revision 193278)
+++ testsuite/20_util/shared_ptr/cons/43820_neg.cc	(working copy)
@@ -32,9 +32,8 @@ 
 {
   X* px = 0;
   std::shared_ptr<X> p1(px);   // { dg-error "here" }
-  // { dg-error "incomplete" "" { target *-*-* } 775 }
+  // { dg-error "incomplete" "" { target *-*-* } 769 }
 
   std::shared_ptr<X> p9(ap());  // { dg-error "here" }
   // { dg-error "incomplete" "" { target *-*-* } 307 }
-
 }
Index: src/c++11/functexcept.cc
===================================================================
--- src/c++11/functexcept.cc	(revision 193278)
+++ src/c++11/functexcept.cc	(working copy)
@@ -1,5 +1,4 @@ 
-// Copyright (C) 2001, 2002, 2003, 2005, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2001-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -44,151 +43,79 @@ 
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if __EXCEPTIONS
   void
-  __throw_bad_exception(void)
-  { throw bad_exception(); }
+  __throw_bad_exception()
+  { _GLIBCXX_THROW_OR_ABORT(bad_exception()); }
 
   void
-  __throw_bad_alloc(void)
-  { throw bad_alloc(); }
+  __throw_bad_alloc()
+  { _GLIBCXX_THROW_OR_ABORT(bad_alloc()); }
 
   void
-  __throw_bad_cast(void)
-  { throw bad_cast(); }
+  __throw_bad_cast()
+  { _GLIBCXX_THROW_OR_ABORT(bad_cast()); }
 
   void
-  __throw_bad_typeid(void)
-  { throw bad_typeid(); }
+  __throw_bad_typeid()
+  { _GLIBCXX_THROW_OR_ABORT(bad_typeid()); }
 
   void
-  __throw_logic_error(const char* __s)
-  { throw logic_error(_(__s)); }
+  __throw_logic_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(logic_error(_(__s))); }
 
   void
-  __throw_domain_error(const char* __s)
-  { throw domain_error(_(__s)); }
+  __throw_domain_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(domain_error(_(__s))); }
 
   void
-  __throw_invalid_argument(const char* __s)
-  { throw invalid_argument(_(__s)); }
+  __throw_invalid_argument(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(invalid_argument(_(__s))); }
 
   void
-  __throw_length_error(const char* __s)
-  { throw length_error(_(__s)); }
+  __throw_length_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(length_error(_(__s))); }
 
   void
-  __throw_out_of_range(const char* __s)
-  { throw out_of_range(_(__s)); }
+  __throw_out_of_range(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(out_of_range(_(__s))); }
 
   void
-  __throw_runtime_error(const char* __s)
-  { throw runtime_error(_(__s)); }
+  __throw_runtime_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(runtime_error(_(__s))); }
 
   void
-  __throw_range_error(const char* __s)
-  { throw range_error(_(__s)); }
+  __throw_range_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(range_error(_(__s))); }
 
   void
-  __throw_overflow_error(const char* __s)
-  { throw overflow_error(_(__s)); }
+  __throw_overflow_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(overflow_error(_(__s))); }
 
   void
-  __throw_underflow_error(const char* __s)
-  { throw underflow_error(_(__s)); }
+  __throw_underflow_error(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(underflow_error(_(__s))); }
 
   void
-  __throw_ios_failure(const char* __s)
-  { throw ios_base::failure(_(__s)); }
+  __throw_ios_failure(const char* __s __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); }
 
   void
-  __throw_system_error(int __i)
-  { throw system_error(error_code(__i, generic_category())); }
+  __throw_system_error(int __i __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(system_error(error_code(__i,
+						    generic_category()))); }
 
   void
-  __throw_future_error(int __i)
-  { throw future_error(make_error_code(future_errc(__i))); }
+  __throw_future_error(int __i __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(future_error(make_error_code(future_errc(__i)))); }
 
   void
   __throw_bad_function_call()
-  { throw bad_function_call(); }
+  { _GLIBCXX_THROW_OR_ABORT(bad_function_call()); }
 
   void
-  __throw_regex_error(regex_constants::error_type __ecode)
-  { throw regex_error(__ecode); }
-#else
-  void
-  __throw_bad_exception(void)
-  { std::abort(); }
+  __throw_regex_error(regex_constants::error_type __ecode
+		      __attribute__((unused)))
+  { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode)); }
 
-  void
-  __throw_bad_alloc(void)
-  { std::abort(); }
-
-  void
-  __throw_bad_cast(void)
-  { std::abort(); }
-
-  void
-  __throw_bad_typeid(void)
-  { std::abort(); }
-
-  void
-  __throw_logic_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_domain_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_invalid_argument(const char*)
-  { std::abort(); }
-
-  void
-  __throw_length_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_out_of_range(const char*)
-  { std::abort(); }
-
-  void
-  __throw_runtime_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_range_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_overflow_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_underflow_error(const char*)
-  { std::abort(); }
-
-  void
-  __throw_ios_failure(const char*)
-  { std::abort(); }
-
-  void
-  __throw_system_error(int)
-  { std::abort(); }
-
-  void
-  __throw_future_error(int)
-  { std::abort(); }
-
-  void
-  __throw_bad_function_call()
-  { std::abort(); }
-
-  void
-  __throw_regex_error(regex_constants::error_type __ecode)
-  { std::abort(); }
-#endif //__EXCEPTIONS
-
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace