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

Aditya Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 04:28:16 PDT 2016


hiraditya updated this revision to Diff 69222.
hiraditya marked 2 inline comments as done.
hiraditya added a comment.

Added inline


https://reviews.llvm.org/D21232

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

Index: include/vector
===================================================================
--- include/vector
+++ 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: include/system_error
===================================================================
--- include/system_error
+++ 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: include/regex
===================================================================
--- include/regex
+++ include/regex
@@ -959,7 +959,7 @@
 };
 
 template <regex_constants::error_type _Ev>
-_LIBCPP_ALWAYS_INLINE
+_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
 void __throw_regex_error()
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
Index: include/future
===================================================================
--- include/future
+++ include/future
@@ -512,7 +512,7 @@
     virtual ~future_error() _NOEXCEPT;
 };
 
-inline _LIBCPP_ALWAYS_INLINE
+_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
 void __throw_future_error(future_errc _Ev)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
Index: include/deque
===================================================================
--- include/deque
+++ 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: include/__locale
===================================================================
--- include/__locale
+++ 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.69222.patch
Type: text/x-patch
Size: 2473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160825/213fc591/attachment.bin>


More information about the llvm-commits mailing list