From 14c09a2413ed5cc4914d1690f5dbfb9420a45b3c Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 25 Aug 2016 15:09:01 +0000 Subject: 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 --- include/array | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'include/array') diff --git a/include/array b/include/array index 719286d52..d3f8463cf 100644 --- a/include/array +++ b/include/array @@ -108,9 +108,6 @@ template const T&& get(const array&&) noexce #include #include #include -#if defined(_LIBCPP_NO_EXCEPTIONS) - #include -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -209,11 +206,8 @@ typename array<_Tp, _Size>::reference array<_Tp, _Size>::at(size_type __n) { if (__n >= _Size) -#ifndef _LIBCPP_NO_EXCEPTIONS - throw out_of_range("array::at"); -#else - assert(!"array::at out_of_range"); -#endif + __throw_out_of_range("array::at"); + return __elems_[__n]; } @@ -223,11 +217,7 @@ typename array<_Tp, _Size>::const_reference array<_Tp, _Size>::at(size_type __n) const { if (__n >= _Size) -#ifndef _LIBCPP_NO_EXCEPTIONS - throw out_of_range("array::at"); -#else - assert(!"array::at out_of_range"); -#endif + __throw_out_of_range("array::at"); return __elems_[__n]; } -- cgit v1.2.3