Skip to content

Commit 748023d

Browse files
authored
[libc++][NFC] Replace _LIBCPP_NORETURN and TEST_NORETURN with [[noreturn]] (#80455)
`[[__noreturn__]]` is now always available, so we can simply use the attribute directly instead of through a macro.
1 parent cd0e867 commit 748023d

39 files changed

+69
-79
lines changed

libcxx/.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ AttributeMacros: [
4444
'_LIBCPP_NO_UNIQUE_ADDRESS',
4545
'_LIBCPP_NOALIAS',
4646
'_LIBCPP_NODISCARD',
47-
'_LIBCPP_NORETURN',
4847
'_LIBCPP_OVERRIDABLE_FUNC_VIS',
4948
'_LIBCPP_STANDALONE_DEBUG',
5049
'_LIBCPP_TEMPLATE_DATA_VIS',

libcxx/include/__chrono/exception.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class nonexistent_local_time : public runtime_error {
7171
};
7272

7373
template <class _Duration>
74-
_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
74+
[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
7575
[[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
7676
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
7777
throw nonexistent_local_time(__time, __info);
@@ -115,7 +115,7 @@ class ambiguous_local_time : public runtime_error {
115115
};
116116

117117
template <class _Duration>
118-
_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
118+
[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
119119
[[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
120120
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
121121
throw ambiguous_local_time(__time, __info);

libcxx/include/__config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
312312
# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp)
313313
# define _ALIGNAS_TYPE(x) alignas(x)
314314
# define _ALIGNAS(x) alignas(x)
315-
# define _LIBCPP_NORETURN [[noreturn]]
316315
# define _NOEXCEPT noexcept
317316
# define _NOEXCEPT_(...) noexcept(__VA_ARGS__)
318317
# define _LIBCPP_CONSTEXPR constexpr
@@ -322,7 +321,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
322321
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
323322
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
324323
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
325-
# define _LIBCPP_NORETURN __attribute__((__noreturn__))
326324
# define _LIBCPP_HAS_NO_NOEXCEPT
327325
# define nullptr __nullptr
328326
# define _NOEXCEPT throw()

libcxx/include/__exception/exception_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ _LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
159159

160160
_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr);
161161
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
162-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
162+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
163163

164164
// This is a built-in template function which automagically extracts the required
165165
// information.

libcxx/include/__exception/nested_exception.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class _LIBCPP_EXPORTED_FROM_ABI nested_exception {
4040
virtual ~nested_exception() _NOEXCEPT;
4141

4242
// access functions
43-
_LIBCPP_NORETURN void rethrow_nested() const;
43+
[[__noreturn__]] void rethrow_nested() const;
4444
_LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; }
4545
};
4646

@@ -55,19 +55,19 @@ struct __throw_with_nested;
5555

5656
template <class _Tp, class _Up>
5757
struct __throw_with_nested<_Tp, _Up, true> {
58-
_LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) {
58+
[[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) {
5959
throw __nested<_Up>(std::forward<_Tp>(__t));
6060
}
6161
};
6262

6363
template <class _Tp, class _Up>
6464
struct __throw_with_nested<_Tp, _Up, false> {
65-
_LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
65+
[[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
6666
};
6767
#endif
6868

6969
template <class _Tp>
70-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
70+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
7171
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
7272
using _Up = __decay_t<_Tp>;
7373
static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");

libcxx/include/__exception/operations.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace std { // purposefully not using versioning namespace
2222
using unexpected_handler = void (*)();
2323
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
2424
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
25-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected();
25+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void unexpected();
2626
#endif
2727

2828
using terminate_handler = void (*)();
@@ -37,7 +37,7 @@ _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
3737
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
3838

3939
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
40-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
40+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
4141
} // namespace std
4242

4343
#endif // _LIBCPP___EXCEPTION_OPERATIONS_H

libcxx/include/__exception/terminate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#endif
1717

1818
namespace std { // purposefully not using versioning namespace
19-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
19+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
2020
} // namespace std
2121

2222
#endif // _LIBCPP___EXCEPTION_TERMINATE_H

libcxx/include/__filesystem/filesystem_error.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesyst
6969

7070
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
7171
template <class... _Args>
72-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
72+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
7373
__throw_filesystem_error(_Args&&... __args) {
7474
throw filesystem_error(std::forward<_Args>(__args)...);
7575
}
7676
# else
7777
template <class... _Args>
78-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
78+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
7979
__throw_filesystem_error(_Args&&...) {
8080
_LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
8181
}

libcxx/include/__format/format_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
3535
};
3636
_LIBCPP_DIAGNOSTIC_POP
3737

38-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
38+
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
3939
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
4040
throw format_error(__s);
4141
# else

libcxx/include/__format/parser_std_format_spec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5252

5353
namespace __format_spec {
5454

55-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void
55+
[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void
5656
__throw_invalid_option_format_error(const char* __id, const char* __option) {
5757
std::__throw_format_error(
5858
(string("The format specifier for ") + __id + " does not allow the " + __option + " option").c_str());
5959
}
6060

61-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) {
61+
[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) {
6262
std::__throw_format_error(
6363
(string("The type option contains an invalid value for ") + __id + " formatting argument").c_str());
6464
}

libcxx/include/__functional/function.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception {
7878
};
7979
_LIBCPP_DIAGNOSTIC_POP
8080

81-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
81+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
8282
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
8383
throw bad_function_call();
8484
# else

libcxx/include/__memory/shared_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception {
123123
const char* what() const _NOEXCEPT override;
124124
};
125125

126-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
126+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
127127
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
128128
throw bad_weak_ptr();
129129
#else

libcxx/include/__system_error/system_error.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
3939
_LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
4040
};
4141

42-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
43-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
42+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
43+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
4444
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
4545
throw system_error(__ec, __what_arg);
4646
#else

libcxx/include/__utility/unreachable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
21+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
2222
_LIBCPP_ASSERT_INTERNAL(false, "std::unreachable() was reached");
2323
__builtin_unreachable();
2424
}

libcxx/include/__verbose_abort

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
// This function should never be called directly from the code -- it should only be called through
2222
// the _LIBCPP_VERBOSE_ABORT macro.
23-
_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
23+
[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
2424
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
2525

2626
// _LIBCPP_VERBOSE_ABORT(format, args...)

libcxx/include/any

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
127127

128128
#if _LIBCPP_STD_VER >= 17
129129

130-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
130+
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
131131
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
132132
throw bad_any_cast();
133133
# else

libcxx/include/future

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __
472472
return error_condition(static_cast<int>(__e), future_category());
473473
}
474474

475-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
475+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
476476

477477
class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error {
478478
error_code __ec_;

libcxx/include/ios

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public:
440440
~failure() _NOEXCEPT override;
441441
};
442442

443-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
443+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
444444
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
445445
throw ios_base::failure(__msg);
446446
# else

libcxx/include/new

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ public:
166166
};
167167
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0
168168

169-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
169+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
170170

171-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
171+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
172172
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
173173
throw bad_array_new_length();
174174
#else

libcxx/include/optional

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public:
255255

256256
_LIBCPP_BEGIN_NAMESPACE_STD
257257

258-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
258+
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
259259
__throw_bad_optional_access() {
260260
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
261261
throw bad_optional_access();

libcxx/include/regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ public:
983983
};
984984

985985
template <regex_constants::error_type _Ev>
986-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
986+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
987987
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
988988
throw regex_error(_Ev);
989989
#else

libcxx/include/stdexcept

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,65 +209,65 @@ public:
209209
_LIBCPP_BEGIN_NAMESPACE_STD
210210

211211
// in the dylib
212-
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
212+
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
213213

214-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
214+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
215215
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
216216
throw logic_error(__msg);
217217
#else
218218
_LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
219219
#endif
220220
}
221221

222-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
222+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
223223
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
224224
throw domain_error(__msg);
225225
#else
226226
_LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
227227
#endif
228228
}
229229

230-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
230+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
231231
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
232232
throw invalid_argument(__msg);
233233
#else
234234
_LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
235235
#endif
236236
}
237237

238-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
238+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
239239
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
240240
throw length_error(__msg);
241241
#else
242242
_LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
243243
#endif
244244
}
245245

246-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
246+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
247247
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
248248
throw out_of_range(__msg);
249249
#else
250250
_LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
251251
#endif
252252
}
253253

254-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
254+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
255255
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
256256
throw range_error(__msg);
257257
#else
258258
_LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
259259
#endif
260260
}
261261

262-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
262+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
263263
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
264264
throw overflow_error(__msg);
265265
#else
266266
_LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
267267
#endif
268268
}
269269

270-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
270+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
271271
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
272272
throw underflow_error(__msg);
273273
#else

libcxx/include/string

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,11 +2230,11 @@ private:
22302230
return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
22312231
}
22322232

2233-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
2233+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
22342234
std::__throw_length_error("basic_string");
22352235
}
22362236

2237-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
2237+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
22382238
std::__throw_out_of_range("basic_string");
22392239
}
22402240

libcxx/include/typeinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private:
373373
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0
374374

375375
_LIBCPP_BEGIN_NAMESPACE_STD
376-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
376+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
377377
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
378378
throw bad_cast();
379379
#else

libcxx/include/variant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ struct __farray {
298298
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
299299
};
300300

301-
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
301+
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
302302
__throw_bad_variant_access() {
303303
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
304304
throw bad_variant_access();

libcxx/include/vector

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,9 @@ private:
995995
__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
996996
}
997997

998-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
998+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
999999

1000-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
1000+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
10011001

10021002
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) {
10031003
if (__alloc() != __c.__alloc()) {
@@ -2163,9 +2163,9 @@ public:
21632163
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
21642164

21652165
private:
2166-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
2166+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
21672167

2168-
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
2168+
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
21692169

21702170
template <class _InputIterator, class _Sentinel>
21712171
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void

libcxx/src/stdexcept.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
_LIBCPP_BEGIN_NAMESPACE_STD
2121

22-
_LIBCPP_NORETURN void __throw_runtime_error(const char* msg) {
22+
void __throw_runtime_error(const char* msg) {
2323
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
2424
throw runtime_error(msg);
2525
#else

0 commit comments

Comments
 (0)