[PATCH] D21232: Add attribute noreturn to functions that throw

Aditya Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 14:20:53 PDT 2016


hiraditya updated this revision to Diff 69171.
hiraditya added a comment.

Added _LIBCPP_NORETURN in the beginning of the declaration.


https://reviews.llvm.org/D21232

Files:
  libcxx/include/__locale
  libcxx/include/deque
  libcxx/include/future
  libcxx/include/regex
  libcxx/include/system_error
  libcxx/include/vector

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;
+    _LIBCPP_NORETURN void __throw_length_error() const;
+    _LIBCPP_NORETURN void __throw_out_of_range() const;
 };
 
 template <bool __b>
Index: libcxx/include/system_error
===================================================================
--- libcxx/include/system_error
+++ libcxx/include/system_error
@@ -635,7 +635,8 @@
     static string __init(const error_code&, string);
 };
 
-_LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg);
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
+void __throw_system_error(int ev, const char* what_arg);
 
 _LIBCPP_END_NAMESPACE_STD
 
Index: libcxx/include/regex
===================================================================
--- libcxx/include/regex
+++ libcxx/include/regex
@@ -959,6 +959,7 @@
 };
 
 template <regex_constants::error_type _Ev>
+_LIBCPP_NORETURN
 _LIBCPP_ALWAYS_INLINE
 void __throw_regex_error()
 {
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)
+_LIBCPP_NORETURN void __throw_future_error(future_errc _Ev)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw future_error(make_error_code(_Ev));
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;
+    _LIBCPP_NORETURN void __throw_length_error() const;
+    _LIBCPP_NORETURN void __throw_out_of_range() const;
 };
 
 template <bool __b>
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -1184,7 +1184,7 @@
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
 
-_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
 
 template <size_t _Np>
 struct __narrow_to_utf8


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21232.69171.patch
Type: text/x-patch
Size: 2560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160824/60dda9ee/attachment.bin>


More information about the llvm-commits mailing list