Change `_NODISCARD` in source and test files to `[[nodiscard]]` (#3397)

This commit is contained in:
A. Jiang 2023-02-11 08:17:38 +08:00 коммит произвёл GitHub
Родитель 29638bab05
Коммит 9ae1b3f1fa
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 96 добавлений и 92 удалений

Просмотреть файл

@ -23,7 +23,7 @@ namespace {
CONDITION_VARIABLE _Condition;
};
struct _NODISCARD _Guarded_wait_context : _Wait_context {
struct [[nodiscard]] _Guarded_wait_context : _Wait_context {
_Guarded_wait_context(const void* _Storage_, _Wait_context* const _Head) noexcept
: _Wait_context{_Storage_, _Head, _Head->_Prev, CONDITION_VARIABLE_INIT} {
_Prev->_Next = this;
@ -41,7 +41,7 @@ namespace {
_Guarded_wait_context& operator=(const _Guarded_wait_context&) = delete;
};
class _NODISCARD _SrwLock_guard {
class [[nodiscard]] _SrwLock_guard {
public:
explicit _SrwLock_guard(SRWLOCK& _Locked_) noexcept : _Locked(&_Locked_) {
AcquireSRWLockExclusive(_Locked);
@ -202,8 +202,8 @@ namespace {
}
#endif // _ATOMIC_WAIT_ON_ADDRESS_STATICALLY_AVAILABLE
_NODISCARD unsigned char __std_atomic_compare_exchange_128_fallback(_Inout_bytecount_(16) long long* _Destination,
_In_ long long _ExchangeHigh, _In_ long long _ExchangeLow,
[[nodiscard]] unsigned char __std_atomic_compare_exchange_128_fallback(
_Inout_bytecount_(16) long long* _Destination, _In_ long long _ExchangeHigh, _In_ long long _ExchangeLow,
_Inout_bytecount_(16) long long* _ComparandResult) noexcept {
static SRWLOCK _Mtx = SRWLOCK_INIT;
_SrwLock_guard _Guard{_Mtx};
@ -397,7 +397,7 @@ _Smtx_t* __stdcall __std_atomic_get_mutex(const void* const _Key) noexcept {
}
#pragma warning(pop)
_NODISCARD unsigned char __stdcall __std_atomic_compare_exchange_128(_Inout_bytecount_(16) long long* _Destination,
[[nodiscard]] unsigned char __stdcall __std_atomic_compare_exchange_128(_Inout_bytecount_(16) long long* _Destination,
_In_ long long _ExchangeHigh, _In_ long long _ExchangeLow,
_Inout_bytecount_(16) long long* _ComparandResult) noexcept {
#if !defined(_WIN64)
@ -413,7 +413,7 @@ _NODISCARD unsigned char __stdcall __std_atomic_compare_exchange_128(_Inout_byte
#endif // ^^^ _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 0
}
_NODISCARD char __stdcall __std_atomic_has_cmpxchg16b() noexcept {
[[nodiscard]] char __stdcall __std_atomic_has_cmpxchg16b() noexcept {
#if !defined(_WIN64)
return false;
#elif _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 1

Просмотреть файл

@ -64,7 +64,7 @@ namespace {
_Constexpr_excptptr_immortalize_impl<_Ty> _Immortalize_impl;
template <class _Ty>
_NODISCARD _Ty& _Immortalize() noexcept {
[[nodiscard]] _Ty& _Immortalize() noexcept {
return _Immortalize_impl<_Ty>._Storage;
}
#else // choose immortalize strategy

Просмотреть файл

@ -58,7 +58,7 @@ namespace pmr {
return _Unaligned_new_delete_resource();
}
extern "C" _NODISCARD _CRT_SATELLITE_1 memory_resource* __cdecl null_memory_resource() noexcept {
extern "C" [[nodiscard]] _CRT_SATELLITE_1 memory_resource* __cdecl null_memory_resource() noexcept {
class _Null_resource final : public _Identity_equal_resource {
void* do_allocate(size_t, size_t) override { // Sorry, OOM!
_Xbad_alloc();

Просмотреть файл

@ -11,7 +11,7 @@ constexpr int shift = _STD numeric_limits<unsigned long long>::d
constexpr unsigned long long mask = ~(~0ULL << shift);
constexpr unsigned long long maxVal = mask + 1;
_NODISCARD unsigned long long __CLRCALL_PURE_OR_CDECL _MP_Get(
[[nodiscard]] unsigned long long __CLRCALL_PURE_OR_CDECL _MP_Get(
_MP_arr u) noexcept { // convert multi-word value to scalar value
return (u[1] << shift) + u[0];
}
@ -98,7 +98,7 @@ static void div(_MP_arr u,
}
}
_NODISCARD static int limit(const unsigned long long* u, int ulen) noexcept { // get index of last non-zero value
[[nodiscard]] static int limit(const unsigned long long* u, int ulen) noexcept { // get index of last non-zero value
while (u[ulen - 1] == 0) {
--ulen;
}

Просмотреть файл

@ -9,7 +9,7 @@
extern "C" {
_NODISCARD unsigned int __stdcall __std_parallel_algorithms_hw_threads() noexcept {
[[nodiscard]] unsigned int __stdcall __std_parallel_algorithms_hw_threads() noexcept {
static int _Cached_hw_concurrency = -1;
int _Hw_concurrency = __iso_volatile_load32(&_Cached_hw_concurrency);
if (_Hw_concurrency == -1) {
@ -20,7 +20,7 @@ _NODISCARD unsigned int __stdcall __std_parallel_algorithms_hw_threads() noexcep
return static_cast<unsigned int>(_Hw_concurrency);
}
_NODISCARD PTP_WORK __stdcall __std_create_threadpool_work(
[[nodiscard]] PTP_WORK __stdcall __std_create_threadpool_work(
PTP_WORK_CALLBACK _Callback, void* _Context, PTP_CALLBACK_ENVIRON _Callback_environ) noexcept {
return CreateThreadpoolWork(_Callback, _Context, _Callback_environ);
}

Просмотреть файл

@ -48,7 +48,7 @@
namespace {
template <class _Func>
_NODISCARD auto _Boost_call(const _Func& _Fn) noexcept {
[[nodiscard]] auto _Boost_call(const _Func& _Fn) noexcept {
_TRY_BEGIN
return _Fn();
_CATCH_ALL
@ -60,7 +60,7 @@ namespace {
} // unnamed namespace
_EXTERN_C
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_laguerre(
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_laguerre(
const unsigned int _Pn, const unsigned int _Pm, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
@ -69,7 +69,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_laguerre(
return _Boost_call([=] { return ::boost::math::laguerre(_Pn, _Pm, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_laguerref(
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_laguerref(
const unsigned int _Pn, const unsigned int _Pm, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
@ -78,7 +78,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_laguerref(
return _Boost_call([=] { return ::boost::math::laguerre(_Pn, _Pm, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_legendre(
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_legendre(
const unsigned int _Pl, const unsigned int _Pm, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
@ -94,7 +94,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_assoc_legendre(
});
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_legendref(
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_legendref(
const unsigned int _Pl, const unsigned int _Pm, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
@ -110,23 +110,23 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_assoc_legendref(
});
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_beta(const double _Px, const double _Py) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_beta(const double _Px, const double _Py) noexcept {
return _Boost_call([=] { return ::boost::math::beta(_Px, _Py); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_betaf(const float _Px, const float _Py) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_betaf(const float _Px, const float _Py) noexcept {
return _Boost_call([=] { return ::boost::math::beta(_Px, _Py); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_1(const double _Pk) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_1(const double _Pk) noexcept {
return _Boost_call([=] { return ::boost::math::ellint_1(_Pk); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_1f(const float _Pk) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_1f(const float _Pk) noexcept {
return _Boost_call([=] { return ::boost::math::ellint_1(_Pk); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_2(const double _Pk) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_2(const double _Pk) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -134,7 +134,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_2(const doubl
return _Boost_call([=] { return ::boost::math::ellint_2(_Pk); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_2f(const float _Pk) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_2f(const float _Pk) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -142,7 +142,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_2f(const float
return _Boost_call([=] { return ::boost::math::ellint_2(_Pk); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_3(const double _Pk, const double _Pnu) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_3(const double _Pk, const double _Pnu) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -154,7 +154,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_comp_ellint_3(const doubl
return _Boost_call([=] { return ::boost::math::ellint_3(_Pk, _Pnu); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_3f(const float _Pk, const float _Pnu) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_3f(const float _Pk, const float _Pnu) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -166,7 +166,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_comp_ellint_3f(const float
return _Boost_call([=] { return ::boost::math::ellint_3(_Pk, _Pnu); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_i(const double _Pnu, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_i(const double _Pnu, const double _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -178,7 +178,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_i(const double
return _Boost_call([=] { return ::boost::math::cyl_bessel_i(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_if(const float _Pnu, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_if(const float _Pnu, const float _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -190,7 +190,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_if(const float
return _Boost_call([=] { return ::boost::math::cyl_bessel_i(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_j(const double _Pnu, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_j(const double _Pnu, const double _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -202,7 +202,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_j(const double
return _Boost_call([=] { return ::boost::math::cyl_bessel_j(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_jf(const float _Pnu, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_jf(const float _Pnu, const float _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -214,7 +214,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_jf(const float
return _Boost_call([=] { return ::boost::math::cyl_bessel_j(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_k(const double _Pnu, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_k(const double _Pnu, const double _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -226,7 +226,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_bessel_k(const double
return _Boost_call([=] { return ::boost::math::cyl_bessel_k(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_kf(const float _Pnu, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_kf(const float _Pnu, const float _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -238,7 +238,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_bessel_kf(const float
return _Boost_call([=] { return ::boost::math::cyl_bessel_k(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_neumann(const double _Pnu, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_neumann(const double _Pnu, const double _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -250,7 +250,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_cyl_neumann(const double
return _Boost_call([=] { return ::boost::math::cyl_neumann(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_neumannf(const float _Pnu, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_neumannf(const float _Pnu, const float _Px) noexcept {
if (_STD isnan(_Pnu)) {
return _Pnu;
}
@ -262,7 +262,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_cyl_neumannf(const float _
return _Boost_call([=] { return ::boost::math::cyl_neumann(_Pnu, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_1(const double _Pk, const double _Pphi) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_1(const double _Pk, const double _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -274,7 +274,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_1(const double _Pk
return _Boost_call([=] { return ::boost::math::ellint_1(_Pk, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_1f(const float _Pk, const float _Pphi) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_1f(const float _Pk, const float _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -286,7 +286,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_1f(const float _Pk,
return _Boost_call([=] { return ::boost::math::ellint_1(_Pk, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_2(const double _Pk, const double _Pphi) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_2(const double _Pk, const double _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -298,7 +298,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_2(const double _Pk
return _Boost_call([=] { return ::boost::math::ellint_2(_Pk, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_2f(const float _Pk, const float _Pphi) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_2f(const float _Pk, const float _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
}
@ -310,7 +310,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_2f(const float _Pk,
return _Boost_call([=] { return ::boost::math::ellint_2(_Pk, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_3(
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_3(
const double _Pk, const double _Pnu, const double _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
@ -327,7 +327,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_ellint_3(
return _Boost_call([=] { return ::boost::math::ellint_3(_Pk, _Pnu, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_3f(
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_3f(
const float _Pk, const float _Pnu, const float _Pphi) noexcept {
if (_STD isnan(_Pk)) {
return _Pk;
@ -344,7 +344,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_ellint_3f(
return _Boost_call([=] { return ::boost::math::ellint_3(_Pk, _Pnu, _Pphi); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_expint(const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_expint(const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -352,7 +352,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_expint(const double _Px)
return _Boost_call([=] { return ::boost::math::expint(_Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_expintf(const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_expintf(const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -360,7 +360,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_expintf(const float _Px) n
return _Boost_call([=] { return ::boost::math::expint(_Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_hermite(const unsigned int _Pn, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_hermite(const unsigned int _Pn, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -368,7 +368,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_hermite(const unsigned in
return _Boost_call([=] { return ::boost::math::hermite(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_hermitef(const unsigned int _Pn, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_hermitef(const unsigned int _Pn, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -376,7 +376,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_hermitef(const unsigned in
return _Boost_call([=] { return ::boost::math::hermite(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_laguerre(const unsigned int _Pn, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_laguerre(const unsigned int _Pn, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -384,7 +384,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_laguerre(const unsigned i
return _Boost_call([=] { return ::boost::math::laguerre(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_laguerref(const unsigned int _Pn, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_laguerref(const unsigned int _Pn, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -392,7 +392,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_laguerref(const unsigned i
return _Boost_call([=] { return ::boost::math::laguerre(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_legendre(const unsigned int _Pl, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_legendre(const unsigned int _Pl, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -400,7 +400,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_legendre(const unsigned i
return _Boost_call([=] { return ::boost::math::legendre_p(_Pl, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_legendref(const unsigned int _Pl, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_legendref(const unsigned int _Pl, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -408,7 +408,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_legendref(const unsigned i
return _Boost_call([=] { return ::boost::math::legendre_p(_Pl, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_riemann_zeta(const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_riemann_zeta(const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -416,7 +416,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_riemann_zeta(const double
return _Boost_call([=] { return ::boost::math::zeta(_Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_riemann_zetaf(const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_riemann_zetaf(const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -424,7 +424,8 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_riemann_zetaf(const float
return _Boost_call([=] { return ::boost::math::zeta(_Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_bessel(const unsigned int _Pn, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_sph_bessel(
const unsigned int _Pn, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -432,7 +433,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_bessel(const unsigned
return _Boost_call([=] { return ::boost::math::sph_bessel(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_sph_besself(const unsigned int _Pn, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_sph_besself(const unsigned int _Pn, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -440,7 +441,7 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_sph_besself(const unsigned
return _Boost_call([=] { return ::boost::math::sph_bessel(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_legendre(
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_sph_legendre(
const unsigned int _Pl, const unsigned int _Pm, const double _Ptheta) noexcept {
if (_STD isnan(_Ptheta)) {
return _Ptheta;
@ -449,7 +450,7 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_legendre(
return _Boost_call([=] { return ::boost::math::spherical_harmonic_r(_Pl, _Pm, _Ptheta, 0.0); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_sph_legendref(
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_sph_legendref(
const unsigned int _Pl, const unsigned int _Pm, const float _Ptheta) noexcept {
if (_STD isnan(_Ptheta)) {
return _Ptheta;
@ -458,7 +459,8 @@ _NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_sph_legendref(
return _Boost_call([=] { return ::boost::math::spherical_harmonic_r(_Pl, _Pm, _Ptheta, 0.0f); });
}
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_neumann(const unsigned int _Pn, const double _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_sph_neumann(
const unsigned int _Pn, const double _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -466,7 +468,8 @@ _NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_sph_neumann(const unsigne
return _Boost_call([=] { return ::boost::math::sph_neumann(_Pn, _Px); });
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_sph_neumannf(const unsigned int _Pn, const float _Px) noexcept {
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_sph_neumannf(
const unsigned int _Pn, const float _Px) noexcept {
if (_STD isnan(_Px)) {
return _Px;
}
@ -477,7 +480,7 @@ _END_EXTERN_C
namespace {
template <class _Ty>
_NODISCARD _Ty _Hypot3(_Ty _Dx, _Ty _Dy, _Ty _Dz) noexcept { // type-oblivious backend for 3-arg hypot
[[nodiscard]] _Ty _Hypot3(_Ty _Dx, _Ty _Dy, _Ty _Dz) noexcept { // type-oblivious backend for 3-arg hypot
static_assert(_STD is_floating_point_v<_Ty>);
_Dx = _STD abs(_Dx);
_Dy = _STD abs(_Dy);
@ -509,12 +512,12 @@ namespace {
} // unnamed namespace
_EXTERN_C
_NODISCARD _CRT_SATELLITE_2 double __stdcall __std_smf_hypot3(
[[nodiscard]] _CRT_SATELLITE_2 double __stdcall __std_smf_hypot3(
const double _Dx, const double _Dy, const double _Dz) noexcept {
return _Hypot3(_Dx, _Dy, _Dz);
}
_NODISCARD _CRT_SATELLITE_2 float __stdcall __std_smf_hypot3f(
[[nodiscard]] _CRT_SATELLITE_2 float __stdcall __std_smf_hypot3f(
const float _Dx, const float _Dy, const float _Dz) noexcept {
return _Hypot3(_Dx, _Dy, _Dz);
}

Просмотреть файл

@ -34,7 +34,7 @@ _EXTERN_C
// TRANSITION, ABI: This returns a pointer to a C++ type.
// A flat C interface would return an opaque handle and would provide separate functions for locking and unlocking.
_NODISCARD _STD shared_mutex* __stdcall __std_acquire_shared_mutex_for_instance(void* _Ptr) noexcept {
[[nodiscard]] _STD shared_mutex* __stdcall __std_acquire_shared_mutex_for_instance(void* _Ptr) noexcept {
try {
_STD scoped_lock _Guard(_Lookup_mutex);
auto& [_Mutex, _Refs] = _Lookup_map.try_emplace(_Ptr).first->second;

Просмотреть файл

@ -22,7 +22,7 @@ namespace {
_Is_whitespace['\0'] = true;
}
_NODISCARD constexpr bool _Test(const char _Ch) const noexcept {
[[nodiscard]] constexpr bool _Test(const char _Ch) const noexcept {
return _Is_whitespace[static_cast<unsigned char>(_Ch)];
}
};
@ -31,7 +31,7 @@ namespace {
} // unnamed namespace
_EXTERN_C
_NODISCARD size_t __CLRCALL_PURE_OR_STDCALL __std_get_string_size_without_trailing_whitespace(
[[nodiscard]] size_t __CLRCALL_PURE_OR_STDCALL __std_get_string_size_without_trailing_whitespace(
const char* const _Str, size_t _Size) noexcept {
while (_Size != 0 && _Whitespace_bitmap._Test(_Str[_Size - 1])) {
--_Size;
@ -40,7 +40,7 @@ _NODISCARD size_t __CLRCALL_PURE_OR_STDCALL __std_get_string_size_without_traili
return _Size;
}
_NODISCARD size_t __CLRCALL_PURE_OR_STDCALL __std_system_error_allocate_message(
[[nodiscard]] size_t __CLRCALL_PURE_OR_STDCALL __std_system_error_allocate_message(
const unsigned long _Message_id, char** const _Ptr_str) noexcept {
// convert to name of Windows error, return 0 for failure, otherwise return number of chars in buffer
// __std_system_error_deallocate_message should be called even if 0 is returned

Просмотреть файл

@ -53,7 +53,7 @@ namespace {
}
}
_NODISCARD _Icu_api_level _Init_icu_functions(_Icu_api_level _Level) noexcept {
[[nodiscard]] _Icu_api_level _Init_icu_functions(_Icu_api_level _Level) noexcept {
while (!_Icu_functions._Api_level.compare_exchange_weak(
_Level, _Icu_api_level::_Detecting, _STD memory_order_acq_rel)) {
if (_Level > _Icu_api_level::_Detecting) {
@ -98,7 +98,7 @@ namespace {
return _Level;
}
_NODISCARD _Icu_api_level _Acquire_icu_functions() noexcept {
[[nodiscard]] _Icu_api_level _Acquire_icu_functions() noexcept {
auto _Level = _Icu_functions._Api_level.load(_STD memory_order_acquire);
if (_Level <= _Icu_api_level::_Detecting) {
_Level = _Init_icu_functions(_Level);
@ -112,51 +112,52 @@ namespace {
_Fun(cal);
}
_NODISCARD int32_t __icu_ucal_get(const UCalendar* cal, UCalendarDateFields field, UErrorCode* status) noexcept {
[[nodiscard]] int32_t __icu_ucal_get(const UCalendar* cal, UCalendarDateFields field, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_get.load(_STD memory_order_relaxed);
return _Fun(cal, field, status);
}
_NODISCARD int32_t __icu_ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, UChar* result,
[[nodiscard]] int32_t __icu_ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, UChar* result,
int32_t resultCapacity, UBool* isSystemID, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_getCanonicalTimeZoneID.load(_STD memory_order_relaxed);
return _Fun(id, len, result, resultCapacity, isSystemID, status);
}
_NODISCARD int32_t __icu_ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec) noexcept {
[[nodiscard]] int32_t __icu_ucal_getDefaultTimeZone(
UChar* result, int32_t resultCapacity, UErrorCode* ec) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_getDefaultTimeZone.load(_STD memory_order_relaxed);
return _Fun(result, resultCapacity, ec);
}
_NODISCARD int32_t __icu_ucal_getTimeZoneDisplayName(const UCalendar* cal, UCalendarDisplayNameType type,
[[nodiscard]] int32_t __icu_ucal_getTimeZoneDisplayName(const UCalendar* cal, UCalendarDisplayNameType type,
const char* locale, UChar* result, int32_t resultLength, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_getTimeZoneDisplayName.load(_STD memory_order_relaxed);
return _Fun(cal, type, locale, result, resultLength, status);
}
_NODISCARD UBool __icu_ucal_getTimeZoneTransitionDate(
[[nodiscard]] UBool __icu_ucal_getTimeZoneTransitionDate(
const UCalendar* cal, UTimeZoneTransitionType type, UDate* transition, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_getTimeZoneTransitionDate.load(_STD memory_order_relaxed);
return _Fun(cal, type, transition, status);
}
_NODISCARD const char* __icu_ucal_getTZDataVersion(UErrorCode* status) noexcept {
[[nodiscard]] const char* __icu_ucal_getTZDataVersion(UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_getTZDataVersion.load(_STD memory_order_relaxed);
return _Fun(status);
}
_NODISCARD UBool __icu_ucal_inDaylightTime(const UCalendar* cal, UErrorCode* status) noexcept {
[[nodiscard]] UBool __icu_ucal_inDaylightTime(const UCalendar* cal, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_inDaylightTime.load(_STD memory_order_relaxed);
return _Fun(cal, status);
}
_NODISCARD UCalendar* __icu_ucal_open(
[[nodiscard]] UCalendar* __icu_ucal_open(
const UChar* zoneID, int32_t len, const char* locale, UCalendarType type, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_open.load(_STD memory_order_relaxed);
return _Fun(zoneID, len, locale, type, status);
}
_NODISCARD UEnumeration* __icu_ucal_openTimeZoneIDEnumeration(
[[nodiscard]] UEnumeration* __icu_ucal_openTimeZoneIDEnumeration(
USystemTimeZoneType zoneType, const char* region, const int32_t* rawOffset, UErrorCode* ec) noexcept {
const auto _Fun = _Icu_functions._Pfn_ucal_openTimeZoneIDEnumeration.load(_STD memory_order_relaxed);
return _Fun(zoneType, region, rawOffset, ec);
@ -172,12 +173,12 @@ namespace {
_Fun(en);
}
_NODISCARD int32_t __icu_uenum_count(UEnumeration* en, UErrorCode* ec) noexcept {
[[nodiscard]] int32_t __icu_uenum_count(UEnumeration* en, UErrorCode* ec) noexcept {
const auto _Fun = _Icu_functions._Pfn_uenum_count.load(_STD memory_order_relaxed);
return _Fun(en, ec);
}
_NODISCARD const UChar* __icu_uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status) noexcept {
[[nodiscard]] const UChar* __icu_uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status) noexcept {
const auto _Fun = _Icu_functions._Pfn_uenum_unext.load(_STD memory_order_relaxed);
return _Fun(en, resultLength, status);
}
@ -194,7 +195,7 @@ namespace {
}
};
_NODISCARD const char* _Allocate_wide_to_narrow(
[[nodiscard]] const char* _Allocate_wide_to_narrow(
const char16_t* const _Input, const int _Input_len, __std_tzdb_error& _Err) noexcept {
const auto _Code_page = __std_fs_code_page();
const auto _Input_as_wchar = reinterpret_cast<const wchar_t*>(_Input);
@ -223,7 +224,7 @@ namespace {
return _Data.release();
}
_NODISCARD _STD unique_ptr<const char16_t[]> _Allocate_narrow_to_wide(
[[nodiscard]] _STD unique_ptr<const char16_t[]> _Allocate_narrow_to_wide(
const char* const _Input, const int _Input_len, __std_tzdb_error& _Err) noexcept {
const auto _Code_page = __std_fs_code_page();
const auto _Count = __std_fs_convert_narrow_to_wide(_Code_page, _Input, _Input_len, nullptr, 0);
@ -251,7 +252,7 @@ namespace {
}
template <class _Function>
_NODISCARD _STD unique_ptr<const char16_t[]> _Get_icu_string_impl(const _Function _Icu_fn,
[[nodiscard]] _STD unique_ptr<const char16_t[]> _Get_icu_string_impl(const _Function _Icu_fn,
const int32_t _Initial_buf_len, int32_t& _Result_len, __std_tzdb_error& _Err) noexcept {
_STD unique_ptr<char16_t[]> _Str_buf{new (_STD nothrow) char16_t[_Initial_buf_len]};
if (_Str_buf == nullptr) {
@ -280,7 +281,7 @@ namespace {
return _Str_buf;
}
_NODISCARD _STD unique_ptr<const char16_t[]> _Get_canonical_id(
[[nodiscard]] _STD unique_ptr<const char16_t[]> _Get_canonical_id(
const char16_t* _Id, const int32_t _Len, int32_t& _Result_len, __std_tzdb_error& _Err) noexcept {
const auto _Icu_fn = [_Id, _Len](UChar* _Result, int32_t _Result_capacity, UErrorCode* _UErr) {
UBool _Is_system{};
@ -289,7 +290,7 @@ namespace {
return _Get_icu_string_impl(_Icu_fn, 32, _Result_len, _Err);
}
_NODISCARD _STD unique_ptr<const char16_t[]> _Get_default_timezone(
[[nodiscard]] _STD unique_ptr<const char16_t[]> _Get_default_timezone(
int32_t& _Result_len, __std_tzdb_error& _Err) noexcept {
const auto _Icu_fn = [](UChar* _Result, int32_t _Result_capacity, UErrorCode* _UErr) {
return __icu_ucal_getDefaultTimeZone(_Result, _Result_capacity, _UErr);
@ -297,7 +298,7 @@ namespace {
return _Get_icu_string_impl(_Icu_fn, 32, _Result_len, _Err);
}
_NODISCARD _STD unique_ptr<const char16_t[]> _Get_timezone_short_id(
[[nodiscard]] _STD unique_ptr<const char16_t[]> _Get_timezone_short_id(
UCalendar* const _Cal, const bool _Is_daylight, int32_t& _Result_len, __std_tzdb_error& _Err) noexcept {
const auto _Display_type =
_Is_daylight ? UCalendarDisplayNameType::UCAL_SHORT_DST : UCalendarDisplayNameType::UCAL_SHORT_STANDARD;
@ -307,7 +308,7 @@ namespace {
return _Get_icu_string_impl(_Icu_fn, 12, _Result_len, _Err);
}
_NODISCARD _STD unique_ptr<UCalendar, _UCalendar_deleter> _Get_cal(
[[nodiscard]] _STD unique_ptr<UCalendar, _UCalendar_deleter> _Get_cal(
const char* _Tz, const size_t _Tz_len, __std_tzdb_error& _Err) noexcept {
const auto _Tz_name = _Allocate_narrow_to_wide(_Tz, static_cast<int>(_Tz_len), _Err);
if (_Tz_name == nullptr) {
@ -325,13 +326,13 @@ namespace {
}
template <class _Ty, class _Dx>
_NODISCARD _Ty* _Report_error(_STD unique_ptr<_Ty, _Dx>& _Info, const __std_tzdb_error _Err) noexcept {
[[nodiscard]] _Ty* _Report_error(_STD unique_ptr<_Ty, _Dx>& _Info, const __std_tzdb_error _Err) noexcept {
_Info->_Err = _Err;
return _Info.release();
}
template <class _Ty, class _Dx>
_NODISCARD _Ty* _Propagate_error(_STD unique_ptr<_Ty, _Dx>& _Info) noexcept {
[[nodiscard]] _Ty* _Propagate_error(_STD unique_ptr<_Ty, _Dx>& _Info) noexcept {
// a bad_alloc returns nullptr and does not set __std_tzdb_error
return _Info->_Err == __std_tzdb_error::_Success ? nullptr : _Info.release();
}
@ -339,7 +340,7 @@ namespace {
_EXTERN_C
_NODISCARD __std_tzdb_time_zones_info* __stdcall __std_tzdb_get_time_zones() noexcept {
[[nodiscard]] __std_tzdb_time_zones_info* __stdcall __std_tzdb_get_time_zones() noexcept {
// On exit---
// _Info == nullptr --> bad_alloc
// _Info->_Err == _Win_error --> failed, call GetLastError()
@ -442,7 +443,7 @@ void __stdcall __std_tzdb_delete_time_zones(__std_tzdb_time_zones_info* const _I
}
}
_NODISCARD __std_tzdb_current_zone_info* __stdcall __std_tzdb_get_current_zone() noexcept {
[[nodiscard]] __std_tzdb_current_zone_info* __stdcall __std_tzdb_get_current_zone() noexcept {
// On exit---
// _Info == nullptr --> bad_alloc
// _Info->_Err == _Win_error --> failed, call GetLastError()
@ -482,7 +483,7 @@ void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* cons
}
}
_NODISCARD __std_tzdb_sys_info* __stdcall __std_tzdb_get_sys_info(
[[nodiscard]] __std_tzdb_sys_info* __stdcall __std_tzdb_get_sys_info(
const char* _Tz, const size_t _Tz_len, __std_tzdb_epoch_milli _Sys) noexcept {
// On exit---
// _Info == nullptr --> bad_alloc
@ -566,7 +567,7 @@ void __stdcall __std_tzdb_delete_sys_info(__std_tzdb_sys_info* const _Info) noex
}
}
_NODISCARD __std_tzdb_leap_info* __stdcall __std_tzdb_get_leap_seconds(
[[nodiscard]] __std_tzdb_leap_info* __stdcall __std_tzdb_get_leap_seconds(
const size_t prev_reg_ls_size, size_t* const current_reg_ls_size) noexcept {
// On exit---
// *current_reg_ls_size <= prev_reg_ls_size, reg_ls_data == nullptr --> no new data
@ -617,7 +618,7 @@ void __stdcall __std_tzdb_delete_leap_seconds(__std_tzdb_leap_info* _Info) noexc
delete[] _Info;
}
_NODISCARD void* __stdcall __std_calloc_crt(const size_t count, const size_t size) noexcept {
[[nodiscard]] void* __stdcall __std_calloc_crt(const size_t count, const size_t size) noexcept {
return _calloc_crt(count, size);
}

Просмотреть файл

@ -189,14 +189,14 @@ _END_EXTERN_C_UNLESS_PURE
#endif
template <typename T>
_NODISCARD T _Xfe_overflow(const T sign) noexcept {
[[nodiscard]] T _Xfe_overflow(const T sign) noexcept {
static_assert(_STD is_floating_point_v<T>, "Expected is_floating_point_v<T>.");
constexpr T huge = _STD numeric_limits<T>::max();
return _STD copysign(huge, sign) * huge;
}
template <typename T>
_NODISCARD T _Xfe_underflow(const T sign) noexcept {
[[nodiscard]] T _Xfe_underflow(const T sign) noexcept {
static_assert(_STD is_floating_point_v<T>, "Expected is_floating_point_v<T>.");
constexpr T tiny = _STD numeric_limits<T>::min();
return _STD copysign(tiny, sign) * tiny;

Просмотреть файл

@ -602,7 +602,7 @@ constexpr bool test_one(TestContainerType& test_container, RangeTypes&&... range
// TRANSITION, VSO-1655299: use a helper function as a workaround
template <class Category, test::Common IsCommon>
_NODISCARD constexpr test::CanCompare test_range_can_compare() {
[[nodiscard]] constexpr test::CanCompare test_range_can_compare() {
return test::CanCompare{to_bool(IsCommon) || derived_from<Category, forward_iterator_tag>};
}