Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -679,10 +679,8 @@ template<class _Rp>
|
||||
_Rp
|
||||
function<_Rp()>::operator()() const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__f_ == 0)
|
||||
throw bad_function_call();
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__throw_bad_function_call();
|
||||
return (*__f_)();
|
||||
}
|
||||
|
||||
@@ -955,10 +953,8 @@ template<class _Rp, class _A0>
|
||||
_Rp
|
||||
function<_Rp(_A0)>::operator()(_A0 __a0) const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__f_ == 0)
|
||||
throw bad_function_call();
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__throw_bad_function_call();
|
||||
return (*__f_)(__a0);
|
||||
}
|
||||
|
||||
@@ -1231,10 +1227,8 @@ template<class _Rp, class _A0, class _A1>
|
||||
_Rp
|
||||
function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__f_ == 0)
|
||||
throw bad_function_call();
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__throw_bad_function_call();
|
||||
return (*__f_)(__a0, __a1);
|
||||
}
|
||||
|
||||
@@ -1507,10 +1501,8 @@ template<class _Rp, class _A0, class _A1, class _A2>
|
||||
_Rp
|
||||
function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__f_ == 0)
|
||||
throw bad_function_call();
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__throw_bad_function_call();
|
||||
return (*__f_)(__a0, __a1, __a2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user