[libcxx-commits] [libcxx] [libc++][NFC] Replace _LIBCPP_NORETURN with [[noreturn]] (PR #80455)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 2 08:10:00 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
---
Patch is 20.50 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/80455.diff
24 Files Affected:
- (modified) libcxx/include/__config (-2)
- (modified) libcxx/include/__exception/exception_ptr.h (+1-1)
- (modified) libcxx/include/__exception/nested_exception.h (+4-4)
- (modified) libcxx/include/__exception/operations.h (+2-2)
- (modified) libcxx/include/__exception/terminate.h (+1-1)
- (modified) libcxx/include/__filesystem/filesystem_error.h (+2-2)
- (modified) libcxx/include/__format/format_error.h (+1-1)
- (modified) libcxx/include/__format/parser_std_format_spec.h (+2-2)
- (modified) libcxx/include/__functional/function.h (+1-1)
- (modified) libcxx/include/__memory/shared_ptr.h (+1-1)
- (modified) libcxx/include/__system_error/system_error.h (+2-2)
- (modified) libcxx/include/__utility/unreachable.h (+1-1)
- (modified) libcxx/include/__verbose_abort (+1-1)
- (modified) libcxx/include/any (+1-1)
- (modified) libcxx/include/future (+1-1)
- (modified) libcxx/include/ios (+1-1)
- (modified) libcxx/include/new (+2-2)
- (modified) libcxx/include/optional (+1-1)
- (modified) libcxx/include/regex (+1-1)
- (modified) libcxx/include/stdexcept (+9-9)
- (modified) libcxx/include/string (+2-2)
- (modified) libcxx/include/typeinfo (+1-1)
- (modified) libcxx/include/variant (+1-1)
- (modified) libcxx/include/vector (+4-4)
``````````diff
diff --git a/libcxx/include/__config b/libcxx/include/__config
index d356960e9e62b..134e819943498 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -616,7 +616,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp)
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
-# define _LIBCPP_NORETURN [[noreturn]]
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(...) noexcept(__VA_ARGS__)
# define _LIBCPP_CONSTEXPR constexpr
@@ -626,7 +625,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
-# define _LIBCPP_NORETURN __attribute__((__noreturn__))
# define _LIBCPP_HAS_NO_NOEXCEPT
# define nullptr __nullptr
# define _NOEXCEPT throw()
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h
index 53e2f718bc1b3..ae8c39d82a191 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -141,7 +141,7 @@ _LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr);
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
// This is a built-in template function which automagically extracts the required
// information.
diff --git a/libcxx/include/__exception/nested_exception.h b/libcxx/include/__exception/nested_exception.h
index 417db54e6eaac..93135589b12b8 100644
--- a/libcxx/include/__exception/nested_exception.h
+++ b/libcxx/include/__exception/nested_exception.h
@@ -38,7 +38,7 @@ class _LIBCPP_EXPORTED_FROM_ABI nested_exception {
virtual ~nested_exception() _NOEXCEPT;
// access functions
- _LIBCPP_NORETURN void rethrow_nested() const;
+ [[__noreturn__]] void rethrow_nested() const;
_LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; }
};
@@ -53,19 +53,19 @@ struct __throw_with_nested;
template <class _Tp, class _Up>
struct __throw_with_nested<_Tp, _Up, true> {
- _LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) {
+ [[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) {
throw __nested<_Up>(std::forward<_Tp>(__t));
}
};
template <class _Tp, class _Up>
struct __throw_with_nested<_Tp, _Up, false> {
- _LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
+ [[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
};
#endif
template <class _Tp>
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
+[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
using _Up = __decay_t<_Tp>;
static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
diff --git a/libcxx/include/__exception/operations.h b/libcxx/include/__exception/operations.h
index 8f374c0ccee50..872b4477ff228 100644
--- a/libcxx/include/__exception/operations.h
+++ b/libcxx/include/__exception/operations.h
@@ -23,7 +23,7 @@ namespace std { // purposefully not using versioning namespace
using unexpected_handler = void (*)();
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected();
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void unexpected();
#endif
using terminate_handler = void (*)();
@@ -36,7 +36,7 @@ _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
} // namespace std
#endif // _LIBCPP___EXCEPTION_OPERATIONS_H
diff --git a/libcxx/include/__exception/terminate.h b/libcxx/include/__exception/terminate.h
index e672471dc5263..0bfc3506d3791 100644
--- a/libcxx/include/__exception/terminate.h
+++ b/libcxx/include/__exception/terminate.h
@@ -16,7 +16,7 @@
#endif
namespace std { // purposefully not using versioning namespace
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
} // namespace std
#endif // _LIBCPP___EXCEPTION_TERMINATE_H
diff --git a/libcxx/include/__filesystem/filesystem_error.h b/libcxx/include/__filesystem/filesystem_error.h
index bfdcc5eaee521..123ed80113afd 100644
--- a/libcxx/include/__filesystem/filesystem_error.h
+++ b/libcxx/include/__filesystem/filesystem_error.h
@@ -70,13 +70,13 @@ class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesyst
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
__throw_filesystem_error(_Args&&... __args) {
throw filesystem_error(std::forward<_Args>(__args)...);
}
# else
template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
__throw_filesystem_error(_Args&&...) {
_LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
}
diff --git a/libcxx/include/__format/format_error.h b/libcxx/include/__format/format_error.h
index ed40e395d6af7..56ea0988b246f 100644
--- a/libcxx/include/__format/format_error.h
+++ b/libcxx/include/__format/format_error.h
@@ -35,7 +35,7 @@ class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
+[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw format_error(__s);
# else
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index cf8af87b21284..af6814bd8e35e 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -52,13 +52,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace __format_spec {
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void
+[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void
__throw_invalid_option_format_error(const char* __id, const char* __option) {
std::__throw_format_error(
(string("The format specifier for ") + __id + " does not allow the " + __option + " option").c_str());
}
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) {
+[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) {
std::__throw_format_error(
(string("The type option contains an invalid value for ") + __id + " formatting argument").c_str());
}
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 416c26a0c73f2..181d415741a35 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -76,7 +76,7 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception {
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_function_call();
# else
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index e6de615d76fa7..3832f3048f03f 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -122,7 +122,7 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception {
const char* what() const _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_weak_ptr();
#else
diff --git a/libcxx/include/__system_error/system_error.h b/libcxx/include/__system_error/system_error.h
index 362e67505658c..3ffa1029ca5c2 100644
--- a/libcxx/include/__system_error/system_error.h
+++ b/libcxx/include/__system_error/system_error.h
@@ -39,8 +39,8 @@ class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
_LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
};
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
+[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw system_error(__ec, __what_arg);
#else
diff --git a/libcxx/include/__utility/unreachable.h b/libcxx/include/__utility/unreachable.h
index d833f74c2e4f1..5525452aa55ef 100644
--- a/libcxx/include/__utility/unreachable.h
+++ b/libcxx/include/__utility/unreachable.h
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
+[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
_LIBCPP_ASSERT_INTERNAL(false, "std::unreachable() was reached");
__builtin_unreachable();
}
diff --git a/libcxx/include/__verbose_abort b/libcxx/include/__verbose_abort
index 259c70dda8fe8..7c6218f7c6606 100644
--- a/libcxx/include/__verbose_abort
+++ b/libcxx/include/__verbose_abort
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// This function should never be called directly from the code -- it should only be called through
// the _LIBCPP_VERBOSE_ABORT macro.
-_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
+[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
// _LIBCPP_VERBOSE_ABORT(format, args...)
diff --git a/libcxx/include/any b/libcxx/include/any
index 378dfb6e21b53..abd3029fb5ae2 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -129,7 +129,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
+[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_any_cast();
# else
diff --git a/libcxx/include/future b/libcxx/include/future
index 4eeb401c9bbcd..c2d2a6e74e596 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -474,7 +474,7 @@ inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __
return error_condition(static_cast<int>(__e), future_category());
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error {
error_code __ec_;
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 8465860d08dc1..41120b1e0728d 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -436,7 +436,7 @@ public:
~failure() _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw ios_base::failure(__msg);
#else
diff --git a/libcxx/include/new b/libcxx/include/new
index 86fbcb524b66d..f6090c9c36198 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -167,9 +167,9 @@ public:
};
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_array_new_length();
#else
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 73da0a8a5a7c1..1918f94b827a2 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -261,7 +261,7 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
+[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
__throw_bad_optional_access() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_optional_access();
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 48af5b8b57fd6..9e956acc8aa03 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -984,7 +984,7 @@ public:
};
template <regex_constants::error_type _Ev>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw regex_error(_Ev);
#else
diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept
index 3016c130a91b8..8968f726be16b 100644
--- a/libcxx/include/stdexcept
+++ b/libcxx/include/stdexcept
@@ -210,9 +210,9 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
// in the dylib
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
+[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw logic_error(__msg);
#else
@@ -220,7 +220,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const cha
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw domain_error(__msg);
#else
@@ -228,7 +228,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const ch
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw invalid_argument(__msg);
#else
@@ -236,7 +236,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(cons
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw length_error(__msg);
#else
@@ -244,7 +244,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const ch
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw out_of_range(__msg);
#else
@@ -252,7 +252,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const ch
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw range_error(__msg);
#else
@@ -260,7 +260,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const cha
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw overflow_error(__msg);
#else
@@ -268,7 +268,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw underflow_error(__msg);
#else
diff --git a/libcxx/include/string b/libcxx/include/string
index efdff3dd42da0..ab14b86ab900e 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -2109,11 +2109,11 @@ private:
return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
}
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
+ [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
std::__throw_length_error("basic_string");
}
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
+ [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
std::__throw_out_of_range("basic_string");
}
diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo
index 1144b5b12913e..6856e7d9373cd 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -361,7 +361,7 @@ private:
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
+[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_cast();
#else
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 6063739e52c86..c929b519dbf93 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -288,7 +288,7 @@ struct __farray {
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
+[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
__throw_bad_variant_access() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_variant_access();
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 5e2027ea21a39..d085cbd11853a 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -937,9 +937,9 @@ private:
__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
}
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
+ [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
+ [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) {
if (__alloc() != __c.__alloc()) {
@@ -2119,9 +2119,9 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
private:
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() c...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/80455
More information about the libcxx-commits
mailing list