diff --git a/stl/inc/complex b/stl/inc/complex index 60b017fdb92..14ee315d8bd 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -60,10 +60,10 @@ struct _C_ldouble_complex { _STD_BEGIN -// implements multi-precision floating point arithmetic for numerical algorithms +// implements multi-precision floating-point arithmetic for numerical algorithms #pragma float_control(precise, on, push) namespace _Float_multi_prec { - // multi-precision floating point types + // multi-precision floating-point types template struct _Fmp_t; @@ -1877,7 +1877,7 @@ _Ty _Fabs(const complex<_Ty>& _Left, int* _Pexp) { // Used by sqrt(), return mag _Bv = _Bv * static_cast<_Ty>(0.0625); } else { constexpr _Ty _Flt_eps = _Ctraits<_Ty>::_Flt_eps(); - // TRANSITION, workaround for non floating point _Ty + // TRANSITION, workaround for non-floating-point _Ty constexpr _Ty _Leg_tiny = _Flt_eps == 0 ? _Ty{0} : 2 * _Ctraits<_Ty>::_Flt_norm_min() / _Flt_eps; if (_Av < _Leg_tiny) { @@ -1914,7 +1914,7 @@ _Ty _Fabs(const complex<_Ty>& _Left, int* _Pexp) { // Used by sqrt(), return mag // FUNCTION TEMPLATE log template -_NODISCARD _Ty _Log_abs(const complex<_Ty>& _Left) noexcept { // for double, long double, and non floating point types +_NODISCARD _Ty _Log_abs(const complex<_Ty>& _Left) noexcept { // for double, long double, and non-floating-point types return static_cast<_Ty>( _Math_algorithms::_Log_hypot(static_cast(_STD real(_Left)), static_cast(_STD imag(_Left)))); } diff --git a/stl/inc/strstream b/stl/inc/strstream index f7b4662ee5b..9f9c9ef8ba6 100644 --- a/stl/inc/strstream +++ b/stl/inc/strstream @@ -193,7 +193,7 @@ protected: if (_Old_gptr && eback() < _Old_gptr) { // if the input sequence has a putback position available if (_Meta == EOF) { _Meta = 0; // a value other than EOF - } else if (!(_Strmode & _Constant)) { // non constant, overwrite no matter what + } else if (!(_Strmode & _Constant)) { // non-constant, overwrite no matter what _Old_gptr[-1] = static_cast(_Meta); } else if (_Old_gptr[-1] != static_cast(_Meta)) { // constant, unequal, can't put it back return EOF; diff --git a/stl/inc/typeinfo b/stl/inc/typeinfo index aa2fefe3241..45cd623b7d1 100644 --- a/stl/inc/typeinfo +++ b/stl/inc/typeinfo @@ -55,7 +55,7 @@ protected: } }; -class _CRTIMP2_IMPORT __non_rtti_object : public bad_typeid { // report a non RTTI object +class _CRTIMP2_IMPORT __non_rtti_object : public bad_typeid { // report a non-RTTI object public: __non_rtti_object(const char* _Message) : bad_typeid(_Message) {} }; diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index 1541b393bae..4ba5685542e 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -898,7 +898,7 @@ private: if (_Sticky) { // increment ls digit in memory of those lost char* _Px = _Ptr; while (--_Px != _Leading) { // add in carry - if (*_Px != localeconv()->decimal_point[0]) { // non decimal point + if (*_Px != localeconv()->decimal_point[0]) { // not decimal point if (*_Px != '9') { // carry stops here ++*_Px; break; diff --git a/stl/inc/xstring b/stl/inc/xstring index e3fcec57484..02f071dab04 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -4116,7 +4116,7 @@ public: _NODISCARD size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept /* strengthened */ { - // look for non _Ch at or after _Off + // look for non-_Ch at or after _Off return static_cast( _Traits_find_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } @@ -4155,7 +4155,7 @@ public: _NODISCARD size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept /* strengthened */ { - // look for non _Ch before _Off + // look for non-_Ch before _Off return static_cast( _Traits_rfind_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } diff --git a/stl/inc/xutility b/stl/inc/xutility index ca2499bd1c7..842cb2a1f2b 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -6123,77 +6123,61 @@ struct _CXX17_DEPRECATE_ITERATOR_BASE_CLASS iterator { // base type for iterator using reference = _Reference; }; -// STRUCT TEMPLATE _Float_traits -template -struct _Float_traits { - static_assert(is_floating_point_v<_Ty>, "_Float_traits is invalid"); - - // traits for double and long double: - using type = unsigned long long; - - static constexpr type _Sign_mask = 0x8000'0000'0000'0000ULL; - static constexpr type _Magnitude_mask = 0x7fff'ffff'ffff'ffffULL; - static constexpr type _Exponent_mask = 0x7ff0'0000'0000'0000ULL; - static constexpr type _Quiet_nan_mask = 0x0008'0000'0000'0000ULL; -}; - -template <> -struct _Float_traits { - using type = unsigned int; - - static constexpr type _Sign_mask = 0x8000'0000U; - static constexpr type _Magnitude_mask = 0x7fff'ffffU; - static constexpr type _Exponent_mask = 0x7f80'0000U; - static constexpr type _Quiet_nan_mask = 0x0040'0000U; -}; - // FUNCTION TEMPLATE _Float_abs_bits template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST auto _Float_abs_bits(const _Ty& _Xx) { - const auto _Bits = _Bit_cast::type>(_Xx); - return _Bits & _Float_traits<_Ty>::_Magnitude_mask; + using _Traits = _Floating_type_traits<_Ty>; + using _Uint_type = typename _Traits::_Uint_type; + const auto _Bits = _Bit_cast<_Uint_type>(_Xx); + return _Bits & ~_Traits::_Shifted_sign_mask; } // FUNCTION TEMPLATE _Float_abs template , int> = 0> -_NODISCARD _CONSTEXPR_BIT_CAST _Ty _Float_abs(const _Ty _Xx) { // constexpr floating point abs() +_NODISCARD _CONSTEXPR_BIT_CAST _Ty _Float_abs(const _Ty _Xx) { // constexpr floating-point abs() return _Bit_cast<_Ty>(_Float_abs_bits(_Xx)); } // FUNCTION TEMPLATE _Float_copysign template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST _Ty _Float_copysign(const _Ty _Magnitude, const _Ty _Sign) { // constexpr copysign() - const auto _Signbit = _Bit_cast::type>(_Sign) & _Float_traits<_Ty>::_Sign_mask; + using _Traits = _Floating_type_traits<_Ty>; + using _Uint_type = typename _Traits::_Uint_type; + const auto _Signbit = _Bit_cast<_Uint_type>(_Sign) & _Traits::_Shifted_sign_mask; return _Bit_cast<_Ty>(_Float_abs_bits(_Magnitude) | _Signbit); } // FUNCTION TEMPLATE _Is_nan template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_nan(const _Ty _Xx) { // constexpr isnan() - return _Float_abs_bits(_Xx) > _Float_traits<_Ty>::_Exponent_mask; + using _Traits = _Floating_type_traits<_Ty>; + return _Float_abs_bits(_Xx) > _Traits::_Shifted_exponent_mask; } // FUNCTION TEMPLATE _Is_signaling_nan // TRANSITION, workaround x86 ABI -// On x86 ABI, floating point by-value arguments and return values are passed in 80-bit x87 registers. +// On x86 ABI, floating-point by-value arguments and return values are passed in 80-bit x87 registers. // When the value is a 32-bit or 64-bit signaling NaN, the conversion to/from 80-bit raises FE_INVALID // and turns it into a quiet NaN. This behavior is undesirable if we want to test for signaling NaNs. template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_signaling_nan(const _Ty& _Xx) { // returns true if input is a signaling NaN + using _Traits = _Floating_type_traits<_Ty>; const auto _Abs_bits = _Float_abs_bits(_Xx); - return _Abs_bits > _Float_traits<_Ty>::_Exponent_mask && ((_Abs_bits & _Float_traits<_Ty>::_Quiet_nan_mask) == 0); + return _Abs_bits > _Traits::_Shifted_exponent_mask && ((_Abs_bits & _Traits::_Special_nan_mantissa_mask) == 0); } // FUNCTION TEMPLATE _Is_inf template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_inf(const _Ty _Xx) { // constexpr isinf() - return _Float_abs_bits(_Xx) == _Float_traits<_Ty>::_Exponent_mask; + using _Traits = _Floating_type_traits<_Ty>; + return _Float_abs_bits(_Xx) == _Traits::_Shifted_exponent_mask; } // FUNCTION TEMPLATE _Is_finite template , int> = 0> _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_finite(const _Ty _Xx) { // constexpr isfinite() - return _Float_abs_bits(_Xx) < _Float_traits<_Ty>::_Exponent_mask; + using _Traits = _Floating_type_traits<_Ty>; + return _Float_abs_bits(_Xx) < _Traits::_Shifted_exponent_mask; } // STRUCT _Nontrivial_dummy_type diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 66410d27b3f..41825e5fb31 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -653,7 +653,7 @@ #ifndef _STD_VECTORIZE_WITH_FLOAT_CONTROL #ifdef _M_FP_EXCEPT #define _STD_VECTORIZE_WITH_FLOAT_CONTROL 0 -#else // ^^^ floating point exceptions enabled / floating point exceptions disabled (default) vvv +#else // ^^^ floating-point exceptions enabled / floating-point exceptions disabled (default) vvv #define _STD_VECTORIZE_WITH_FLOAT_CONTROL 1 #endif // _M_FP_EXCEPT #endif // _STD_VECTORIZE_WITH_FLOAT_CONTROL diff --git a/stl/src/cond.cpp b/stl/src/cond.cpp index c619d264dea..350bb5c60ed 100644 --- a/stl/src/cond.cpp +++ b/stl/src/cond.cpp @@ -23,8 +23,7 @@ struct _Cnd_internal_imp_t { // condition variable implementation for ConcRT }; static_assert(sizeof(_Cnd_internal_imp_t) <= _Cnd_internal_imp_size, "incorrect _Cnd_internal_imp_size"); -static_assert(std::alignment_of<_Cnd_internal_imp_t>::value <= _Cnd_internal_imp_alignment, - "incorrect _Cnd_internal_imp_alignment"); +static_assert(alignof(_Cnd_internal_imp_t) <= _Cnd_internal_imp_alignment, "incorrect _Cnd_internal_imp_alignment"); void _Cnd_init_in_situ(const _Cnd_t cond) { // initialize condition variable in situ Concurrency::details::create_stl_condition_variable(cond->_get_cv()); diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 8749f4544b9..5db8385bec6 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -51,8 +51,7 @@ struct _Mtx_internal_imp_t { // ConcRT mutex }; static_assert(sizeof(_Mtx_internal_imp_t) <= _Mtx_internal_imp_size, "incorrect _Mtx_internal_imp_size"); -static_assert(std::alignment_of<_Mtx_internal_imp_t>::value <= _Mtx_internal_imp_alignment, - "incorrect _Mtx_internal_imp_alignment"); +static_assert(alignof(_Mtx_internal_imp_t) <= _Mtx_internal_imp_alignment, "incorrect _Mtx_internal_imp_alignment"); void _Mtx_init_in_situ(_Mtx_t mtx, int type) { // initialize mutex in situ Concurrency::details::create_stl_critical_section(mtx->_get_cs()); diff --git a/tests/std/tests/GH_000935_complex_numerical_accuracy/floating_point_utils.hpp b/tests/std/tests/GH_000935_complex_numerical_accuracy/floating_point_utils.hpp index 0688d763ea7..9dccbea001f 100644 --- a/tests/std/tests/GH_000935_complex_numerical_accuracy/floating_point_utils.hpp +++ b/tests/std/tests/GH_000935_complex_numerical_accuracy/floating_point_utils.hpp @@ -12,19 +12,19 @@ namespace fputil { template - using float_bits_t = typename _STD _Float_traits::type; + using float_bits_t = typename _STD _Floating_type_traits::_Uint_type; template - _INLINE_VAR constexpr float_bits_t magnitude_mask_v = _STD _Float_traits::_Magnitude_mask; + _INLINE_VAR constexpr float_bits_t sign_mask_v = _STD _Floating_type_traits::_Shifted_sign_mask; template - _INLINE_VAR constexpr float_bits_t exponent_mask_v = _STD _Float_traits::_Exponent_mask; + _INLINE_VAR constexpr float_bits_t magnitude_mask_v = ~sign_mask_v; template - _INLINE_VAR constexpr float_bits_t significand_mask_v = magnitude_mask_v & ~exponent_mask_v; + _INLINE_VAR constexpr float_bits_t exponent_mask_v = _STD _Floating_type_traits::_Shifted_exponent_mask; template - _INLINE_VAR constexpr float_bits_t sign_mask_v = _STD _Float_traits::_Sign_mask; + _INLINE_VAR constexpr float_bits_t significand_mask_v = magnitude_mask_v & ~exponent_mask_v; template _INLINE_VAR constexpr float_bits_t norm_min_bits_v = significand_mask_v + 1U; diff --git a/tests/std/tests/P0092R1_polishing_chrono/test.cpp b/tests/std/tests/P0092R1_polishing_chrono/test.cpp index 25c99b32260..90fef1c564c 100644 --- a/tests/std/tests/P0092R1_polishing_chrono/test.cpp +++ b/tests/std/tests/P0092R1_polishing_chrono/test.cpp @@ -208,7 +208,7 @@ int main() { assert(duration_cast>(d).count() == 17); - // DevDiv-742944 "non conforming return value for std::chrono::duration::operator%()" + // DevDiv-742944 "non-conforming return value for std::chrono::duration::operator%()" assert((milliseconds(1050) % seconds(1)).count() == 50); assert((milliseconds(1729) / 10).count() == 172); diff --git a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp index fbd973ba583..85d455fa87b 100644 --- a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp +++ b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp @@ -105,11 +105,11 @@ namespace std { template <> struct hash { - hash() { // non trivial + hash() { // non-trivial } - hash(const hash&) { // non trivial + hash(const hash&) { // non-trivial } - hash& operator=(const hash&) { // non trivial + hash& operator=(const hash&) { // non-trivial return *this; } size_t operator()(Hashable) { diff --git a/tests/std/tests/P0896R4_istream_view/test.cpp b/tests/std/tests/P0896R4_istream_view/test.cpp index 20d8efb5f4b..346c66d3cdc 100644 --- a/tests/std/tests/P0896R4_istream_view/test.cpp +++ b/tests/std/tests/P0896R4_istream_view/test.cpp @@ -71,7 +71,7 @@ void test_one_type() { static_assert(noexcept(default_constructed.end())); static_assert(noexcept(ranges::end(default_constructed))); - // Non existing member functions + // Nonexistent member functions static_assert(!CanMemberSize); static_assert(!CanMemberData); static_assert(!CanMemberEmpty); diff --git a/tests/std/tests/P0896R4_views_take_while/test.cpp b/tests/std/tests/P0896R4_views_take_while/test.cpp index 180a6d6f30e..80cbcd35957 100644 --- a/tests/std/tests/P0896R4_views_take_while/test.cpp +++ b/tests/std/tests/P0896R4_views_take_while/test.cpp @@ -246,7 +246,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { same_as> auto sc = as_const(r).end(); if (forward_range) { // intentionally not if constexpr - // Compare with const / non const iterators + // Compare with const / non-const iterators assert(s != r.begin()); assert(s != as_const(r).begin()); assert(sc != r.begin()); diff --git a/tests/std/tests/VSO_0000000_type_traits/test.cpp b/tests/std/tests/VSO_0000000_type_traits/test.cpp index da226deb65b..a623fb02c73 100644 --- a/tests/std/tests/VSO_0000000_type_traits/test.cpp +++ b/tests/std/tests/VSO_0000000_type_traits/test.cpp @@ -493,7 +493,7 @@ VERIFY_BASE_CHARACTERISTIC(is_void, conjunction, void>); VERIFY_BASE_CHARACTERISTIC(is_volatile, conjunction, is_volatile, void>); VERIFY_BASE_CHARACTERISTIC(is_const, conjunction, void, void>); VERIFY_BASE_CHARACTERISTIC(is_const, conjunction, void, void, void>); -// non integral_constant family +// non-integral_constant family VERIFY_BASE_CHARACTERISTIC_V(fake_bool, conjunction>); VERIFY_BASE_CHARACTERISTIC_V(fake_bool, conjunction, fake_bool>); VERIFY_BASE_CHARACTERISTIC_V(fake_bool, conjunction, fake_bool, fake_bool>); @@ -530,7 +530,7 @@ VERIFY_BASE_CHARACTERISTIC(is_void, disjunction, void>); VERIFY_BASE_CHARACTERISTIC(is_void, disjunction, is_void, void>); VERIFY_BASE_CHARACTERISTIC(is_void, disjunction, void, void>); VERIFY_BASE_CHARACTERISTIC(is_void, disjunction, void, void, void>); -// non integral_constant family +// non-integral_constant family VERIFY_BASE_CHARACTERISTIC_V(fake_bool, disjunction>); VERIFY_BASE_CHARACTERISTIC_V(fake_bool, disjunction, fake_bool>); VERIFY_BASE_CHARACTERISTIC_V(fake_bool, disjunction, fake_bool, fake_bool>); diff --git a/tests/std/tests/VSO_0180469_ptr_cat/test.compile.pass.cpp b/tests/std/tests/VSO_0180469_ptr_cat/test.compile.pass.cpp index 993ac08ecaf..8d7c7ea08e8 100644 --- a/tests/std/tests/VSO_0180469_ptr_cat/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0180469_ptr_cat/test.compile.pass.cpp @@ -334,7 +334,7 @@ void test_case_Equal_memcmp_is_safe() { // equal_to< some other T > should explode STATIC_ASSERT(_Equal_memcmp_is_safe>> == false); - // Non equal_to comparison functions should explode + // Non-equal_to comparison functions should explode auto lambda = [](Elem1*, Elem2*) { return false; }; STATIC_ASSERT(_Equal_memcmp_is_safe == false); // equal_to should not explode diff --git a/tests/tr1/tests/filesystem1/test.cpp b/tests/tr1/tests/filesystem1/test.cpp index 5851d74ef74..6972334c1ff 100644 --- a/tests/tr1/tests/filesystem1/test.cpp +++ b/tests/tr1/tests/filesystem1/test.cpp @@ -19,13 +19,6 @@ #define GAMMA16 01623 #define GAMMA8 "\316\223" -#ifdef _HAS_WINDOWS_FILESYSTEM -#elif defined(_WIN32) -#define _HAS_WINDOWS_FILESYSTEM 1 -#else // defined(_WIN32) -#define _HAS_WINDOWS_FILESYSTEM 0 -#endif // defined(_WIN32) - #define ALT(x, y) y #define NEVER_HAS_ROOT_NAME false #define ROOT_NAME "c:"