summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-07 13:20:33 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-07 13:20:33 +0000
commit1590c7d45349b3e5bb4449c740c83172f490ee74 (patch)
tree5e8df8f8120799af6eda74296cbb619955ece69b /libstdc++-v3/include
parent7b41dbcfc942727a9155c632d58fa608101b042f (diff)
downloadgcc-1590c7d45349b3e5bb4449c740c83172f490ee74.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/c++config11
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h8
-rw-r--r--libstdc++-v3/include/debug/array16
-rw-r--r--libstdc++-v3/include/ext/concurrence.h32
-rw-r--r--libstdc++-v3/include/ext/pb_ds/exception.hpp37
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h9
-rw-r--r--libstdc++-v3/include/tr1/functional11
-rw-r--r--libstdc++-v3/include/tr1/shared_ptr.h11
8 files changed, 31 insertions, 104 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 60b6f126b83..aba931b08cc 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -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
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index e48a8fb9ced..ead37284aa1 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -73,13 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 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;
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index 1cde4e216d0..21b596b8f19 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -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 @@ namespace __debug
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 @@ namespace __debug
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 @@ namespace __debug
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 __debug
};
} // namespace std
-#undef _GLIBCXX_THROW_OR_ABORT
-
#endif // _GLIBCXX_DEBUG_ARRAY
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h
index 68c679c6b06..50b73290949 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -99,44 +99,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 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();
-#endif
- }
+ { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); }
#endif
class __mutex
diff --git a/libstdc++-v3/include/ext/pb_ds/exception.hpp b/libstdc++-v3/include/ext/pb_ds/exception.hpp
index 5213fa43aa9..9768ab343db 100644
--- a/libstdc++-v3/include/ext/pb_ds/exception.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/exception.hpp
@@ -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 @@ namespace __gnu_pbds
/// 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
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 8942232c825..0dbd3512b35 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -77,14 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 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
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index ff2bd2a7134..d9b7a842bcd 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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...);
}
diff --git a/libstdc++-v3/include/tr1/shared_ptr.h b/libstdc++-v3/include/tr1/shared_ptr.h
index 5a1eb038a38..8f9870deb59 100644
--- a/libstdc++-v3/include/tr1/shared_ptr.h
+++ b/libstdc++-v3/include/tr1/shared_ptr.h
@@ -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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 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;