Commit 8eead16e by Benjamin Kosnik Committed by Benjamin Kosnik

user.cfg.in: Regenerate, add files.

2009-11-09  Benjamin Kosnik  <bkoz@redhat.com>

	* doc/doxygen/user.cfg.in: Regenerate, add files.
	* libsupc++/eh_ptr.cc: Format.
	* libsupc++/exception_ptr.h: Same.
	* libsupc++/cxxabi.h(recursive_init_error): Move declaration here.
	* libsupc++/guard.cc: From here.
	* libsupc++/nested_exception.h: Add markup.

From-SVN: r154054
parent 3f08607c
2009-11-09 Benjamin Kosnik <bkoz@redhat.com>
* doc/doxygen/user.cfg.in: Regenerate, add files.
* libsupc++/eh_ptr.cc: Format.
* libsupc++/exception_ptr.h: Same.
* libsupc++/cxxabi.h(recursive_init_error): Move declaration here.
* libsupc++/guard.cc: From here.
* libsupc++/nested_exception.h: Add markup.
2009-11-09 Johannes Singler <singler@kit.edu> 2009-11-09 Johannes Singler <singler@kit.edu>
* include/parallel/multiway_merge.h (multiway_merge_*, * include/parallel/multiway_merge.h (multiway_merge_*,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -100,7 +100,7 @@ namespace __cxxabiv1 ...@@ -100,7 +100,7 @@ namespace __cxxabiv1
void void
__cxa_vec_cleanup(void* __array_address, size_t __element_count, __cxa_vec_cleanup(void* __array_address, size_t __element_count,
size_t __element_size, __cxa_cdtor_type destructor) _GLIBCXX_NOTHROW; size_t __s, __cxa_cdtor_type destructor) _GLIBCXX_NOTHROW;
// Destruct and release array. // Destruct and release array.
void void
...@@ -601,6 +601,27 @@ namespace __cxxabiv1 ...@@ -601,6 +601,27 @@ namespace __cxxabiv1
*/ */
namespace abi = __cxxabiv1; namespace abi = __cxxabiv1;
namespace __gnu_cxx
{
/**
* @brief Exception thrown by __cxa_guard_acquire.
* @ingroup exceptions
*
* 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively)
* while the object is being initialized, the behavior is undefined.
*
* Since we already have a library function to handle locking, we might
* as well check for this situation and throw an exception.
* We use the second byte of the guard variable to remember that we're
* in the middle of an initialization.
*/
class recursive_init_error: public std::exception
{
public:
recursive_init_error() throw() { }
virtual ~recursive_init_error() throw ();
};
}
#endif // __cplusplus #endif // __cplusplus
#pragma GCC visibility pop #pragma GCC visibility pop
......
...@@ -35,41 +35,30 @@ ...@@ -35,41 +35,30 @@
using namespace __cxxabiv1; using namespace __cxxabiv1;
std::__exception_ptr::exception_ptr::exception_ptr() throw() std::__exception_ptr::exception_ptr::exception_ptr() throw()
: _M_exception_object(0) : _M_exception_object(0) { }
{
}
std::__exception_ptr::exception_ptr::exception_ptr(void* obj) throw() std::__exception_ptr::exception_ptr::exception_ptr(void* obj) throw()
: _M_exception_object(obj) : _M_exception_object(obj) { _M_addref(); }
{
_M_addref();
}
std::__exception_ptr::exception_ptr::exception_ptr(__safe_bool) throw() std::__exception_ptr::exception_ptr::exception_ptr(__safe_bool) throw()
: _M_exception_object(0) : _M_exception_object(0) { }
{
}
std::__exception_ptr::exception_ptr::exception_ptr( std::__exception_ptr::
const exception_ptr& other) throw() exception_ptr::exception_ptr(const exception_ptr& other) throw()
: _M_exception_object(other._M_exception_object) : _M_exception_object(other._M_exception_object)
{ { _M_addref(); }
_M_addref();
}
std::__exception_ptr::exception_ptr::~exception_ptr() throw() std::__exception_ptr::exception_ptr::~exception_ptr() throw()
{ { _M_release(); }
_M_release();
}
std::__exception_ptr::exception_ptr& std::__exception_ptr::exception_ptr&
std::__exception_ptr::exception_ptr::operator=( std::__exception_ptr::
const exception_ptr& other) throw() exception_ptr::operator=(const exception_ptr& other) throw()
{ {
exception_ptr(other).swap(*this); exception_ptr(other).swap(*this);
return *this; return *this;
...@@ -109,15 +98,11 @@ std::__exception_ptr::exception_ptr::_M_release() throw() ...@@ -109,15 +98,11 @@ std::__exception_ptr::exception_ptr::_M_release() throw()
void* void*
std::__exception_ptr::exception_ptr::_M_get() const throw() std::__exception_ptr::exception_ptr::_M_get() const throw()
{ { return _M_exception_object; }
return _M_exception_object;
}
void void
std::__exception_ptr::exception_ptr::_M_safe_bool_dummy() throw () std::__exception_ptr::exception_ptr::_M_safe_bool_dummy() throw () { }
{
}
void void
...@@ -132,9 +117,7 @@ std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw() ...@@ -132,9 +117,7 @@ std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw()
// Retained for compatibility with CXXABI_1.3. // Retained for compatibility with CXXABI_1.3.
bool bool
std::__exception_ptr::exception_ptr::operator!() const throw() std::__exception_ptr::exception_ptr::operator!() const throw()
{ { return _M_exception_object == 0; }
return _M_exception_object == 0;
}
// Retained for compatibility with CXXABI_1.3. // Retained for compatibility with CXXABI_1.3.
...@@ -153,17 +136,13 @@ std::__exception_ptr::exception_ptr::__cxa_exception_type() const throw() ...@@ -153,17 +136,13 @@ std::__exception_ptr::exception_ptr::__cxa_exception_type() const throw()
bool std::__exception_ptr::operator==(const exception_ptr& lhs, bool std::__exception_ptr::operator==(const exception_ptr& lhs,
const exception_ptr& rhs) throw() const exception_ptr& rhs) throw()
{ { return lhs._M_exception_object == rhs._M_exception_object; }
return lhs._M_exception_object == rhs._M_exception_object;
}
bool std::__exception_ptr::operator!=(const exception_ptr& lhs, bool std::__exception_ptr::operator!=(const exception_ptr& lhs,
const exception_ptr& rhs) throw() const exception_ptr& rhs) throw()
{ { return !(lhs == rhs);}
return !(lhs == rhs);
}
std::exception_ptr std::exception_ptr
...@@ -185,8 +164,8 @@ std::current_exception() throw() ...@@ -185,8 +164,8 @@ std::current_exception() throw()
static void static void
__gxx_dependent_exception_cleanup (_Unwind_Reason_Code code, __gxx_dependent_exception_cleanup(_Unwind_Reason_Code code,
_Unwind_Exception *exc) _Unwind_Exception *exc)
{ {
// This cleanup is set only for dependents. // This cleanup is set only for dependents.
__cxa_dependent_exception *dep = __get_dependent_exception_from_ue (exc); __cxa_dependent_exception *dep = __get_dependent_exception_from_ue (exc);
...@@ -236,7 +215,7 @@ std::rethrow_exception(std::exception_ptr ep) ...@@ -236,7 +215,7 @@ std::rethrow_exception(std::exception_ptr ep)
// Some sort of unwinding error. Note that terminate is a handler. // Some sort of unwinding error. Note that terminate is a handler.
__cxa_begin_catch (&dep->unwindHeader); __cxa_begin_catch (&dep->unwindHeader);
std::terminate (); std::terminate();
} }
#undef _GLIBCXX_EH_PTR_COMPAT #undef _GLIBCXX_EH_PTR_COMPAT
......
...@@ -48,42 +48,28 @@ namespace std ...@@ -48,42 +48,28 @@ namespace std
* @addtogroup exceptions * @addtogroup exceptions
* @{ * @{
*/ */
// Hide the free operators from other types
namespace __exception_ptr namespace __exception_ptr
{ {
/**
* @brief An opaque pointer to an arbitrary exception.
*/
class exception_ptr; class exception_ptr;
} }
using __exception_ptr::exception_ptr; using __exception_ptr::exception_ptr;
/** Obtain an %exception_ptr to the currently handled exception. If there /** Obtain an exception_ptr to the currently handled exception. If there
* is none, or the currently handled exception is foreign, return the null * is none, or the currently handled exception is foreign, return the null
* value. * value.
*/ */
exception_ptr current_exception() throw(); exception_ptr current_exception() throw();
/// Throw the object pointed to by the %exception_ptr. /// Throw the object pointed to by the exception_ptr.
void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
/// Obtain an %exception_ptr pointing to a copy of the supplied object.
template<typename _Ex>
exception_ptr
copy_exception(_Ex __ex) throw();
namespace __exception_ptr namespace __exception_ptr
{ {
bool /**
operator==(const exception_ptr&, const exception_ptr&) * @brief An opaque pointer to an arbitrary exception.
throw() __attribute__ ((__pure__)); * @ingroup exceptions
*/
bool
operator!=(const exception_ptr&, const exception_ptr&)
throw() __attribute__ ((__pure__));
class exception_ptr class exception_ptr
{ {
void* _M_exception_object; void* _M_exception_object;
...@@ -140,16 +126,24 @@ namespace std ...@@ -140,16 +126,24 @@ namespace std
#endif #endif
friend bool friend bool
operator==(const exception_ptr&, const exception_ptr&) operator==(const exception_ptr&, const exception_ptr&) throw()
throw() __attribute__ ((__pure__)); __attribute__ ((__pure__));
const type_info* const type_info*
__cxa_exception_type() const throw() __attribute__ ((__pure__)); __cxa_exception_type() const throw() __attribute__ ((__pure__));
}; };
bool
operator==(const exception_ptr&, const exception_ptr&) throw()
__attribute__ ((__pure__));
bool
operator!=(const exception_ptr&, const exception_ptr&) throw()
__attribute__ ((__pure__));
} // namespace __exception_ptr } // namespace __exception_ptr
/// Obtain an exception_ptr pointing to a copy of the supplied object.
template<typename _Ex> template<typename _Ex>
exception_ptr exception_ptr
copy_exception(_Ex __ex) throw() copy_exception(_Ex __ex) throw()
......
...@@ -136,20 +136,6 @@ __set_and_release (__cxxabiv1::__guard *g) ...@@ -136,20 +136,6 @@ __set_and_release (__cxxabiv1::__guard *g)
namespace __gnu_cxx namespace __gnu_cxx
{ {
// 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively)
// while the object is being initialized, the behavior is undefined.
// Since we already have a library function to handle locking, we might
// as well check for this situation and throw an exception.
// We use the second byte of the guard variable to remember that we're
// in the middle of an initialization.
class recursive_init_error: public std::exception
{
public:
recursive_init_error() throw() { }
virtual ~recursive_init_error() throw ();
};
recursive_init_error::~recursive_init_error() throw() { } recursive_init_error::~recursive_init_error() throw() { }
} }
......
...@@ -51,9 +51,11 @@ namespace std ...@@ -51,9 +51,11 @@ namespace std
* @{ * @{
*/ */
/// nested_exception /// Exception class with exception_ptr data member.
class nested_exception class nested_exception
{ {
exception_ptr _M_ptr;
public: public:
nested_exception() throw() : _M_ptr(current_exception()) { } nested_exception() throw() : _M_ptr(current_exception()) { }
...@@ -70,16 +72,12 @@ namespace std ...@@ -70,16 +72,12 @@ namespace std
exception_ptr exception_ptr
nested_ptr() const nested_ptr() const
{ return _M_ptr; } { return _M_ptr; }
private:
exception_ptr _M_ptr;
}; };
template<typename _Except> template<typename _Except>
struct _Nested_exception : public _Except, public nested_exception struct _Nested_exception : public _Except, public nested_exception
{ {
explicit explicit _Nested_exception(_Except&& __ex)
_Nested_exception(_Except&& __ex)
: _Except(static_cast<_Except&&>(__ex)) : _Except(static_cast<_Except&&>(__ex))
{ } { }
}; };
...@@ -89,9 +87,7 @@ namespace std ...@@ -89,9 +87,7 @@ namespace std
{ {
static const nested_exception* static const nested_exception*
_S_get(const _Ex& __ex) _S_get(const _Ex& __ex)
{ { return dynamic_cast<const nested_exception*>(&__ex); }
return dynamic_cast<const nested_exception*>(&__ex);
}
}; };
template<typename _Ex> template<typename _Ex>
...@@ -99,17 +95,13 @@ namespace std ...@@ -99,17 +95,13 @@ namespace std
{ {
static const nested_exception* static const nested_exception*
_S_get(const _Ex* __ex) _S_get(const _Ex* __ex)
{ { return dynamic_cast<const nested_exception*>(__ex); }
return dynamic_cast<const nested_exception*>(__ex);
}
}; };
template<typename _Ex> template<typename _Ex>
inline const nested_exception* inline const nested_exception*
__get_nested_exception(const _Ex& __ex) __get_nested_exception(const _Ex& __ex)
{ { return __get_nested_helper<_Ex>::_S_get(__ex); }
return __get_nested_helper<_Ex>::_S_get(__ex);
}
template<typename _Ex> template<typename _Ex>
void void
...@@ -126,21 +118,19 @@ namespace std ...@@ -126,21 +118,19 @@ namespace std
template<typename _Ex> template<typename _Ex>
inline void inline void
__throw_with_nested(_Ex&& __ex, const nested_exception* = 0) __throw_with_nested(_Ex&& __ex, const nested_exception* = 0)
{ { throw __ex; }
throw __ex;
}
template<typename _Ex> template<typename _Ex>
inline void inline void
__throw_with_nested(_Ex&& __ex, ...) __throw_with_nested(_Ex&& __ex, ...)
{ { throw _Nested_exception<_Ex>(static_cast<_Ex&&>(__ex)); }
throw _Nested_exception<_Ex>(static_cast<_Ex&&>(__ex));
}
template<typename _Ex> template<typename _Ex>
void void
throw_with_nested(_Ex __ex) __attribute__ ((__noreturn__)); throw_with_nested(_Ex __ex) __attribute__ ((__noreturn__));
/// If @p __ex is derived from nested_exception, @p __ex.
/// Else, an implementation-defined object derived from both.
template<typename _Ex> template<typename _Ex>
inline void inline void
throw_with_nested(_Ex __ex) throw_with_nested(_Ex __ex)
...@@ -150,6 +140,7 @@ namespace std ...@@ -150,6 +140,7 @@ namespace std
__throw_with_nested(static_cast<_Ex&&>(__ex), &__ex); __throw_with_nested(static_cast<_Ex&&>(__ex), &__ex);
} }
/// If @p __ex is derived from nested_exception, @p __ex.rethrow_nested().
template<typename _Ex> template<typename _Ex>
inline void inline void
rethrow_if_nested(const _Ex& __ex) rethrow_if_nested(const _Ex& __ex)
...@@ -158,12 +149,10 @@ namespace std ...@@ -158,12 +149,10 @@ namespace std
__nested->rethrow_nested(); __nested->rethrow_nested();
} }
// see n2619 /// Overload, See N2619
inline void inline void
rethrow_if_nested(const nested_exception& __ex) rethrow_if_nested(const nested_exception& __ex)
{ { __ex.rethrow_nested(); }
__ex.rethrow_nested();
}
// @} group exceptions // @} group exceptions
} // namespace std } // namespace std
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment