Index: libcxx/include/__config =================================================================== --- libcxx/include/__config +++ libcxx/include/__config @@ -302,6 +302,12 @@ #define _LIBCPP_NO_EXCEPTIONS #endif +#if defined _LIBCPP_NO_EXCEPTIONS +#define _LIBCPP_ATTR_NORETURN +#else +#define _LIBCPP_ATTR_NORETURN __attribute__((__noreturn__)) +#endif + #if !(__has_feature(cxx_rtti)) #define _LIBCPP_NO_RTTI #endif Index: libcxx/include/__locale =================================================================== --- libcxx/include/__locale +++ libcxx/include/__locale @@ -1184,7 +1184,7 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname) _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname) -_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*); +_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*) _LIBCPP_ATTR_NORETURN; template struct __narrow_to_utf8 Index: libcxx/include/deque =================================================================== --- libcxx/include/deque +++ libcxx/include/deque @@ -895,8 +895,8 @@ class __deque_base_common { protected: - void __throw_length_error() const; - void __throw_out_of_range() const; + void __throw_length_error() const _LIBCPP_ATTR_NORETURN; + void __throw_out_of_range() const _LIBCPP_ATTR_NORETURN; }; template Index: libcxx/include/future =================================================================== --- libcxx/include/future +++ libcxx/include/future @@ -513,7 +513,7 @@ }; inline _LIBCPP_ALWAYS_INLINE -void __throw_future_error(future_errc _Ev) +void __throw_future_error(future_errc _Ev) _LIBCPP_ATTR_NORETURN { #ifndef _LIBCPP_NO_EXCEPTIONS throw future_error(make_error_code(_Ev)); Index: libcxx/include/regex =================================================================== --- libcxx/include/regex +++ libcxx/include/regex @@ -958,7 +958,7 @@ template _LIBCPP_ALWAYS_INLINE -void __throw_regex_error() +void __throw_regex_error() _LIBCPP_ATTR_NORETURN { #ifndef _LIBCPP_NO_EXCEPTIONS throw regex_error(_Ev); Index: libcxx/include/system_error =================================================================== --- libcxx/include/system_error +++ libcxx/include/system_error @@ -635,7 +635,9 @@ static string __init(const error_code&, string); }; -_LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg); +_LIBCPP_FUNC_VIS +void __throw_system_error(int ev, + const char* what_arg) _LIBCPP_ATTR_NORETURN; _LIBCPP_END_NAMESPACE_STD Index: libcxx/include/vector =================================================================== --- libcxx/include/vector +++ libcxx/include/vector @@ -290,8 +290,8 @@ { protected: _LIBCPP_ALWAYS_INLINE __vector_base_common() {} - void __throw_length_error() const; - void __throw_out_of_range() const; + void __throw_length_error() const _LIBCPP_ATTR_NORETURN; + void __throw_out_of_range() const _LIBCPP_ATTR_NORETURN; }; template