diff --git a/.clang-format b/.clang-format index 5ea2651baa0..1eab9190596 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# https://releases.llvm.org/10.0.0/tools/clang/docs/ClangFormatStyleOptions.html +# https://releases.llvm.org/11.0.0/tools/clang/docs/ClangFormatStyleOptions.html --- # Language: Cpp @@ -14,15 +14,18 @@ AlignAfterOpenBracket: DontAlign AlignConsecutiveMacros: true # AlignConsecutiveAssignments: false AlignConsecutiveAssignments: true +# AlignConsecutiveBitFields: false # AlignConsecutiveDeclarations: false # AlignEscapedNewlines: Right AlignEscapedNewlines: Left -# AlignOperands: true +# AlignOperands: Align +AlignOperands: AlignAfterOperator # AlignTrailingComments: true AlignTrailingComments: false # AllowAllArgumentsOnNextLine: true # AllowAllConstructorInitializersOnNextLine: true # AllowAllParametersOfDeclarationOnNextLine: true +# AllowShortEnumsOnASingleLine: true # AllowShortBlocksOnASingleLine: Never # AllowShortCaseLabelsOnASingleLine: false # AllowShortFunctionsOnASingleLine: All @@ -40,7 +43,7 @@ AlwaysBreakTemplateDeclarations: Yes # BraceWrapping: # AfterCaseLabel: false # AfterClass: false -# AfterControlStatement: false +# AfterControlStatement: Never # AfterEnum: false # AfterFunction: false # AfterNamespace: false @@ -50,6 +53,8 @@ AlwaysBreakTemplateDeclarations: Yes # AfterExternBlock: false # BeforeCatch: false # BeforeElse: false +# BeforeLambdaBody: false +# BeforeWhile: false # IndentBraces: false # SplitEmptyFunction: true # SplitEmptyRecord: true @@ -112,12 +117,16 @@ IncludeCategories: # IncludeIsMainRegex: '(Test)?$' # IncludeIsMainSourceRegex: '' # IndentCaseLabels: false +# IndentCaseBlocks: false +IndentCaseBlocks: true # IndentGotoLabels: true # IndentPPDirectives: None +# IndentExternBlock: AfterExternBlock # IndentWidth: 2 IndentWidth: 4 # IndentWrappedFunctionNames: false IndentWrappedFunctionNames: true +# InsertTrailingCommas: None # JavaScriptQuotes: Leave # JavaScriptWrapImports: true # KeepEmptyLinesAtTheStartOfBlocks: true @@ -130,6 +139,7 @@ MaxEmptyLinesToKeep: 2 NamespaceIndentation: All # ObjCBinPackProtocolList: Auto # ObjCBlockIndentWidth: 2 +# ObjCBreakBeforeNestedBlockParam: true # ObjCSpaceAfterProperty: false # ObjCSpaceBeforeProtocolList: true # PenaltyBreakAssignment: 2 @@ -184,4 +194,8 @@ StatementMacros: # UseCRLF: false UseCRLF: true # UseTab: Never +# WhitespaceSensitiveMacros: +# - STRINGIZE +# - PP_STRINGIZE +# - BOOST_PP_STRINGIZE ... diff --git a/CMakeLists.txt b/CMakeLists.txt index a96985b708d..1e712f36ad8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(msvc_standard_libraries LANGUAGES CXX) find_package(Boost REQUIRED) -set(VCLIBS_MIN_BOOST_VERSION 1.73.0) +set(VCLIBS_MIN_BOOST_VERSION 1.74.0) if("${Boost_VERSION}" VERSION_LESS "${VCLIBS_MIN_BOOST_VERSION}") message(FATAL_ERROR "Detected Boost version is too old (older than ${VCLIBS_MIN_BOOST_VERSION}).") endif() diff --git a/README.md b/README.md index 8cf9388913d..570e9cedcf9 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to acquire this dependency. -1. Install Visual Studio 2019 16.9 Preview 1 or later. +1. Install Visual Studio 2019 16.9 Preview 2 or later. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. * Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later. @@ -158,7 +158,7 @@ acquire this dependency. # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2019 16.9 Preview 1 or later. +1. Install Visual Studio 2019 16.9 Preview 2 or later. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. * Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later. diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index d09d0e6db72..ba9e940c575 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -248,8 +248,8 @@ Function InstallWindowsDriverKit { [string]$installerPath = Get-TempFilePath -Extension 'exe' curl.exe -L -o $installerPath -s -S $Url Write-Host 'Installing the Windows Driver Kit...' - $proc = Start-Process -FilePath $installerPath -ArgumentList ` - @('/quiet', '/features', 'OptionId.WindowsDriverKitComplete') -Wait -PassThru + $proc = Start-Process -FilePath cmd.exe -ArgumentList ` + @('/c', 'start', '/wait', $installerPath, '/quiet', '/features', '+') -Wait -PassThru $exitCode = $proc.ExitCode if ($exitCode -eq 0) { Write-Host 'Installation successful!' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8530fa6b2ef..19d66b1622c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ variables: tmpDir: 'D:\Temp' -pool: 'StlBuild-2020-11-10' +pool: 'StlBuild-2020-12-08' stages: - stage: Code_Format diff --git a/stl/inc/any b/stl/inc/any index 326414d9840..4e62d1b618d 100644 --- a/stl/inc/any +++ b/stl/inc/any @@ -47,13 +47,13 @@ inline constexpr size_t _Any_trivial_space_size = (_Small_object_num_ptrs - 1) * template inline constexpr bool _Any_is_trivial = alignof(_Ty) <= alignof(max_align_t) - && is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size; + && is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size; inline constexpr size_t _Any_small_space_size = (_Small_object_num_ptrs - 2) * sizeof(void*); template inline constexpr bool _Any_is_small = alignof(_Ty) <= alignof(max_align_t) - && is_nothrow_move_constructible_v<_Ty> && sizeof(_Ty) <= _Any_small_space_size; + && is_nothrow_move_constructible_v<_Ty> && sizeof(_Ty) <= _Any_small_space_size; enum class _Any_representation : uintptr_t { _Trivial, _Big, _Small }; diff --git a/stl/inc/atomic b/stl/inc/atomic index 85c784d0b7c..a13b177103b 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -330,15 +330,14 @@ struct _Atomic_padded { // STRUCT TEMPLATE _Atomic_storage_traits template struct _Atomic_storage_traits { // properties for how _Ty is stored in an atomic - static constexpr size_t _Storage_size = - sizeof(_Ty) == 1 ? 1 - : sizeof(_Ty) == 2 ? 2 - : sizeof(_Ty) <= 4 ? 4 - : sizeof(_Ty) <= 8 ? 8 + static constexpr size_t _Storage_size = sizeof(_Ty) == 1 ? 1 + : sizeof(_Ty) == 2 ? 2 + : sizeof(_Ty) <= 4 ? 4 + : sizeof(_Ty) <= 8 ? 8 #if defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM64EC) - : sizeof(_Ty) <= 16 ? 16 + : sizeof(_Ty) <= 16 ? 16 #endif // 64 bits - : sizeof(_Ty); + : sizeof(_Ty); static constexpr size_t _Padding_size = _Storage_size - sizeof(_Ty); static constexpr bool _Uses_padding = _Padding_size != 0; diff --git a/stl/inc/bit b/stl/inc/bit index 2bdeec948fa..d933364942c 100644 --- a/stl/inc/bit +++ b/stl/inc/bit @@ -187,7 +187,7 @@ _NODISCARD int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept { template _NODISCARD int _Checked_x86_x64_popcount(const _Ty _Val) noexcept { - constexpr int _Digits = numeric_limits<_Ty>::digits; + constexpr int _Digits = numeric_limits<_Ty>::digits; #ifndef __AVX__ const bool _Definitely_have_popcnt = __isa_available >= __ISA_AVAILABLE_SSE42; if (!_Definitely_have_popcnt) { diff --git a/stl/inc/charconv b/stl/inc/charconv index 9994d42f528..20d8342c41b 100644 --- a/stl/inc/charconv +++ b/stl/inc/charconv @@ -62,34 +62,35 @@ _NODISCARD to_chars_result _Integer_to_chars( char* _RNext = _Buff_end; switch (_Base) { - case 10: { // Derived from _UIntegral_to_buff() - // Performance note: Ryu's digit table should be faster here. - constexpr bool _Use_chunks = sizeof(_Unsigned) > sizeof(size_t); - - if constexpr (_Use_chunks) { // For 64-bit numbers on 32-bit platforms, work in chunks to avoid 64-bit - // divisions. - while (_Value > 0xFFFF'FFFFU) { - // Performance note: Ryu's division workaround would be faster here. - unsigned long _Chunk = static_cast(_Value % 1'000'000'000); - _Value = static_cast<_Unsigned>(_Value / 1'000'000'000); - - for (int _Idx = 0; _Idx != 9; ++_Idx) { - *--_RNext = static_cast('0' + _Chunk % 10); - _Chunk /= 10; + case 10: + { // Derived from _UIntegral_to_buff() + // Performance note: Ryu's digit table should be faster here. + constexpr bool _Use_chunks = sizeof(_Unsigned) > sizeof(size_t); + + if constexpr (_Use_chunks) { // For 64-bit numbers on 32-bit platforms, work in chunks to avoid 64-bit + // divisions. + while (_Value > 0xFFFF'FFFFU) { + // Performance note: Ryu's division workaround would be faster here. + unsigned long _Chunk = static_cast(_Value % 1'000'000'000); + _Value = static_cast<_Unsigned>(_Value / 1'000'000'000); + + for (int _Idx = 0; _Idx != 9; ++_Idx) { + *--_RNext = static_cast('0' + _Chunk % 10); + _Chunk /= 10; + } } } - } - using _Truncated = conditional_t<_Use_chunks, unsigned long, _Unsigned>; + using _Truncated = conditional_t<_Use_chunks, unsigned long, _Unsigned>; - _Truncated _Trunc = static_cast<_Truncated>(_Value); + _Truncated _Trunc = static_cast<_Truncated>(_Value); - do { - *--_RNext = static_cast('0' + _Trunc % 10); - _Trunc /= 10; - } while (_Trunc != 0); - break; - } + do { + *--_RNext = static_cast('0' + _Trunc % 10); + _Trunc /= 10; + } while (_Trunc != 0); + break; + } case 2: do { @@ -406,8 +407,8 @@ struct _Big_integer_flt { } static constexpr uint32_t _Maximum_bits = 1074 // 1074 bits required to represent 2^1074 - + 2552 // ceil(log2(10^768)) - + 54; // shift space + + 2552 // ceil(log2(10^768)) + + 54; // shift space static constexpr uint32_t _Element_bits = 32; @@ -1022,7 +1023,7 @@ _NODISCARD inline uint64_t _Divide(_Big_integer_flt& _Numerator, const _Big_inte uint32_t _U_carry = 0; for (uint32_t _Iu2 = 0; _Iu2 < _Cu_den; ++_Iu2) { const uint64_t _Sum = static_cast(_Numerator._Mydata[_Iu + _Iu2]) - + static_cast(_Denominator._Mydata[_Iu2]) + _U_carry; + + static_cast(_Denominator._Mydata[_Iu2]) + _U_carry; _Numerator._Mydata[_Iu + _Iu2] = static_cast(_Sum); _U_carry = static_cast(_Sum >> 32); @@ -1376,7 +1377,7 @@ _NODISCARD errc _Assemble_floating_point_value_from_big_integer_flt(const _Big_i const int32_t _Exponent = static_cast(_Base_exponent + _Bottom_element_index * 32); const uint64_t _Mantissa = _Integer_value._Mydata[_Bottom_element_index] - + (static_cast(_Integer_value._Mydata[_Middle_element_index]) << 32); + + (static_cast(_Integer_value._Mydata[_Middle_element_index]) << 32); bool _Has_zero_tail = !_Has_nonzero_fractional_part; for (uint32_t _Ix = 0; _Has_zero_tail && _Ix != _Bottom_element_index; ++_Ix) { @@ -1527,8 +1528,8 @@ _NODISCARD errc _Convert_decimal_string_to_floating_type( const uint32_t _Fractional_denominator_bits = _Bit_scan_reverse(_Fractional_denominator); const uint32_t _Fractional_shift = _Fractional_denominator_bits > _Fractional_numerator_bits - ? _Fractional_denominator_bits - _Fractional_numerator_bits - : 0; + ? _Fractional_denominator_bits - _Fractional_numerator_bits + : 0; if (_Fractional_shift > 0) { [[maybe_unused]] const bool _Shift_success1 = @@ -1595,8 +1596,8 @@ _NODISCARD errc _Convert_decimal_string_to_floating_type( // Then, in both cases, we subtract an additional one from the exponent, // to account for the fact that we've generated an extra bit of precision, for use in rounding. const int32_t _Final_exponent = _Integer_bits_of_precision > 0 - ? static_cast(_Integer_bits_of_precision - 2) - : -static_cast(_Fractional_exponent) - 1; + ? static_cast(_Integer_bits_of_precision - 2) + : -static_cast(_Fractional_exponent) - 1; return _Assemble_floating_point_value( _Complete_mantissa, _Final_exponent, _Data._Myis_negative, _Has_zero_tail, _Result); @@ -2143,10 +2144,10 @@ _NODISCARD to_chars_result _Floating_to_chars_hex_precision( _Buffer_size -= _Precision; const int32_t _Length_excluding_precision = 1 // leading hexit - + static_cast(_Precision > 0) // possible decimal point - // excluding `+ _Precision`, hexits after decimal point - + 2 // "p+" or "p-" - + _Exponent_length; // exponent + + static_cast(_Precision > 0) // possible decimal point + // excluding `+ _Precision`, hexits after decimal point + + 2 // "p+" or "p-" + + _Exponent_length; // exponent if (_Buffer_size < _Length_excluding_precision) { return {_Last, errc::value_too_large}; diff --git a/stl/inc/compare b/stl/inc/compare index a7da3873da2..46bdfd0371f 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -436,10 +436,9 @@ namespace _Strong_order { }; } // namespace _Strong_order -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Strong_order::_Cpo strong_order; } -using namespace _Cpos; // CUSTOMIZATION POINT OBJECT weak_order namespace _Weak_order { @@ -558,10 +557,9 @@ namespace _Weak_order { }; } // namespace _Weak_order -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Weak_order::_Cpo weak_order; } -using namespace _Cpos; // CUSTOMIZATION POINT OBJECT partial_order namespace _Partial_order { @@ -637,10 +635,9 @@ namespace _Partial_order { }; } // namespace _Partial_order -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Partial_order::_Cpo partial_order; } -using namespace _Cpos; // clang-format off template @@ -669,10 +666,9 @@ namespace _Compare_strong_order_fallback { return {_St::_Strong, noexcept(_STD strong_order(_STD declval<_Ty1&>(), _STD declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt<_Ty1, _Ty2>) { return {_St::_Fallback, - noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() - ? strong_ordering::equal - : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() ? strong_ordering::less - : strong_ordering::greater)}; + noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() ? strong_ordering::equal + : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() ? strong_ordering::less + : strong_ordering::greater)}; } else { return {_St::_None}; } @@ -693,7 +689,8 @@ namespace _Compare_strong_order_fallback { return _STD strong_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { return _Left == _Right ? strong_ordering::equal - : _Left < _Right ? strong_ordering::less : strong_ordering::greater; + : _Left < _Right ? strong_ordering::less + : strong_ordering::greater; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } @@ -701,10 +698,9 @@ namespace _Compare_strong_order_fallback { }; } // namespace _Compare_strong_order_fallback -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Compare_strong_order_fallback::_Cpo compare_strong_order_fallback; } -using namespace _Cpos; // CUSTOMIZATION POINT OBJECT compare_weak_order_fallback namespace _Compare_weak_order_fallback { @@ -724,11 +720,10 @@ namespace _Compare_weak_order_fallback { } else if constexpr (_Can_weak_order<_Ty1, _Ty2>) { return {_St::_Weak, noexcept(_STD weak_order(_STD declval<_Ty1&>(), _STD declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt<_Ty1, _Ty2>) { - return {_St::_Fallback, - noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() - ? weak_ordering::equivalent - : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() ? weak_ordering::less - : weak_ordering::greater)}; + return { + _St::_Fallback, noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() ? weak_ordering::equivalent + : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() ? weak_ordering::less + : weak_ordering::greater)}; } else { return {_St::_None}; } @@ -749,7 +744,8 @@ namespace _Compare_weak_order_fallback { return _STD weak_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { return _Left == _Right ? weak_ordering::equivalent - : _Left < _Right ? weak_ordering::less : weak_ordering::greater; + : _Left < _Right ? weak_ordering::less + : weak_ordering::greater; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } @@ -757,10 +753,9 @@ namespace _Compare_weak_order_fallback { }; } // namespace _Compare_weak_order_fallback -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Compare_weak_order_fallback::_Cpo compare_weak_order_fallback; } -using namespace _Cpos; // CUSTOMIZATION POINT OBJECT compare_partial_order_fallback namespace _Compare_partial_order_fallback { @@ -790,12 +785,10 @@ namespace _Compare_partial_order_fallback { return {_St::_Partial, noexcept(_STD partial_order(_STD declval<_Ty1&>(), _STD declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt_twice<_Ty1, _Ty2>) { return {_St::_Fallback, - noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() - ? partial_ordering::equivalent - : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() - ? partial_ordering::less - : _STD declval<_Ty2&>() < _STD declval<_Ty1&>() ? partial_ordering::greater - : partial_ordering::unordered)}; + noexcept(_STD declval<_Ty1&>() == _STD declval<_Ty2&>() ? partial_ordering::equivalent + : _STD declval<_Ty1&>() < _STD declval<_Ty2&>() ? partial_ordering::less + : _STD declval<_Ty2&>() < _STD declval<_Ty1&>() ? partial_ordering::greater + : partial_ordering::unordered)}; } else { return {_St::_None}; } @@ -815,10 +808,10 @@ namespace _Compare_partial_order_fallback { if constexpr (_Strat == _St::_Partial) { return _STD partial_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { - return _Left == _Right - ? partial_ordering::equivalent - : _Left < _Right ? partial_ordering::less - : _Right < _Left ? partial_ordering::greater : partial_ordering::unordered; + return _Left == _Right ? partial_ordering::equivalent + : _Left < _Right ? partial_ordering::less + : _Right < _Left ? partial_ordering::greater + : partial_ordering::unordered; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } @@ -826,10 +819,9 @@ namespace _Compare_partial_order_fallback { }; } // namespace _Compare_partial_order_fallback -namespace _Cpos { +inline namespace _Cpos { inline constexpr _Compare_partial_order_fallback::_Cpo compare_partial_order_fallback; } -using namespace _Cpos; #endif // __cpp_lib_concepts _STD_END diff --git a/stl/inc/complex b/stl/inc/complex index 14ee315d8bd..e0aff1ed4ee 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -718,7 +718,7 @@ public: _Ans = log1p(_Left + _Left * _Left / (1 + sqrt(_Left * _Left + 1))); } else { _Ans = log(_Left) // _Left big, compute log(_Left+_Left) - + static_cast<_Ty>(0.69314718055994530941723212145817658L); + + static_cast<_Ty>(0.69314718055994530941723212145817658L); } return _Copysign(_Ans, _Old_left); diff --git a/stl/inc/concepts b/stl/inc/concepts index 0f311a9dbd6..a9e548d2fd4 100644 --- a/stl/inc/concepts +++ b/stl/inc/concepts @@ -169,10 +169,9 @@ namespace ranges { }; } // namespace _Swap - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Swap::_Cpo swap; } - using namespace _Cpos; } // namespace ranges // CONCEPT swappable diff --git a/stl/inc/cvt/wbuffer b/stl/inc/cvt/wbuffer index e51d334a803..8235088764c 100644 --- a/stl/inc/cvt/wbuffer +++ b/stl/inc/cvt/wbuffer @@ -85,20 +85,21 @@ namespace stdext { _Status = _Unused; // homed successfully case _Codecvt::partial: // fall through - { // put any generated bytes - ptrdiff_t _Count = _Dest - _Buf; - if (0 < _Count - && _Byte_traits::eq_int_type(_Byte_traits::eof(), - static_cast(_Mystrbuf->sputn(_Buf, static_cast<_STD streamsize>(_Count))))) { - return; // write failed - } + { // put any generated bytes + ptrdiff_t _Count = _Dest - _Buf; + if (0 < _Count + && _Byte_traits::eq_int_type(_Byte_traits::eof(), + static_cast( + _Mystrbuf->sputn(_Buf, static_cast<_STD streamsize>(_Count))))) { + return; // write failed + } - if (_Status == _Wrote && _Count == 0) { - _Str.append(_STRING_INC, '\0'); // try with more space - } + if (_Status == _Wrote && _Count == 0) { + _Str.append(_STRING_INC, '\0'); // try with more space + } - break; - } + break; + } case _Codecvt::noconv: return; // nothing to do @@ -146,28 +147,29 @@ namespace stdext { switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Buf, _Buf + _Str.size(), _Dest)) { // test result of converting one element case _Codecvt::partial: - case _Codecvt::ok: { // converted something, try to put it out - ptrdiff_t _Count = _Dest - _Buf; - if (0 < _Count - && _Byte_traits::eq_int_type(_Byte_traits::eof(), - static_cast( - _Mystrbuf->sputn(_Buf, static_cast<_STD streamsize>(_Count))))) { - return _Traits::eof(); // write failed - } - - if (_Src != &_Ch) { - return _Meta; // converted whole element - } + case _Codecvt::ok: + { // converted something, try to put it out + ptrdiff_t _Count = _Dest - _Buf; + if (0 < _Count + && _Byte_traits::eq_int_type(_Byte_traits::eof(), + static_cast( + _Mystrbuf->sputn(_Buf, static_cast<_STD streamsize>(_Count))))) { + return _Traits::eof(); // write failed + } - if (0 >= _Count) { - if (_Str.size() >= 4 * _STRING_INC) { - return _Traits::eof(); // conversion failed + if (_Src != &_Ch) { + return _Meta; // converted whole element } - _Str.append(_STRING_INC, '\0'); // try with more space + if (0 >= _Count) { + if (_Str.size() >= 4 * _STRING_INC) { + return _Traits::eof(); // conversion failed + } + + _Str.append(_STRING_INC, '\0'); // try with more space + } + break; } - break; - } case _Codecvt::noconv: if (_Traits::eq_int_type(_Traits::eof(), diff --git a/stl/inc/deque b/stl/inc/deque index 829ab6709a7..bfc304ba476 100644 --- a/stl/inc/deque +++ b/stl/inc/deque @@ -539,8 +539,11 @@ private: static constexpr size_t _Bytes = sizeof(value_type); public: - static constexpr int _Block_size = - _Bytes <= 1 ? 16 : _Bytes <= 2 ? 8 : _Bytes <= 4 ? 4 : _Bytes <= 8 ? 2 : 1; // elements per block (a power of 2) + static constexpr int _Block_size = _Bytes <= 1 ? 16 + : _Bytes <= 2 ? 8 + : _Bytes <= 4 ? 4 + : _Bytes <= 8 ? 2 + : 1; // elements per block (a power of 2) _Deque_val() noexcept : _Map(), _Mapsize(0), _Myoff(0), _Mysize(0) {} @@ -1576,7 +1579,7 @@ void swap(deque<_Ty, _Alloc>& _Left, deque<_Ty, _Alloc>& _Right) noexcept /* str template _NODISCARD bool operator==(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } template diff --git a/stl/inc/execution b/stl/inc/execution index 6f8efed4843..b1d73575657 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -2837,10 +2837,10 @@ inline size_t _Get_stable_sort_tree_height(const size_t _Count, const size_t _Hw // go to the next smaller power of 2 const auto _Count_max_tree_height = _Log_count_max_chunks & ~static_cast(1); - const auto _Ideal_chunks = _Hw_threads * _Oversubscription_multiplier; - const size_t _Log_ideal_chunks = _Floor_of_log_2(_Ideal_chunks); + const auto _Ideal_chunks = _Hw_threads * _Oversubscription_multiplier; + const size_t _Log_ideal_chunks = _Floor_of_log_2(_Ideal_chunks); #ifdef _WIN64 - const size_t _Max_tree_height = 62; // to avoid ptrdiff_t overflow + const size_t _Max_tree_height = 62; // to avoid ptrdiff_t overflow #else // ^^^ _WIN64 ^^^ // vvv !_WIN64 vvv const size_t _Max_tree_height = 30; #endif // _WIN64 @@ -3262,7 +3262,7 @@ _NODISCARD bool is_partitioned(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, _Static_partitioned_is_partitioned _Operation{_Hw_threads, _Count, _UFirst, _Pass_fn(_Pred)}; _Run_chunked_parallel_work(_Hw_threads, _Operation); return _Operation._Rightmost_true.load(memory_order_relaxed) - <= _Operation._Leftmost_false.load(memory_order_relaxed); + <= _Operation._Leftmost_false.load(memory_order_relaxed); _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below _CATCH_END @@ -3519,12 +3519,11 @@ struct _Static_partitioned_partition2 { const auto _Range = _Basis._Get_chunk(_Key); if (_Merge_index == 0 || _Chunk_locals[_Merge_index - 1]._State.load() == _Chunk_state::_Done) { // no predecessor, so run serial algorithm directly into results - const auto _Chunk_results = - _Merge_index == 0 || _Results == _Range._First - ? _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred) - : _Partition_swap_backward(_Range._First, _Range._Last, _Results, _Pred); - _Results = _Chunk_results.first; - _Chunk_data._Chunk_trues = _Chunk_results.second; + const auto _Chunk_results = _Merge_index == 0 || _Results == _Range._First + ? _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred) + : _Partition_swap_backward(_Range._First, _Range._Last, _Results, _Pred); + _Results = _Chunk_results.first; + _Chunk_data._Chunk_trues = _Chunk_results.second; _Results_falses += _Key._Size - _Chunk_results.second; _Chunk_data._State.store(_Chunk_state::_Done); ++_Merge_index; // this chunk is already merged diff --git a/stl/inc/experimental/filesystem b/stl/inc/experimental/filesystem index fbb4f3b403f..58d874130b1 100644 --- a/stl/inc/experimental/filesystem +++ b/stl/inc/experimental/filesystem @@ -1152,10 +1152,10 @@ public: string_type _Str = filename().native(); const size_t _Idx = _Str.rfind(_FS_PERIOD); return _Idx == string_type::npos // no . - || _Str.size() == 1 // only . - || (_Str.size() == 2 && _Str[0] == _FS_PERIOD && _Str[1] == _FS_PERIOD) // only .. - ? path{} - : path(_Str.substr(_Idx)); + || _Str.size() == 1 // only . + || (_Str.size() == 2 && _Str[0] == _FS_PERIOD && _Str[1] == _FS_PERIOD) // only .. + ? path{} + : path(_Str.substr(_Idx)); } _NODISCARD bool empty() const noexcept { @@ -1406,7 +1406,7 @@ public: _Mysymstat = _Symstatarg; } - operator const _FSPFX path &() const noexcept { + operator const _FSPFX path&() const noexcept { return _Mypval; } diff --git a/stl/inc/filesystem b/stl/inc/filesystem index 52e41e51fec..0f9bec6e02c 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -2093,7 +2093,7 @@ namespace filesystem { // [fs.op.status]/Throws: result values of file_status(file_type::not_found) and // file_status(file_type::unknown) are not considered failures and do not cause an exception to be thrown. return _Error != __std_win_error::_Success && _Status.type() != file_type::not_found - && _Status.type() != file_type::unknown; + && _Status.type() != file_type::unknown; } }; @@ -2193,7 +2193,7 @@ namespace filesystem { return _Path; } - operator const filesystem::path &() const noexcept { + operator const filesystem::path&() const noexcept { return _Path; } @@ -2269,8 +2269,8 @@ namespace filesystem { _NODISCARD bool _Is_symlink_or_junction() const noexcept { return _Has_cached_attribute(__std_fs_file_attr::_Reparse_point) - && (_Cached_data._Reparse_point_tag == __std_fs_reparse_tag::_Symlink - || _Cached_data._Reparse_point_tag == __std_fs_reparse_tag::_Mount_point); + && (_Cached_data._Reparse_point_tag == __std_fs_reparse_tag::_Symlink + || _Cached_data._Reparse_point_tag == __std_fs_reparse_tag::_Mount_point); } _NODISCARD bool is_symlink() const { @@ -2476,7 +2476,7 @@ namespace filesystem { _Cached_data._Available = __std_fs_stats_flags::_Attributes | __std_fs_stats_flags::_Reparse_tag; if (!_Bitmask_includes(_Data._Attributes, __std_fs_file_attr::_Reparse_point)) { _Cached_data._File_size = (static_cast(_Data._File_size_high) << 32) - + static_cast(_Data._File_size_low); + + static_cast(_Data._File_size_low); _CSTD memcpy( &_Cached_data._Last_write_time, &_Data._Last_write_time, sizeof(_Cached_data._Last_write_time)); _Cached_data._Available |= __std_fs_stats_flags::_File_size | __std_fs_stats_flags::_Last_write_time; @@ -3504,7 +3504,7 @@ namespace filesystem { _NODISCARD inline bool is_empty(const path& _Path, error_code& _Ec) { // test whether _Path refers to a zero sized file or empty directory constexpr auto _Flags = __std_fs_stats_flags::_Attributes | __std_fs_stats_flags::_File_size - | __std_fs_stats_flags::_Follow_symlinks; + | __std_fs_stats_flags::_Follow_symlinks; __std_fs_stats _Stats; const auto _Error = __std_fs_get_stats(_Path.c_str(), &_Stats, _Flags); _Ec = _Make_ec(_Error); @@ -4203,7 +4203,7 @@ namespace filesystem { // Other parts of LWG-3057 remain under discussion in the committee and are not yet implemented. // (In particular, changes to existing destination flags, and error handling). const bool _Flink = (_Options & (copy_options::skip_symlinks | copy_options::copy_symlinks)) - != copy_options::none; // create_symlinks intentionally removed by LWG-3057 + != copy_options::none; // create_symlinks intentionally removed by LWG-3057 const auto _Fstat = _From._Get_any_status(_Flink ? _Symlink_status_stats_flags : _Status_stats_flags); if (_Fstat._Error != __std_win_error::_Success) { // report an error if exists(f) is false _Ec = _Make_ec(_Fstat._Error); diff --git a/stl/inc/fstream b/stl/inc/fstream index 887a30dd8b4..6e7482640ca 100644 --- a/stl/inc/fstream +++ b/stl/inc/fstream @@ -431,19 +431,20 @@ protected: switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Str, _Str + _Codecvt_temp_buf, _Dest)) { // test result of converting one element case codecvt_base::partial: - case codecvt_base::ok: { // converted something, try to put it out - const auto _Count = static_cast(_Dest - _Str); - if (0 < _Count && _Count != static_cast(_CSTD fwrite(_Str, 1, _Count, _Myfile))) { - return _Traits::eof(); // write failed - } + case codecvt_base::ok: + { // converted something, try to put it out + const auto _Count = static_cast(_Dest - _Str); + if (0 < _Count && _Count != static_cast(_CSTD fwrite(_Str, 1, _Count, _Myfile))) { + return _Traits::eof(); // write failed + } - _Wrotesome = true; // write succeeded - if (_Src != &_Ch) { - return _Meta; // converted whole element - } + _Wrotesome = true; // write succeeded + if (_Src != &_Ch) { + return _Meta; // converted whole element + } - return _Traits::eof(); // conversion failed - } + return _Traits::eof(); // conversion failed + } case codecvt_base::noconv: // no conversion, put as is @@ -735,14 +736,14 @@ protected: _Wrotesome = false; // homed successfully case codecvt_base::partial: // fall through - { // put any generated bytes - const auto _Count = static_cast(_Dest - _Str); - if (0 < _Count && _Count != static_cast(_CSTD fwrite(_Str, 1, _Count, _Myfile))) { - return false; // write failed - } + { // put any generated bytes + const auto _Count = static_cast(_Dest - _Str); + if (0 < _Count && _Count != static_cast(_CSTD fwrite(_Str, 1, _Count, _Myfile))) { + return false; // write failed + } - return !_Wrotesome; - } + return !_Wrotesome; + } case codecvt_base::noconv: _Wrotesome = false; // homed successfully diff --git a/stl/inc/functional b/stl/inc/functional index 755fbb39a07..1d8ad65b20e 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -829,7 +829,7 @@ constexpr size_t _Space_size = (_Small_object_num_ptrs - 1) * sizeof(void*); template // determine whether _Impl must be dynamically allocated _INLINE_VAR constexpr bool _Is_large = sizeof(_Impl) > _Space_size || alignof(_Impl) > alignof(max_align_t) - || !_Impl::_Nothrow_move::value; + || !_Impl::_Nothrow_move::value; #if _HAS_FUNCTION_ALLOCATOR_SUPPORT // CLASS TEMPLATE _Func_impl diff --git a/stl/inc/iterator b/stl/inc/iterator index 39452a5bd75..ca74d58917c 100644 --- a/stl/inc/iterator +++ b/stl/inc/iterator @@ -594,12 +594,10 @@ public: } } -#if 0 // TRANSITION, VSO-1225825 // clang-format off _Variantish(const _Variantish&) requires is_trivially_copy_constructible_v<_It> && is_trivially_copy_constructible_v<_Se> = default; // clang-format on -#endif // TRANSITION, VSO-1225825 _Variantish(const _Variantish& _That) noexcept( is_nothrow_copy_constructible_v<_It>&& is_nothrow_copy_constructible_v<_Se>) @@ -616,12 +614,10 @@ public: } } -#if 0 // TRANSITION, VSO-1225825 // clang-format off _Variantish(_Variantish&&) requires is_trivially_move_constructible_v<_It> && is_trivially_move_constructible_v<_Se> = default; // clang-format on -#endif // TRANSITION, VSO-1225825 _Variantish(_Variantish&& _That) noexcept( is_nothrow_move_constructible_v<_It>&& is_nothrow_move_constructible_v<_Se>) @@ -638,17 +634,14 @@ public: } } -#if 0 // TRANSITION, VSO-1225825 // clang-format off ~_Variantish() requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> = default; // clang-format on -#endif // TRANSITION, VSO-1225825 ~_Variantish() { _Raw_clear(); } -#if 0 // TRANSITION, VSO-1225825 // clang-format off _Variantish& operator=(const _Variantish&) requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> @@ -657,7 +650,6 @@ public: && is_trivially_copy_assignable_v<_It> && is_trivially_copy_assignable_v<_Se> = default; // clang-format on -#endif // TRANSITION, VSO-1225825 _Variantish& operator=(const _Variantish& _That) noexcept( is_nothrow_copy_constructible_v<_It>&& is_nothrow_copy_constructible_v<_Se>&& @@ -695,7 +687,6 @@ public: return *this; } -#if 0 // TRANSITION, VSO-1225825 // clang-format off _Variantish& operator=(_Variantish&&) requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> @@ -704,7 +695,6 @@ public: && is_trivially_move_assignable_v<_It> && is_trivially_move_assignable_v<_Se> = default; // clang-format on -#endif // TRANSITION, VSO-1225825 _Variantish& operator=(_Variantish&& _That) noexcept( is_nothrow_move_constructible_v<_It>&& is_nothrow_move_constructible_v<_Se>&& diff --git a/stl/inc/map b/stl/inc/map index f33f3df84f3..078249a414a 100644 --- a/stl/inc/map +++ b/stl/inc/map @@ -366,7 +366,7 @@ map(initializer_list>, _Alloc) -> map<_Kty, _Ty, less<_Kty>, _Al template _NODISCARD bool operator==(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } template @@ -554,7 +554,7 @@ template _NODISCARD bool operator==( const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } template diff --git a/stl/inc/memory_resource b/stl/inc/memory_resource index bb47641ee87..a97b4c99049 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -344,7 +344,7 @@ namespace pmr { // _Bytes + sizeof(_Oversized_header), which guarantees that the end of the allocated space // is properly aligned for an _Oversized_header. _Bytes = (_Bytes + sizeof(_Oversized_header) + alignof(_Oversized_header) - 1) - & ~(alignof(_Oversized_header) - 1); + & ~(alignof(_Oversized_header) - 1); return true; } @@ -552,7 +552,7 @@ namespace pmr { _Options.largest_required_pool_block = _Largest_required_pool_block_limit; } else { _Options.largest_required_pool_block = static_cast(1) - << _Ceiling_of_log_2(_Options.largest_required_pool_block); + << _Ceiling_of_log_2(_Options.largest_required_pool_block); } } diff --git a/stl/inc/numeric b/stl/inc/numeric index c6f78d947e7..2544c0ecf53 100644 --- a/stl/inc/numeric +++ b/stl/inc/numeric @@ -264,7 +264,7 @@ _CONSTEXPR20 _OutIt partial_sum(const _InIt _First, const _InIt _Last, _OutIt _D #if _HAS_CXX20 _Val = _Reduce_op(_STD move(_Val), *_UFirst); #else // ^^^ _HAS_CXX20 ^^^ // vvv !_HAS_CXX20 vvv - _Val = _Reduce_op(_Val, *_UFirst); + _Val = _Reduce_op(_Val, *_UFirst); #endif // _HAS_CXX20 } } diff --git a/stl/inc/random b/stl/inc/random index 8ce829c3b37..a0a9d74b0de 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -190,8 +190,16 @@ public: for (_Kx = 0; _Kx < _Mx; ++_Kx) { // scramble and add any vector contributions result_type _Rx1 = 1664525 * _Xor27(_UFirst[_Kx % _Nx] ^ _UFirst[(_Kx + _Px) % _Nx] ^ _UFirst[(_Kx - 1) % _Nx]); - result_type _Rx2 = static_cast( - (_Rx1 + (_Kx == 0 ? _Sx : _Kx <= _Sx ? _Kx % _Nx + _Myvec[(_Kx - 1) % _Sx] : _Kx % _Nx)) & _Mask); + + size_t _Off; + if (_Kx == 0) { + _Off = _Sx; + } else if (_Kx <= _Sx) { + _Off = _Kx % _Nx + _Myvec[_Kx - 1]; + } else { + _Off = _Kx % _Nx; + } + result_type _Rx2 = static_cast((_Rx1 + _Off) & _Mask); _UFirst[(_Kx + _Px) % _Nx] = (_UFirst[(_Kx + _Px) % _Nx] + _Rx1) & _Mask; _UFirst[(_Kx + _Qx) % _Nx] = (_UFirst[(_Kx + _Qx) % _Nx] + _Rx2) & _Mask; @@ -4878,7 +4886,7 @@ public: _NODISCARD double _Piece_probability(const size_t _Idx) const { return 0.5 * (this->_Pvec[_Idx] + this->_Pvec[_Idx + 1]) - * static_cast(_Bvec[_Idx + 1] - _Bvec[_Idx]); + * static_cast(_Bvec[_Idx + 1] - _Bvec[_Idx]); } void _Init(bool _Renorm = true) { // initialize diff --git a/stl/inc/ranges b/stl/inc/ranges index e16a71da922..c007010263b 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -16,10 +16,6 @@ #include #include -#if 1 // TRANSITION, VSO-1225825 -#include -#endif // TRANSITION, VSO-1225825 - #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) @@ -245,7 +241,6 @@ namespace ranges { using _Cached_position_t = conditional_t<_Enable, _Cached_position<_Rng, _Derived>, view_interface<_Derived>>; // CLASS TEMPLATE ranges::_Semiregular_box -#if 0 // TRANSITION, VSO-1225825 template <_Copy_constructible_object _Ty> class _Semiregular_box { public: @@ -437,102 +432,6 @@ namespace ranges { private: /* [[no_unique_address]] */ _Ty _Val = _Ty(); }; -#else // ^^^ no workaround / workaround vvv - template - class _Semiregular_box_copy : public optional<_Ty> { - public: - using optional<_Ty>::optional; - - _Semiregular_box_copy() = default; - _Semiregular_box_copy(const _Semiregular_box_copy&) = default; - _Semiregular_box_copy(_Semiregular_box_copy&&) = default; - _Semiregular_box_copy& operator=(_Semiregular_box_copy&&) = default; - - _Semiregular_box_copy& operator=(const _Semiregular_box_copy& _That) noexcept( - is_nothrow_copy_constructible_v<_Ty>) { - if (_STD addressof(_That) != this) { - optional<_Ty>::reset(); - if (_That) { - optional<_Ty>::emplace(*_That); - } - } - - return *this; - } - }; - - template - using _Choose_semiregular_box_copy = - conditional_t, optional<_Ty>, _Semiregular_box_copy<_Ty>>; - - template - class _Semiregular_box_move : public _Choose_semiregular_box_copy<_Ty> { - public: - using _Choose_semiregular_box_copy<_Ty>::_Choose_semiregular_box_copy; - - _Semiregular_box_move() = default; - _Semiregular_box_move(const _Semiregular_box_move&) = default; - _Semiregular_box_move(_Semiregular_box_move&&) = default; - _Semiregular_box_move& operator=(const _Semiregular_box_move&) = default; - - _Semiregular_box_move& operator=(_Semiregular_box_move&& _That) noexcept(is_nothrow_move_constructible_v<_Ty>) { - if (_STD addressof(_That) != this) { - optional<_Ty>::reset(); - if (_That) { - optional<_Ty>::emplace(_STD move(*_That)); - } - } - - return *this; - } - }; - - template - using _Choose_semiregular_box_move = - conditional_t, _Choose_semiregular_box_copy<_Ty>, _Semiregular_box_move<_Ty>>; - - template <_Copy_constructible_object _Ty> - class _Semiregular_box : public _Choose_semiregular_box_move<_Ty> { - public: - constexpr _Semiregular_box() noexcept {} - constexpr _Semiregular_box() noexcept( - is_nothrow_default_constructible_v<_Ty>) requires default_initializable<_Ty> - : _Choose_semiregular_box_move<_Ty>{in_place} {} - - template - constexpr _Semiregular_box(in_place_t, _Types&&... _Args) noexcept( - is_nothrow_constructible_v<_Ty, _Types...>) // strengthened - : _Choose_semiregular_box_move<_Ty>{in_place, _STD forward<_Types>(_Args)...} {} - }; - - // clang-format off - template <_Copy_constructible_object _Ty> - requires default_initializable<_Ty> && copyable<_Ty> - class _Semiregular_box<_Ty> { - // clang-format on - public: - _Semiregular_box() = default; - - template - constexpr _Semiregular_box(in_place_t, _Types&&... _Args) noexcept( - is_nothrow_constructible_v<_Ty, _Types...>) // strengthened - : _Val(_STD forward<_Types>(_Args)...) {} - - constexpr explicit operator bool() const noexcept { - return true; - } - - _NODISCARD constexpr _Ty& operator*() noexcept { - return _Val; - } - _NODISCARD constexpr const _Ty& operator*() const noexcept { - return _Val; - } - - private: - /* [[no_unique_address]] */ _Ty _Val = _Ty(); - }; -#endif // TRANSITION, VSO-1225825 // CLASS TEMPLATE ranges::empty_view // clang-format off @@ -2417,7 +2316,7 @@ namespace ranges { }; template - common_view(_Rng &&) -> common_view>; + common_view(_Rng&&) -> common_view>; namespace views { // VARIABLE views::common @@ -2529,7 +2428,7 @@ namespace ranges { }; template - reverse_view(_Rng &&) -> reverse_view>; + reverse_view(_Rng&&) -> reverse_view>; namespace views { // VARIABLE views::reverse diff --git a/stl/inc/ratio b/stl/inc/ratio index 0a1b09f7619..f8562fb72c7 100644 --- a/stl/inc/ratio +++ b/stl/inc/ratio @@ -230,12 +230,12 @@ constexpr _Big_uint128 _Big_multiply(const uint64_t _Lfactor, constexpr bool _Ratio_less(const int64_t _Nx1, const int64_t _Dx1, const int64_t _Nx2, const int64_t _Dx2) noexcept { if (_Nx1 >= 0 && _Nx2 >= 0) { return _Big_multiply(static_cast(_Nx1), static_cast(_Dx2)) - < _Big_multiply(static_cast(_Nx2), static_cast(_Dx1)); + < _Big_multiply(static_cast(_Nx2), static_cast(_Dx1)); } if (_Nx1 < 0 && _Nx2 < 0) { return _Big_multiply(static_cast(-_Nx2), static_cast(_Dx1)) - < _Big_multiply(static_cast(-_Nx1), static_cast(_Dx2)); + < _Big_multiply(static_cast(-_Nx1), static_cast(_Dx2)); } return _Nx1 < _Nx2; diff --git a/stl/inc/regex b/stl/inc/regex index 1e71c685716..56e10e4a6a4 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -303,7 +303,7 @@ public: return _Getctype()->is(_Fx, _Ch); } else { return _Ch == '_' // assumes L'_' == '_' - || _Getctype()->is(_Ch_alnum, _Ch); + || _Getctype()->is(_Ch_alnum, _Ch); } } @@ -1131,7 +1131,7 @@ _NODISCARD bool operator==(const match_results<_BidIt, _Alloc>& _Left, const mat return false; } else { return _Left.size() == _Right.size() && _Left.prefix() == _Right.prefix() && _Left.suffix() == _Right.suffix() - && _STD equal(_Left.begin(), _Left.end(), _Right.begin()); + && _STD equal(_Left.begin(), _Left.end(), _Right.begin()); } } @@ -2426,7 +2426,7 @@ public: } return _Begin == _Right._Begin && _End == _Right._End && _Flags == _Right._Flags - && _MyVal._At(0) == _Right._MyVal._At(0); + && _MyVal._At(0) == _Right._MyVal._At(0); } _NODISCARD bool operator!=(const regex_iterator& _Right) const { @@ -3408,7 +3408,7 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Better_match() { // check for bet if (_Res._Grp_valid[_Ix] && _Tgt_state._Grp_valid[_Ix]) { if (_Res._Grps[_Ix]._Begin != _Tgt_state._Grps[_Ix]._Begin) { return _STD distance(_Begin, _Res._Grps[_Ix]._Begin) - < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._Begin); + < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._Begin); } if (_Res._Grps[_Ix]._End != _Tgt_state._Grps[_Ix]._End) { @@ -3490,24 +3490,26 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Match_pat(_Node_base* _Nx) { // c break; - case _N_str: { // check for string match - _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); - _It _Res0; - if ((_Res0 = _Compare(_Tgt_state._Cur, _End, _Node->_Data._Str(), - _Node->_Data._Str() + _Node->_Data._Size(), _Traits, _Sflags)) - != _Tgt_state._Cur) { - _Tgt_state._Cur = _Res0; - } else { - _Failed = true; - } + case _N_str: + { // check for string match + _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); + _It _Res0; + if ((_Res0 = _Compare(_Tgt_state._Cur, _End, _Node->_Data._Str(), + _Node->_Data._Str() + _Node->_Data._Size(), _Traits, _Sflags)) + != _Tgt_state._Cur) { + _Tgt_state._Cur = _Res0; + } else { + _Failed = true; + } - break; - } + break; + } - case _N_class: { // check for bracket expression match - _Failed = _Tgt_state._Cur == _End || !_Do_class(_Nx); - break; - } + case _N_class: + { // check for bracket expression match + _Failed = _Tgt_state._Cur == _End || !_Do_class(_Nx); + break; + } case _N_group: break; @@ -3516,60 +3518,64 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Match_pat(_Node_base* _Nx) { // c break; case _N_neg_assert: - case _N_assert: { // check assert - _It _Ch = _Tgt_state._Cur; - bool _Neg = _Nx->_Kind == _N_neg_assert; - _Bt_state_t<_It> _St = _Tgt_state; - if (_Match_pat(static_cast<_Node_assert*>(_Nx)->_Child) == _Neg) { - // restore initial state and indicate failure - _Tgt_state = _St; - _Failed = true; - } else { - _Tgt_state._Cur = _Ch; - } + case _N_assert: + { // check assert + _It _Ch = _Tgt_state._Cur; + bool _Neg = _Nx->_Kind == _N_neg_assert; + _Bt_state_t<_It> _St = _Tgt_state; + if (_Match_pat(static_cast<_Node_assert*>(_Nx)->_Child) == _Neg) { + // restore initial state and indicate failure + _Tgt_state = _St; + _Failed = true; + } else { + _Tgt_state._Cur = _Ch; + } - break; - } + break; + } case _N_end_assert: _Nx = nullptr; break; - case _N_capture: { // record current position - _Node_capture* _Node = static_cast<_Node_capture*>(_Nx); - _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur; - for (size_t _Idx = _Tgt_state._Grp_valid.size(); _Node->_Idx < _Idx;) { - _Tgt_state._Grp_valid[--_Idx] = false; - } + case _N_capture: + { // record current position + _Node_capture* _Node = static_cast<_Node_capture*>(_Nx); + _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur; + for (size_t _Idx = _Tgt_state._Grp_valid.size(); _Node->_Idx < _Idx;) { + _Tgt_state._Grp_valid[--_Idx] = false; + } - break; - } + break; + } - case _N_end_capture: { // record successful capture - _Node_end_group* _Node = static_cast<_Node_end_group*>(_Nx); - _Node_capture* _Node0 = static_cast<_Node_capture*>(_Node->_Back); - if (_Cap || _Node0->_Idx != 0) { // update capture data - _Tgt_state._Grp_valid[_Node0->_Idx] = true; - _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur; + case _N_end_capture: + { // record successful capture + _Node_end_group* _Node = static_cast<_Node_end_group*>(_Nx); + _Node_capture* _Node0 = static_cast<_Node_capture*>(_Node->_Back); + if (_Cap || _Node0->_Idx != 0) { // update capture data + _Tgt_state._Grp_valid[_Node0->_Idx] = true; + _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur; + } + break; } - break; - } - case _N_back: { // check back reference - _Node_back* _Node = static_cast<_Node_back*>(_Nx); - if (_Tgt_state._Grp_valid[_Node->_Idx]) { // check for match - _It _Res0 = _Tgt_state._Cur; - _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin; - _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End; - if (_Bx != _Ex // _Bx == _Ex for zero-length match - && (_Res0 = _Compare(_Tgt_state._Cur, _End, _Bx, _Ex, _Traits, _Sflags)) == _Tgt_state._Cur) { - _Failed = true; - } else { - _Tgt_state._Cur = _Res0; + case _N_back: + { // check back reference + _Node_back* _Node = static_cast<_Node_back*>(_Nx); + if (_Tgt_state._Grp_valid[_Node->_Idx]) { // check for match + _It _Res0 = _Tgt_state._Cur; + _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin; + _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End; + if (_Bx != _Ex // _Bx == _Ex for zero-length match + && (_Res0 = _Compare(_Tgt_state._Cur, _End, _Bx, _Ex, _Traits, _Sflags)) == _Tgt_state._Cur) { + _Failed = true; + } else { + _Tgt_state._Cur = _Res0; + } } + break; } - break; - } case _N_if: if (!_Do_if(static_cast<_Node_if*>(_Nx))) { @@ -3590,17 +3596,18 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Match_pat(_Node_base* _Nx) { // c _Nx = nullptr; break; - case _N_end_rep: { - _Node_rep* _Nr = static_cast<_Node_end_rep*>(_Nx)->_Begin_rep; - _Loop_vals_t* _Psav = &_Loop_vals[_Nr->_Loop_number]; + case _N_end_rep: + { + _Node_rep* _Nr = static_cast<_Node_end_rep*>(_Nx)->_Begin_rep; + _Loop_vals_t* _Psav = &_Loop_vals[_Nr->_Loop_number]; - if (_Nr->_Simple_loop == 0 && !_Do_rep(_Nr, (_Nr->_Flags & _Fl_greedy) != 0, _Psav->_Loop_idx)) { - _Failed = true; // recurse only if loop contains if/do - } + if (_Nr->_Simple_loop == 0 && !_Do_rep(_Nr, (_Nr->_Flags & _Fl_greedy) != 0, _Psav->_Loop_idx)) { + _Failed = true; // recurse only if loop contains if/do + } - _Nx = nullptr; - break; - } + _Nx = nullptr; + break; + } case _N_begin: break; @@ -3647,73 +3654,76 @@ _BidIt _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Skip(_BidIt _First_arg, _BidIt case _N_nop: break; - case _N_bol: { // check for embedded newline - // return iterator to character just after the newline; for input like "\nabc" - // matching "^abc", _First_arg could be pointing at 'a', so we need to check - // --_First_arg for '\n' - if (*_Prev_iter(_First_arg) != _Meta_nl) { - _First_arg = _STD find(_First_arg, _Last, _Meta_nl); - if (_First_arg != _Last) { - ++_First_arg; + case _N_bol: + { // check for embedded newline + // return iterator to character just after the newline; for input like "\nabc" + // matching "^abc", _First_arg could be pointing at 'a', so we need to check + // --_First_arg for '\n' + if (*_Prev_iter(_First_arg) != _Meta_nl) { + _First_arg = _STD find(_First_arg, _Last, _Meta_nl); + if (_First_arg != _Last) { + ++_First_arg; + } } - } - return _First_arg; - } + return _First_arg; + } case _N_eol: return _STD find(_First_arg, _Last, _Meta_nl); - case _N_str: { // check for string match - _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); - for (; _First_arg != _Last; ++_First_arg) { // look for starting match - _BidIt _Next = _First_arg; - if (_Compare(_First_arg, ++_Next, _Node->_Data._Str(), _Node->_Data._Str() + 1, _Traits, _Sflags) - != _First_arg) { - break; + case _N_str: + { // check for string match + _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); + for (; _First_arg != _Last; ++_First_arg) { // look for starting match + _BidIt _Next = _First_arg; + if (_Compare(_First_arg, ++_Next, _Node->_Data._Str(), _Node->_Data._Str() + 1, _Traits, _Sflags) + != _First_arg) { + break; + } } + return _First_arg; } - return _First_arg; - } - case _N_class: { // check for string match - for (; _First_arg != _Last; ++_First_arg) { // look for starting match - bool _Found; - auto _Ch = static_cast(*_First_arg); - _Node_class<_Elem, _RxTraits>* _Node = static_cast<_Node_class<_Elem, _RxTraits>*>(_Nx); - _It _Next = _First_arg; - ++_Next; - - if (_Node->_Coll && _Lookup_coll(_First_arg, _Next, _Node->_Coll) != _First_arg) { - _Found = true; - } else if (_Node->_Ranges - && (_Lookup_range( - static_cast(_Sflags & regex_constants::collate - ? _Traits.translate(static_cast<_Elem>(_Ch)) - : static_cast<_Elem>(_Ch)), - _Node->_Ranges))) { - _Found = true; - } else if (_Ch < _Bmp_max) { - _Found = _Node->_Small && _Node->_Small->_Find(_Ch); - } else if (_Node->_Large - && _STD find(_Node->_Large->_Str(), _Node->_Large->_Str() + _Node->_Large->_Size(), _Ch) - != _Node->_Large->_Str() + _Node->_Large->_Size()) { - _Found = true; - } else if (_Node->_Classes && _Traits.isctype(static_cast<_Elem>(_Ch), _Node->_Classes)) { - _Found = true; - } else if (_Node->_Equiv && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits)) { - _Found = true; - } else { - _Found = false; - } + case _N_class: + { // check for string match + for (; _First_arg != _Last; ++_First_arg) { // look for starting match + bool _Found; + auto _Ch = static_cast(*_First_arg); + _Node_class<_Elem, _RxTraits>* _Node = static_cast<_Node_class<_Elem, _RxTraits>*>(_Nx); + _It _Next = _First_arg; + ++_Next; + + if (_Node->_Coll && _Lookup_coll(_First_arg, _Next, _Node->_Coll) != _First_arg) { + _Found = true; + } else if (_Node->_Ranges + && (_Lookup_range( + static_cast( + _Sflags & regex_constants::collate ? _Traits.translate(static_cast<_Elem>(_Ch)) + : static_cast<_Elem>(_Ch)), + _Node->_Ranges))) { + _Found = true; + } else if (_Ch < _Bmp_max) { + _Found = _Node->_Small && _Node->_Small->_Find(_Ch); + } else if (_Node->_Large + && _STD find(_Node->_Large->_Str(), _Node->_Large->_Str() + _Node->_Large->_Size(), _Ch) + != _Node->_Large->_Str() + _Node->_Large->_Size()) { + _Found = true; + } else if (_Node->_Classes && _Traits.isctype(static_cast<_Elem>(_Ch), _Node->_Classes)) { + _Found = true; + } else if (_Node->_Equiv && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits)) { + _Found = true; + } else { + _Found = false; + } - const bool _Negated = (_Node->_Flags & _Fl_negate) != 0; + const bool _Negated = (_Node->_Flags & _Fl_negate) != 0; - if (_Found != _Negated) { - return _First_arg; + if (_Found != _Negated) { + return _First_arg; + } } } - } return _First_arg; case _N_group: @@ -3732,15 +3742,16 @@ _BidIt _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Skip(_BidIt _First_arg, _BidIt case _N_end_capture: break; - case _N_if: { // check for soonest string match - _Node_if* _Node = static_cast<_Node_if*>(_Nx); + case _N_if: + { // check for soonest string match + _Node_if* _Node = static_cast<_Node_if*>(_Nx); - for (; _First_arg != _Last && _Node; _Node = _Node->_Child) { - _Last = _Skip(_First_arg, _Last, _Node->_Next); - } + for (; _First_arg != _Last && _Node; _Node = _Node->_Child) { + _Last = _Skip(_First_arg, _Last, _Node->_Next); + } - return _Last; - } + return _Last; + } case _N_begin: break; @@ -3778,8 +3789,8 @@ template bool _Parser<_FwdIt, _Elem, _RxTraits>::_Is_esc() const { // assumes _Pat != _End _FwdIt _Ch0 = _Pat; return ++_Ch0 != _End - && ((!(_L_flags & _L_nex_grp) && (*_Ch0 == _Meta_lpar || *_Ch0 == _Meta_rpar)) - || (!(_L_flags & _L_nex_rep) && (*_Ch0 == _Meta_lbr || *_Ch0 == _Meta_rbr))); + && ((!(_L_flags & _L_nex_grp) && (*_Ch0 == _Meta_lpar || *_Ch0 == _Meta_rpar)) + || (!(_L_flags & _L_nex_rep) && (*_Ch0 == _Meta_lbr || *_Ch0 == _Meta_rbr))); } template @@ -3840,14 +3851,15 @@ void _Parser<_FwdIt, _Elem, _RxTraits>::_Trans() { // map character to meta-char break; - case _Meta_dlr: { // check if $ is special - _FwdIt _Ch0 = _Pat; - if ((_L_flags & _L_anch_rstr) && ++_Ch0 != _End && *_Ch0 != _Meta_nl) { - _Mchar = _Meta_chr; - } + case _Meta_dlr: + { // check if $ is special + _FwdIt _Ch0 = _Pat; + if ((_L_flags & _L_anch_rstr) && ++_Ch0 != _End && *_Ch0 != _Meta_nl) { + _Mchar = _Meta_chr; + } - break; - } + break; + } case _Meta_plus: case _Meta_query: @@ -3921,13 +3933,12 @@ bool _Parser<_FwdIt, _Elem, _RxTraits>::_OctalDigits() { // check for up to 3 oc template void _Parser<_FwdIt, _Elem, _RxTraits>::_Do_ex_class( _Meta_type _End_arg) { // handle delimited expressions within bracket expression - regex_constants::error_type _Errtype = - (_End_arg == _Meta_colon ? regex_constants::error_ctype - : _End_arg == _Meta_equal ? regex_constants::error_collate - : _End_arg == _Meta_dot ? regex_constants::error_collate - : regex_constants::error_syntax); - _FwdIt _Beg = _Pat; - _Iter_diff_t<_FwdIt> _Diff = 0; + regex_constants::error_type _Errtype = (_End_arg == _Meta_colon ? regex_constants::error_ctype + : _End_arg == _Meta_equal ? regex_constants::error_collate + : _End_arg == _Meta_dot ? regex_constants::error_collate + : regex_constants::error_syntax); + _FwdIt _Beg = _Pat; + _Iter_diff_t<_FwdIt> _Diff = 0; while (_Mchar != _Meta_colon && _Mchar != _Meta_equal && _Mchar != _Meta_dot && _Mchar != _Meta_eos) { // advance to end delimiter @@ -4519,9 +4530,9 @@ _Parser<_FwdIt, _Elem, _RxTraits>::_Parser( // PARSER LANGUAGE FLAGS constexpr unsigned int _ECMA_flags = _L_ext_rep | _L_alt_pipe | _L_nex_grp | _L_nex_rep | _L_nc_grp | _L_asrt_gen - | _L_asrt_wrd | _L_bckr | _L_ngr_rep | _L_esc_uni | _L_esc_hex | _L_esc_bsl - | _L_esc_ffn | _L_esc_wsd | _L_esc_ctrl | _L_bzr_chr | _L_grp_esc - | _L_ident_ECMA | _L_empty_grp; + | _L_asrt_wrd | _L_bckr | _L_ngr_rep | _L_esc_uni | _L_esc_hex | _L_esc_bsl + | _L_esc_ffn | _L_esc_wsd | _L_esc_ctrl | _L_bzr_chr | _L_grp_esc | _L_ident_ECMA + | _L_empty_grp; constexpr unsigned int _Basic_flags = _L_bckr | _L_lim_bckr | _L_anch_rstr | _L_star_beg | _L_empty_grp | _L_brk_rstr | _L_mtch_long; diff --git a/stl/inc/set b/stl/inc/set index a049d279f22..409f0b7b22a 100644 --- a/stl/inc/set +++ b/stl/inc/set @@ -177,7 +177,7 @@ set(initializer_list<_Kty>, _Alloc) -> set<_Kty, less<_Kty>, _Alloc>; template _NODISCARD bool operator==(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } template @@ -349,7 +349,7 @@ multiset(initializer_list<_Kty>, _Alloc) -> multiset<_Kty, less<_Kty>, _Alloc>; template _NODISCARD bool operator==(const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } template diff --git a/stl/inc/span b/stl/inc/span index 8565955bfc5..45c51c806ae 100644 --- a/stl/inc/span +++ b/stl/inc/span @@ -33,7 +33,7 @@ inline constexpr size_t dynamic_extent = static_cast(-1); template struct _Span_iterator { #ifdef __cpp_lib_concepts - using iterator_concept = contiguous_iterator_tag; + using iterator_concept = contiguous_iterator_tag; #endif // __cpp_lib_concepts using iterator_category = random_access_iterator_tag; using value_type = remove_cv_t<_Ty>; @@ -179,7 +179,7 @@ struct _Span_iterator { _Myptr = _It; } - pointer _Myptr = nullptr; + pointer _Myptr = nullptr; #if _ITERATOR_DEBUG_LEVEL >= 1 pointer _Mybegin = nullptr; pointer _Myend = nullptr; @@ -660,7 +660,7 @@ template span(_It, _End) -> span>>; template <_RANGES contiguous_range _Rng> -span(_Rng &&) -> span>>; +span(_Rng&&) -> span>>; #else // ^^^ __cpp_lib_concepts / !__cpp_lib_concepts vvv diff --git a/stl/inc/sstream b/stl/inc/sstream index a96cc1c502d..e5c6235cf2f 100644 --- a/stl/inc/sstream +++ b/stl/inc/sstream @@ -220,20 +220,22 @@ protected: case ios_base::end: _Newoff = _Seekdist; break; - case ios_base::cur: { - constexpr auto _Both = ios_base::in | ios_base::out; - if ((_Mode & _Both) != _Both) { // prohibited by N4727 [stringbuf.virtuals] Table 107 "seekoff positioning" - if (_Mode & ios_base::in) { - if (_Gptr_old || !_Seeklow) { - _Newoff = _Gptr_old - _Seeklow; + case ios_base::cur: + { + constexpr auto _Both = ios_base::in | ios_base::out; + if ((_Mode & _Both) + != _Both) { // prohibited by N4727 [stringbuf.virtuals] Table 107 "seekoff positioning" + if (_Mode & ios_base::in) { + if (_Gptr_old || !_Seeklow) { + _Newoff = _Gptr_old - _Seeklow; + break; + } + } else if ((_Mode & ios_base::out) && (_Pptr_old || !_Seeklow)) { + _Newoff = _Pptr_old - _Seeklow; break; } - } else if ((_Mode & ios_base::out) && (_Pptr_old || !_Seeklow)) { - _Newoff = _Pptr_old - _Seeklow; - break; } } - } // fallthrough default: diff --git a/stl/inc/streambuf b/stl/inc/streambuf index 1b36889bf01..ce41dd05566 100644 --- a/stl/inc/streambuf +++ b/stl/inc/streambuf @@ -137,8 +137,9 @@ public: } int_type __CLR_OR_THIS_CALL snextc() { // point to next character and return it - return 1 < _Gnavail() ? _Traits::to_int_type(*_Gnpreinc()) - : _Traits::eq_int_type(_Traits::eof(), sbumpc()) ? _Traits::eof() : sgetc(); + return 1 < _Gnavail() ? _Traits::to_int_type(*_Gnpreinc()) + : _Traits::eq_int_type(_Traits::eof(), sbumpc()) ? _Traits::eof() + : sgetc(); } int_type __CLR_OR_THIS_CALL sputbackc(_Elem _Ch) { // put back _Ch diff --git a/stl/inc/strstream b/stl/inc/strstream index 9f9c9ef8ba6..edda1c01ca2 100644 --- a/stl/inc/strstream +++ b/stl/inc/strstream @@ -270,34 +270,35 @@ protected: _Off += _Seekdist; break; - case ios_base::cur: { - constexpr auto _Both = ios_base::in | ios_base::out; - if ((_Which & _Both) - == _Both) { // prohibited by N4727 [depr.strstreambuf.virtuals] Table 137 "seekoff positioning" - return pos_type(off_type(-1)); - } - - off_type _Oldoff; - off_type _Oldleft; - if (_Which & ios_base::in) { - _Oldoff = gptr() - eback(); - _Oldleft = _Seekhigh - gptr(); - } else if (_Which & ios_base::out) { - _Oldoff = pptr() - pbase(); - _Oldleft = _Seekhigh - pptr(); - } else { - return pos_type(off_type(-1)); + case ios_base::cur: + { + constexpr auto _Both = ios_base::in | ios_base::out; + if ((_Which & _Both) + == _Both) { // prohibited by N4727 [depr.strstreambuf.virtuals] Table 137 "seekoff positioning" + return pos_type(off_type(-1)); + } + + off_type _Oldoff; + off_type _Oldleft; + if (_Which & ios_base::in) { + _Oldoff = gptr() - eback(); + _Oldleft = _Seekhigh - gptr(); + } else if (_Which & ios_base::out) { + _Oldoff = pptr() - pbase(); + _Oldleft = _Seekhigh - pptr(); + } else { + return pos_type(off_type(-1)); + } + + if (_Off < -_Oldoff // runs off beginning + || _Off > _Oldleft) { // runs off end + return pos_type(off_type(-1)); + } + + _Off += _Oldoff; } - if (_Off < -_Oldoff // runs off beginning - || _Off > _Oldleft) { // runs off end - return pos_type(off_type(-1)); - } - - _Off += _Oldoff; - } - - break; + break; default: return pos_type(off_type(-1)); } diff --git a/stl/inc/system_error b/stl/inc/system_error index c500401a377..42b03990542 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -191,7 +191,7 @@ public: _NODISCARD friend bool operator<(const error_code& _Left, const error_code& _Right) noexcept { return _Left.category() < _Right.category() - || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); + || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } #endif // _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS @@ -255,7 +255,7 @@ public: _NODISCARD friend bool operator<(const error_condition& _Left, const error_condition& _Right) noexcept { return _Left.category() < _Right.category() - || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); + || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } // We grant friendship to the operators from error_code here to allow is_error_code_enum_v but not @@ -311,12 +311,12 @@ _NODISCARD inline bool operator!=(const error_condition& _Left, const error_cond _NODISCARD inline bool operator<(const error_code& _Left, const error_code& _Right) noexcept { return _Left.category() < _Right.category() - || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); + || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } _NODISCARD inline bool operator<(const error_condition& _Left, const error_condition& _Right) noexcept { return _Left.category() < _Right.category() - || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); + || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } #endif // _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS diff --git a/stl/inc/tuple b/stl/inc/tuple index 8fe2f3c9698..d0734801e84 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -676,7 +676,7 @@ public: template constexpr bool _Less(const tuple<_Other...>& _Right) const { return _Myfirst._Val < _Right._Myfirst._Val - || (!(_Right._Myfirst._Val < _Myfirst._Val) && _Mybase::_Less(_Right._Get_rest())); + || (!(_Right._Myfirst._Val < _Myfirst._Val) && _Mybase::_Less(_Right._Get_rest())); } template diff --git a/stl/inc/valarray b/stl/inc/valarray index 683c5cd437f..63b69f34fa4 100644 --- a/stl/inc/valarray +++ b/stl/inc/valarray @@ -45,7 +45,7 @@ _Ty* _Allocate_for_op_delete(size_t _Count) { const size_t _Bytes = _Get_size_of_n(_Count); #ifdef __cpp_aligned_new constexpr bool _Extended_alignment = alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__; - if _CONSTEXPR_IF (_Extended_alignment) { + if constexpr (_Extended_alignment) { return static_cast<_Ty*>(::operator new (_Bytes, align_val_t{alignof(_Ty)})); } else #endif // __cpp_aligned_new @@ -554,7 +554,7 @@ private: #ifdef __cpp_aligned_new constexpr bool _Extended_alignment = alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__; - if _CONSTEXPR_IF (_Extended_alignment) { + if constexpr (_Extended_alignment) { ::operator delete (static_cast(_Myptr), align_val_t{alignof(_Ty)}); } else #endif // __cpp_aligned_new diff --git a/stl/inc/variant b/stl/inc/variant index dd781e53081..bccf5add82a 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1169,7 +1169,7 @@ public: { constexpr size_t _That_idx = decltype(_That_ref)::_Idx; #ifdef __EDG__ // TRANSITION, VSO-657455 - constexpr size_t _My_idx = decltype(_My_ref)::_Idx + 0 * _That_idx; + constexpr size_t _My_idx = decltype(_My_ref)::_Idx + 0 * _That_idx; #else // ^^^ workaround ^^^ / vvv no workaround vvv constexpr size_t _My_idx = decltype(_My_ref)::_Idx; #endif // TRANSITION, VSO-657455 @@ -1390,7 +1390,7 @@ _NODISCARD constexpr bool operator==(const variant<_Types...>& _Left, const vari using _Visitor = _Variant_relop_visitor, _Types...>; const size_t _Right_index = _Right.index(); return _Left.index() == _Right_index - && _Variant_raw_visit(_Right_index, _Right._Storage(), _Visitor{_Left._Storage()}); + && _Variant_raw_visit(_Right_index, _Right._Storage(), _Visitor{_Left._Storage()}); } template @@ -1400,7 +1400,7 @@ _NODISCARD constexpr bool operator!=(const variant<_Types...>& _Left, const vari using _Visitor = _Variant_relop_visitor, _Types...>; const size_t _Right_index = _Right.index(); return _Left.index() != _Right_index - || _Variant_raw_visit(_Right_index, _Right._Storage(), _Visitor{_Left._Storage()}); + || _Variant_raw_visit(_Right_index, _Right._Storage(), _Visitor{_Left._Storage()}); } template @@ -1412,8 +1412,8 @@ _NODISCARD constexpr bool operator<(const variant<_Types...>& _Left, const varia const size_t _Left_offset = _Left.index() + 1; const size_t _Right_offset = _Right.index() + 1; return _Left_offset < _Right_offset - || (_Left_offset == _Right_offset - && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); + || (_Left_offset == _Right_offset + && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); } template @@ -1425,8 +1425,8 @@ _NODISCARD constexpr bool operator>(const variant<_Types...>& _Left, const varia const size_t _Left_offset = _Left.index() + 1; const size_t _Right_offset = _Right.index() + 1; return _Left_offset > _Right_offset - || (_Left_offset == _Right_offset - && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); + || (_Left_offset == _Right_offset + && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); } template @@ -1438,8 +1438,8 @@ _NODISCARD constexpr bool operator<=(const variant<_Types...>& _Left, const vari const size_t _Left_offset = _Left.index() + 1; const size_t _Right_offset = _Right.index() + 1; return _Left_offset < _Right_offset - || (_Left_offset == _Right_offset - && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); + || (_Left_offset == _Right_offset + && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); } template @@ -1451,8 +1451,8 @@ _NODISCARD constexpr bool operator>=(const variant<_Types...>& _Left, const vari const size_t _Left_offset = _Left.index() + 1; const size_t _Right_offset = _Right.index() + 1; return _Left_offset > _Right_offset - || (_Left_offset == _Right_offset - && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); + || (_Left_offset == _Right_offset + && _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); } // VISITATION [variant.visit] @@ -1643,8 +1643,12 @@ using _As_variant = // Deduce variant specialization from a derived type template constexpr _Ret _Visit_impl(_Callable&& _Obj, _Variants&&... _Args) { - constexpr int _Strategy = - _Size == 1 ? 0 : _Size <= 4 ? 1 : _Size <= 16 ? 2 : _Size <= 64 ? 3 : _Size <= 256 ? 4 : -1; + constexpr int _Strategy = _Size == 1 ? 0 + : _Size <= 4 ? 1 + : _Size <= 16 ? 2 + : _Size <= 64 ? 3 + : _Size <= 256 ? 4 + : -1; return _Visit_strategy<_Strategy>::template _Visit2<_Ret, _ListOfIndexVectors>( _Variant_visit_index1(0, static_cast<_As_variant<_Variants>&>(_Args)...), static_cast<_Callable&&>(_Obj), static_cast<_As_variant<_Variants>&&>(_Args)...); diff --git a/stl/inc/vector b/stl/inc/vector index 5a08f9d8f9f..dcafb3e2272 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -1771,7 +1771,7 @@ void swap(vector<_Ty, _Alloc>& _Left, vector<_Ty, _Alloc>& _Right) noexcept /* s template _NODISCARD bool operator==(const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { return _Left.size() == _Right.size() - && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); + && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } template @@ -2003,7 +2003,7 @@ public: _NODISCARD difference_type operator-(const _Vb_const_iterator& _Right) const noexcept { _Compat(_Right); return static_cast(_VBITS * (this->_Myptr - _Right._Myptr)) - + static_cast(this->_Myoff) - static_cast(_Right._Myoff); + + static_cast(this->_Myoff) - static_cast(_Right._Myoff); } _NODISCARD const_reference operator[](const difference_type _Off) const noexcept { diff --git a/stl/inc/xlocbuf b/stl/inc/xlocbuf index d6daaac03c0..d9e3c05eea3 100644 --- a/stl/inc/xlocbuf +++ b/stl/inc/xlocbuf @@ -71,20 +71,20 @@ public: _Status = _Unused; // homed successfully case _Codecvt::partial: // fall through - { // put any generated bytes - ptrdiff_t _Count = _Dest - _Buf; - if (0 < _Count - && _Byte_traits::eq_int_type( - _Byte_traits::eof(), static_cast<_Byte_traits::int_type>(_Mystrbuf->sputn(_Buf, _Count)))) { - return; // write failed - } + { // put any generated bytes + ptrdiff_t _Count = _Dest - _Buf; + if (0 < _Count + && _Byte_traits::eq_int_type( + _Byte_traits::eof(), static_cast<_Byte_traits::int_type>(_Mystrbuf->sputn(_Buf, _Count)))) { + return; // write failed + } - if (_Status == _Wrote && _Count == 0) { - _Str.append(_STRING_INC, '\0'); // try with more space - } + if (_Status == _Wrote && _Count == 0) { + _Str.append(_STRING_INC, '\0'); // try with more space + } - break; - } + break; + } case _Codecvt::noconv: return; // nothing to do @@ -132,29 +132,30 @@ protected: switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Buf, _Buf + _Str.size(), _Dest)) { // test result of converting one element case _Codecvt::partial: - case _Codecvt::ok: { // converted something, try to put it out - ptrdiff_t _Count = _Dest - _Buf; - if (0 < _Count - && _Byte_traits::eq_int_type( - _Byte_traits::eof(), static_cast<_Byte_traits::int_type>(_Mystrbuf->sputn(_Buf, _Count)))) { - return _Traits::eof(); // write failed - } + case _Codecvt::ok: + { // converted something, try to put it out + ptrdiff_t _Count = _Dest - _Buf; + if (0 < _Count + && _Byte_traits::eq_int_type(_Byte_traits::eof(), + static_cast<_Byte_traits::int_type>(_Mystrbuf->sputn(_Buf, _Count)))) { + return _Traits::eof(); // write failed + } - if (_Src != &_Ch) { - return _Meta; // converted whole element - } + if (_Src != &_Ch) { + return _Meta; // converted whole element + } + + if (0 >= _Count) { + if (_Str.size() >= 4 * _STRING_INC) { + return _Traits::eof(); // conversion failed + } - if (0 >= _Count) { - if (_Str.size() >= 4 * _STRING_INC) { - return _Traits::eof(); // conversion failed + _Str.append(_STRING_INC, '\0'); // try with more space } - _Str.append(_STRING_INC, '\0'); // try with more space + break; } - break; - } - case _Codecvt::noconv: if (_Traits::eq_int_type( _Traits::eof(), static_cast(_Mystrbuf->sputn(reinterpret_cast(&_Ch), diff --git a/stl/inc/xlocmon b/stl/inc/xlocmon index 960e74a288f..5a48a311037 100644 --- a/stl/inc/xlocmon +++ b/stl/inc/xlocmon @@ -111,9 +111,9 @@ protected: void _Getvals(_Elem2, const lconv* _Ptr) { // get values _Currencysign = _Maklocstr( _International ? _Ptr->int_curr_symbol : _Ptr->currency_symbol, static_cast<_Elem2*>(nullptr), _Cvt); - _Plussign = _Maklocstr(4 < static_cast(_Ptr->p_sign_posn) ? "" : _Ptr->positive_sign, + _Plussign = _Maklocstr(4 < static_cast(_Ptr->p_sign_posn) ? "" : _Ptr->positive_sign, static_cast<_Elem2*>(nullptr), _Cvt); - _Minussign = _Maklocstr(4 < static_cast(_Ptr->n_sign_posn) ? "-" : _Ptr->negative_sign, + _Minussign = _Maklocstr(4 < static_cast(_Ptr->n_sign_posn) ? "-" : _Ptr->negative_sign, static_cast<_Elem2*>(nullptr), _Cvt); _Decimalpoint = _Maklocchr(_Ptr->mon_decimal_point[0], static_cast<_Elem2*>(nullptr), _Cvt); _Kseparator = _Maklocchr(_Ptr->mon_thousands_sep[0], static_cast<_Elem2*>(nullptr), _Cvt); @@ -216,8 +216,8 @@ private: "+x$v" "+ $v" "$v +" "+ $v" "$ +v"; // clang-format on _Ptr += _Signposition * 4 // pick even/odd column - + _Symbolprecedes * 20 // pick even/odd row - + _Sepbyspace * 40; // pick first/second/third group + + _Symbolprecedes * 20 // pick even/odd row + + _Sepbyspace * 40; // pick first/second/third group } _CSTD memcpy(_Pattern.field, _Ptr, sizeof(_Pattern.field)); @@ -434,30 +434,31 @@ private: for (size_t _Off = 0; !_Bad && _Off < 4; ++_Off) { switch (_Pattern.field[_Off]) { // parse a format component - case money_base::symbol: { // parse currency symbol - string_type _Symbol = _Ppunct_fac->curr_symbol(); - typename string_type::const_iterator _Source; - - if ((!(_Iosbase.flags() & ios_base::showbase) && _First != _Last && *_First != *_Symbol.c_str()) - || (_Off == 3 && _Sign.size() <= 1 - && (_First == _Last || *_First != *_Symbol.c_str()))) { // showbase ==> mandatory symbol - // or - // currency symbol optional at end - _Symbol.erase(); - } + case money_base::symbol: + { // parse currency symbol + string_type _Symbol = _Ppunct_fac->curr_symbol(); + typename string_type::const_iterator _Source; + + if ((!(_Iosbase.flags() & ios_base::showbase) && _First != _Last && *_First != *_Symbol.c_str()) + || (_Off == 3 && _Sign.size() <= 1 + && (_First == _Last || *_First != *_Symbol.c_str()))) { // showbase ==> mandatory symbol + // or + // currency symbol optional at end + _Symbol.erase(); + } - _Source = _Symbol.begin(); - while (_First != _Last && _Source != _Symbol.end() && *_First == *_Source) { - // still matching currency symbol - ++_Source; - ++_First; - } + _Source = _Symbol.begin(); + while (_First != _Last && _Source != _Symbol.end() && *_First == *_Source) { + // still matching currency symbol + ++_Source; + ++_First; + } - if (_Source != _Symbol.end()) { - _Bad = true; // currency symbol match failed + if (_Source != _Symbol.end()) { + _Bad = true; // currency symbol match failed + } + break; } - break; - } case money_base::sign: // parse sign if (_First != _Last) { @@ -477,101 +478,103 @@ private: break; // sign match can't fail - case money_base::value: { // parse value field - int _Fracdigseen = 0; - int _Fracdigits = _Ppunct_fac->frac_digits(); - const string _Grouping = _Ppunct_fac->grouping(); - const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Ppunct_fac->thousands_sep(); - - if (_Kseparator == _Elem{} || CHAR_MAX <= static_cast(*_Grouping.c_str())) { - for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; ++_First) { - _Val += _Src[_Idx]; // no grouping, just gather digits - } - } else { // grouping specified, gather digits and group sizes - string _Groups; - _Groups.push_back('\0'); - size_t _Group = 0; + case money_base::value: + { // parse value field + int _Fracdigseen = 0; + int _Fracdigits = _Ppunct_fac->frac_digits(); + const string _Grouping = _Ppunct_fac->grouping(); + const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Ppunct_fac->thousands_sep(); - for (; _First != _Last; ++_First) { - if ((_Idx = _Find_elem(_Atoms, *_First)) < 10) { // got a digit, add to group size - _Val += _Src[_Idx]; - if (_Groups[_Group] != CHAR_MAX) { - ++_Groups[_Group]; + if (_Kseparator == _Elem{} || CHAR_MAX <= static_cast(*_Grouping.c_str())) { + for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; ++_First) { + _Val += _Src[_Idx]; // no grouping, just gather digits + } + } else { // grouping specified, gather digits and group sizes + string _Groups; + _Groups.push_back('\0'); + size_t _Group = 0; + + for (; _First != _Last; ++_First) { + if ((_Idx = _Find_elem(_Atoms, *_First)) < 10) { // got a digit, add to group size + _Val += _Src[_Idx]; + if (_Groups[_Group] != CHAR_MAX) { + ++_Groups[_Group]; + } + } else if (_Groups[_Group] == '\0' || *_First != _Kseparator) { + break; // not a group separator, done + } else { // add a new group to _Groups string + _Groups.push_back('\0'); + ++_Group; } - } else if (_Groups[_Group] == '\0' || *_First != _Kseparator) { - break; // not a group separator, done - } else { // add a new group to _Groups string - _Groups.push_back('\0'); - ++_Group; } - } - if (_Group != 0) { // thousands separators seen - if ('\0' < _Groups[_Group]) { - ++_Group; // add trailing group to group count - } else { - _Bad = true; // trailing separator, fail + if (_Group != 0) { // thousands separators seen + if ('\0' < _Groups[_Group]) { + ++_Group; // add trailing group to group count + } else { + _Bad = true; // trailing separator, fail + } } - } - for (const char* _Pg = _Grouping.c_str(); !_Bad && 0 < _Group;) { - if (*_Pg == CHAR_MAX) { - break; // end of grouping constraints to check + for (const char* _Pg = _Grouping.c_str(); !_Bad && 0 < _Group;) { + if (*_Pg == CHAR_MAX) { + break; // end of grouping constraints to check + } + + if ((0 < --_Group && *_Pg != _Groups[_Group]) || (0 == _Group && *_Pg < _Groups[_Group])) { + _Bad = true; // bad group size, fail + } else if ('\0' < _Pg[1]) { + ++_Pg; // group size okay, advance to next test + } } - if ((0 < --_Group && *_Pg != _Groups[_Group]) || (0 == _Group && *_Pg < _Groups[_Group])) { - _Bad = true; // bad group size, fail - } else if ('\0' < _Pg[1]) { - ++_Pg; // group size okay, advance to next test + if (_Bad) { + break; // bad grouping, give up } } - if (_Bad) { - break; // bad grouping, give up - } - } + const _Elem _Point = _Ppunct_fac->decimal_point(); + if (_First != _Last && _Point != _Elem{} + && *_First == _Point) { // seen decimal point, gather fraction digits + while (++_First != _Last && _Fracdigseen < _Fracdigits + && (_Idx = _Find_elem(_Atoms, *_First)) < 10) { + _Val += _Src[_Idx]; + ++_Fracdigseen; + } - const _Elem _Point = _Ppunct_fac->decimal_point(); - if (_First != _Last && _Point != _Elem{} - && *_First == _Point) { // seen decimal point, gather fraction digits - while ( - ++_First != _Last && _Fracdigseen < _Fracdigits && (_Idx = _Find_elem(_Atoms, *_First)) < 10) { - _Val += _Src[_Idx]; - ++_Fracdigseen; + if (_Fracdigseen < _Fracdigits) { + _Bad = true; // short fraction + } } - if (_Fracdigseen < _Fracdigits) { - _Bad = true; // short fraction + if (_Val.size() == 0) { + _Bad = true; // fail if no elements parsed + } else { + for (; _Fracdigseen < _Fracdigits; ++_Fracdigseen) { + _Val += '0'; // pad out fraction with zeros + } } - } - if (_Val.size() == 0) { - _Bad = true; // fail if no elements parsed - } else { - for (; _Fracdigseen < _Fracdigits; ++_Fracdigseen) { - _Val += '0'; // pad out fraction with zeros - } + break; } - break; - } - case money_base::space: - case money_base::none: { // parse optional space - if (_Off == 3) { - break; // ignore space at end - } + case money_base::none: + { // parse optional space + if (_Off == 3) { + break; // ignore space at end + } - bool _Seen = false; + bool _Seen = false; - for (; _First != _Last && _Ctype_fac.is(ctype_base::space, *_First); ++_First) { - _Seen = true; // skip any space - } + for (; _First != _Last && _Ctype_fac.is(ctype_base::space, *_First); ++_First) { + _Seen = true; // skip any space + } - if (_Pattern.field[_Off] == money_base::space && !_Seen) { - _Bad = true; // fail if no space seen - } - } // parse optional space + if (_Pattern.field[_Off] == money_base::space && !_Seen) { + _Bad = true; // fail if no space seen + } + } // parse optional space } // switch } @@ -780,7 +783,7 @@ private: case money_base::value: // count value field size _Fillcount += _Val.size() + (0 < _Fracdigits ? 1 : 0) - + (_Val.size() <= _Fracdigits ? _Fracdigits - _Val.size() + 1 : 0); + + (_Val.size() <= _Fracdigits ? _Fracdigits - _Val.size() + 1 : 0); break; case money_base::space: // count space size diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index 4ba5685542e..89d33a7d02f 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -1526,10 +1526,11 @@ private: } ios_base::fmtflags _Basefield = _Flags & ios_base::basefield; - *_Ptr++ = _Basefield == ios_base::oct ? 'o' - : _Basefield != ios_base::hex ? _Spec[1] // 'd' or 'u' - : _Flags & ios_base::uppercase ? 'X' : 'x'; - *_Ptr = '\0'; + *_Ptr++ = _Basefield == ios_base::oct ? 'o' + : _Basefield != ios_base::hex ? _Spec[1] // 'd' or 'u' + : _Flags & ios_base::uppercase ? 'X' + : 'x'; + *_Ptr = '\0'; return _Fmt; } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 188e616ff15..b1d8bfd0807 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -99,7 +99,7 @@ static_assert(_Is_pow_2(_Big_allocation_alignment), "Big allocation alignment mu #ifdef _DEBUG constexpr size_t _Non_user_size = 2 * sizeof(void*) + _Big_allocation_alignment - 1; #else // _DEBUG -constexpr size_t _Non_user_size = sizeof(void*) + _Big_allocation_alignment - 1; +constexpr size_t _Non_user_size = sizeof(void*) + _Big_allocation_alignment - 1; #endif // _DEBUG #ifdef _WIN64 diff --git a/stl/inc/xstring b/stl/inc/xstring index 7eb8a2294ac..5c6503dc590 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -2200,10 +2200,11 @@ public: // length of internal buffer, [1, 16]: static constexpr size_type _BUF_SIZE = 16 / sizeof(value_type) < 1 ? 1 : 16 / sizeof(value_type); // roundup mask for allocated buffers, [0, 15]: - static constexpr size_type _ALLOC_MASK = - sizeof(value_type) <= 1 - ? 15 - : sizeof(value_type) <= 2 ? 7 : sizeof(value_type) <= 4 ? 3 : sizeof(value_type) <= 8 ? 1 : 0; + static constexpr size_type _ALLOC_MASK = sizeof(value_type) <= 1 ? 15 + : sizeof(value_type) <= 2 ? 7 + : sizeof(value_type) <= 4 ? 3 + : sizeof(value_type) <= 8 ? 1 + : 0; value_type* _Myptr() noexcept { value_type* _Result = _Bx._Buf; diff --git a/stl/inc/xutility b/stl/inc/xutility index 9853514c011..a613a5f8548 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -717,10 +717,9 @@ namespace ranges { // clang-format on } // namespace _Iter_move - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Iter_move::_Cpo iter_move; } - using namespace _Cpos; } // namespace ranges // iter_swap defined below since it depends on indirectly_movable_storable @@ -1104,10 +1103,9 @@ namespace ranges { }; } // namespace _Iter_swap - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Iter_swap::_Cpo iter_swap; } - using namespace _Cpos; } // namespace ranges // clang-format off @@ -2417,10 +2415,9 @@ namespace ranges { }; } // namespace _Begin - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Begin::_Cpo begin; } - using namespace _Cpos; // ALIAS TEMPLATE ranges::iterator_t template @@ -2480,10 +2477,9 @@ namespace ranges { }; } // namespace _Unchecked_begin - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Unchecked_begin::_Cpo _Ubegin; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::end namespace _End { @@ -2557,10 +2553,9 @@ namespace ranges { }; } // namespace _End - namespace _Cpos { + inline namespace _Cpos { inline constexpr _End::_Cpo end; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::_Uend namespace _Unchecked_end { @@ -2617,10 +2612,9 @@ namespace ranges { }; } // namespace _Unchecked_end - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Unchecked_end::_Cpo _Uend; } - using namespace _Cpos; // CONCEPT ranges::range template @@ -2667,10 +2661,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Cbegin_fn cbegin; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::cend struct _Cend_fn { @@ -2684,10 +2677,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Cend_fn cend; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::rbegin namespace _Rbegin { @@ -2756,10 +2748,9 @@ namespace ranges { }; } // namespace _Rbegin - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Rbegin::_Cpo rbegin; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::rend namespace _Rend { @@ -2829,10 +2820,9 @@ namespace ranges { }; } // namespace _Rend - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Rend::_Cpo rend; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::crbegin struct _Crbegin_fn { @@ -2846,10 +2836,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Crbegin_fn crbegin; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::crend struct _Crend_fn { @@ -2863,10 +2852,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Crend_fn crend; } - using namespace _Cpos; // VARIABLE TEMPLATE ranges::disable_sized_range template @@ -2952,10 +2940,9 @@ namespace ranges { }; } // namespace _Size - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Size::_Cpo size; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::empty namespace _Empty { @@ -3023,10 +3010,9 @@ namespace ranges { }; } // namespace _Empty - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Empty::_Cpo empty; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::data namespace _Data { @@ -3083,10 +3069,9 @@ namespace ranges { }; } // namespace _Data - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Data::_Cpo data; } - using namespace _Cpos; // CUSTOMIZATION POINT OBJECT ranges::cdata struct _Cdata_fn { @@ -3100,10 +3085,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Cdata_fn cdata; } - using namespace _Cpos; // clang-format off // CONCEPT ranges::sized_range @@ -3343,10 +3327,9 @@ namespace ranges { // clang-format on }; - namespace _Cpos { + inline namespace _Cpos { inline constexpr _Ssize_fn ssize; } - using namespace _Cpos; // VARIABLE ranges::next class _Next_fn : private _Not_quite_object { @@ -3886,7 +3869,7 @@ namespace ranges { subrange(_It, _Se, _Make_unsigned_like_t>) -> subrange<_It, _Se, subrange_kind::sized>; template - subrange(_Rng &&) -> subrange, sentinel_t<_Rng>, + subrange(_Rng&&) -> subrange, sentinel_t<_Rng>, (sized_range<_Rng> || sized_sentinel_for, iterator_t<_Rng>>) ? subrange_kind::sized : subrange_kind::unsized>; @@ -5001,8 +4984,8 @@ _FwdIt fill_n(_ExPo&&, _FwdIt _Dest, _Diff _Count_raw, const _Ty& _Val) noexcept #pragma warning(disable : 4806) // no value of type 'bool' promoted to type 'char' can equal the given constant template && !is_volatile_v<_Elem1> // - && is_integral_v<_Elem2> && !is_volatile_v<_Elem2>> + && is_integral_v<_Elem1> && !is_volatile_v<_Elem1> // + && is_integral_v<_Elem2> && !is_volatile_v<_Elem2>> _INLINE_VAR constexpr bool _Can_memcmp_elements = is_same_v<_Elem1, bool> || is_same_v<_Elem2, bool> || static_cast<_Elem1>(-1) == static_cast<_Elem2>(-1); #pragma warning(pop) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 5c80252c9e0..c99f468a540 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -516,8 +516,8 @@ #ifdef __EDG__ // not attempting to detect __EDG_VERSION__ being less than expected #elif defined(__clang__) -#if __clang_major__ < 10 -#error STL1000: Unexpected compiler version, expected Clang 10.0.0 or newer. +#if __clang_major__ < 11 +#error STL1000: Unexpected compiler version, expected Clang 11.0.0 or newer. #endif // ^^^ old Clang ^^^ #elif defined(_MSC_VER) #if _MSC_VER < 1928 // Coarse-grained, not inspecting _MSC_FULL_VER diff --git a/stl/src/atomic_wait.cpp b/stl/src/atomic_wait.cpp index f54c09ee4bb..a5a220f464d 100644 --- a/stl/src/atomic_wait.cpp +++ b/stl/src/atomic_wait.cpp @@ -194,7 +194,7 @@ namespace { return __iso_volatile_load32(static_cast(_Storage)) == *static_cast(_Comparand); case 8: return __iso_volatile_load64(static_cast(_Storage)) - == *static_cast(_Comparand); + == *static_cast(_Comparand); default: _CSTD abort(); } diff --git a/stl/src/excptptr.cpp b/stl/src/excptptr.cpp index ed5460df8cd..dfdd6f1d3bf 100644 --- a/stl/src/excptptr.cpp +++ b/stl/src/excptptr.cpp @@ -444,7 +444,7 @@ _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrAssign(_Inout_ void* _D _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL __ExceptionPtrCompare( _In_ const void* _Lhs, _In_ const void* _Rhs) noexcept { return *static_cast*>(_Lhs) - == *static_cast*>(_Rhs); + == *static_cast*>(_Rhs); } _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL __ExceptionPtrToBool(_In_ const void* _Ptr) noexcept { @@ -510,7 +510,7 @@ _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCurrentException(void* const auto _PType = reinterpret_cast( static_cast(_CatchableTypeArray->arrayOfCatchableTypes[0]) + _ThrowImageBase); #else // ^^^ _EH_RELATIVE_TYPEINFO // !_EH_RELATIVE_TYPEINFO vvv - const auto _PType = _PThrow->pCatchableTypeArray->arrayOfCatchableTypes[0]; + const auto _PType = _PThrow->pCatchableTypeArray->arrayOfCatchableTypes[0]; #endif // _EH_RELATIVE_TYPEINFO // Alloc memory on stack for exception object. This might cause a stack overflow SEH exception, or another C++ diff --git a/stl/src/filesys.cpp b/stl/src/filesys.cpp index 02d1fe85a8d..cd1435c264b 100644 --- a/stl/src/filesys.cpp +++ b/stl/src/filesys.cpp @@ -282,7 +282,7 @@ _FS_DLL int64_t __CLRCALL_PURE_OR_CDECL _Last_write_time(const wchar_t* _Fname) // success, convert time unsigned long long _Wtime = static_cast(_Data.ftLastWriteTime.dwHighDateTime) << 32 - | _Data.ftLastWriteTime.dwLowDateTime; + | _Data.ftLastWriteTime.dwLowDateTime; return static_cast(_Wtime - _Win_ticks_from_epoch); } @@ -354,9 +354,9 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent( return 0; } else { // test existing files for equivalence return _Info1.VolumeSerialNumber != _Info2.VolumeSerialNumber - || memcmp(&_Info1.FileId, &_Info2.FileId, sizeof(_Info1.FileId)) != 0 - ? 0 - : 1; + || memcmp(&_Info1.FileId, &_Info2.FileId, sizeof(_Info1.FileId)) != 0 + ? 0 + : 1; } #else // _CRT_APP BY_HANDLE_FILE_INFORMATION _Info1 = {0}; @@ -382,9 +382,9 @@ _FS_DLL int __CLRCALL_PURE_OR_CDECL _Equivalent( return 0; } else { // test existing files for equivalence return _Info1.dwVolumeSerialNumber != _Info2.dwVolumeSerialNumber - || _Info1.nFileIndexHigh != _Info2.nFileIndexHigh || _Info1.nFileIndexLow != _Info2.nFileIndexLow - ? 0 - : 1; + || _Info1.nFileIndexHigh != _Info2.nFileIndexHigh || _Info1.nFileIndexLow != _Info2.nFileIndexLow + ? 0 + : 1; } #endif // _CRT_APP } diff --git a/stl/src/filesystem.cpp b/stl/src/filesystem.cpp index 15d42a2ed7d..3725c91f896 100644 --- a/stl/src/filesystem.cpp +++ b/stl/src/filesystem.cpp @@ -803,8 +803,8 @@ struct alignas(long long) _Aligned_file_attrs { // Let's try to open the file (either reparse point or destination). __std_win_error _Last_error; const auto _File_flags = _Follow_symlinks - ? __std_fs_file_flags::_Backup_semantics - : __std_fs_file_flags::_Backup_semantics | __std_fs_file_flags::_Open_reparse_point; + ? __std_fs_file_flags::_Backup_semantics + : __std_fs_file_flags::_Backup_semantics | __std_fs_file_flags::_Open_reparse_point; const _STD _Fs_file _Handle(_Path, __std_access_rights::_File_read_attributes, _File_flags, &_Last_error); if (_Last_error != __std_win_error::_Success) { return _Last_error; diff --git a/stl/src/iomanip.cpp b/stl/src/iomanip.cpp index 7dec899b462..72769a6f301 100644 --- a/stl/src/iomanip.cpp +++ b/stl/src/iomanip.cpp @@ -17,7 +17,10 @@ static void __cdecl sifun(ios_base& iostr, ios_base::fmtflags mask) { // set spe // FUNCTION setbase static void __cdecl sbfun(ios_base& iostr, int base) { // set base - iostr.setf(base == 8 ? ios_base::oct : base == 10 ? ios_base::dec : base == 16 ? ios_base::hex : ios_base::_Fmtzero, + iostr.setf(base == 8 ? ios_base::oct + : base == 10 ? ios_base::dec + : base == 16 ? ios_base::hex + : ios_base::_Fmtzero, ios_base::basefield); } diff --git a/stl/src/primitives.hpp b/stl/src/primitives.hpp index a944a5928f5..7f94616c00e 100644 --- a/stl/src/primitives.hpp +++ b/stl/src/primitives.hpp @@ -93,7 +93,7 @@ namespace Concurrency { virtual bool wait_for(stl_critical_section_interface* lock, unsigned int timeout) override { return SleepConditionVariableCS(&m_condition_variable, static_cast(lock)->native_handle(), timeout) - != 0; + != 0; } virtual void notify_one() override { @@ -166,7 +166,7 @@ namespace Concurrency { virtual bool wait_for(stl_critical_section_interface* lock, unsigned int timeout) override { return SleepConditionVariableSRW(&m_condition_variable, static_cast(lock)->native_handle(), timeout, 0) - != 0; + != 0; } virtual void notify_one() override { diff --git a/tests/std/include/test_filesystem_support.hpp b/tests/std/include/test_filesystem_support.hpp index 4abe1848eb2..7abd5574430 100644 --- a/tests/std/include/test_filesystem_support.hpp +++ b/tests/std/include/test_filesystem_support.hpp @@ -25,7 +25,7 @@ inline std::string get_test_directory_subname(const char* const testName, const inline std::experimental::filesystem::path get_test_directory(const char* const testName) { return std::experimental::filesystem::temp_directory_path() - / get_test_directory_subname(testName, strlen(testName)); + / get_test_directory_subname(testName, strlen(testName)); } #if _HAS_CXX17 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 9dccbea001f..48f83b781a0 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 @@ -216,7 +216,7 @@ namespace fputil { template , int> = 0> bool is_within_absolute_tolerance(const T& actual, const T& expected, const double absolute_tolerance) { return _STD _Is_finite(actual) && _STD _Is_finite(expected) - && std::abs(actual - expected) <= absolute_tolerance; + && std::abs(actual - expected) <= absolute_tolerance; } } // namespace detail diff --git a/tests/std/tests/GH_000935_complex_numerical_accuracy/test.cpp b/tests/std/tests/GH_000935_complex_numerical_accuracy/test.cpp index dc4b03cd6a7..3f3fa66186b 100644 --- a/tests/std/tests/GH_000935_complex_numerical_accuracy/test.cpp +++ b/tests/std/tests/GH_000935_complex_numerical_accuracy/test.cpp @@ -16,14 +16,14 @@ void test_sqrt(const rounding_mode mode) { #if FP_PRESET_FAST constexpr int ulp_tolerance = 4; #else // ^^^ fp:fast / not fp:fast vvv - const int ulp_tolerance = is_directed_rounding_mode(mode) ? 3 : 2; + const int ulp_tolerance = is_directed_rounding_mode(mode) ? 3 : 2; #endif // ^^^ not fp:fast ^^^ const auto check_result = [&](const auto& result, const auto& test_case) { const int case_real_ulp_tolerance = test_case.result_exactness.real ? 0 : ulp_tolerance; const int case_imag_ulp_tolerance = test_case.result_exactness.imag ? 0 : ulp_tolerance; return near_equal(result.real(), test_case.expected_result.real(), case_real_ulp_tolerance) - && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); + && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); }; for (const auto& c : sqrt_double_cases) { @@ -81,12 +81,12 @@ void test_log(const rounding_mode mode) { if (mode == rounding_mode::toward_negative && is_mod_exactly_one(test_case.input)) { return abs(result.real()) <= case_real_absolute_tolerance - && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); + && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); } return near_equal(result.real(), test_case.expected_result.real(), case_real_ulp_tolerance, case_real_absolute_tolerance) - && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); + && near_equal(result.imag(), test_case.expected_result.imag(), case_imag_ulp_tolerance); }; for (const auto& c : log_double_cases) { diff --git a/tests/std/tests/P0067R5_charconv/test.cpp b/tests/std/tests/P0067R5_charconv/test.cpp index fcb20bc270d..466a8d72d7c 100644 --- a/tests/std/tests/P0067R5_charconv/test.cpp +++ b/tests/std/tests/P0067R5_charconv/test.cpp @@ -125,10 +125,10 @@ void test_common_to_chars( constexpr size_t BufferPrefix = 20; // detect buffer underruns (specific value isn't important) - constexpr size_t Space = - is_integral_v ? 1 + 64 // worst case: -2^63 in binary - : is_same_v ? 1 + 151 // worst case: negative min subnormal float, fixed notation - : 1 + 1076; // worst case: negative min subnormal double, fixed notation + constexpr size_t Space = is_integral_v ? 1 + 64 // worst case: -2^63 in binary + : is_same_v + ? 1 + 151 // worst case: negative min subnormal float, fixed notation + : 1 + 1076; // worst case: negative min subnormal double, fixed notation constexpr size_t BufferSuffix = 30; // detect buffer overruns (specific value isn't important) @@ -595,8 +595,8 @@ constexpr uint32_t PrefixesToTest = 100; // Tunable for test coverage vs. perfor static_assert(PrefixesToTest >= 1, "Must test at least 1 prefix."); constexpr uint32_t PrefixLimit = 2 // sign bit - * 255 // non-INF/NAN exponents for float - * (1U << (23 - FractionBits)); // fraction bits in prefix + * 255 // non-INF/NAN exponents for float + * (1U << (23 - FractionBits)); // fraction bits in prefix static_assert(PrefixesToTest <= PrefixLimit, "Too many prefixes."); template @@ -701,9 +701,9 @@ void test_floating_precision_prefix(const conditional_t(h) && !h.empty() && h.key() == 0 && h.mapped() == 'x' - && h.get_allocator() == m.get_allocator(); + && h.get_allocator() == m.get_allocator(); }, [&m](NH& h) { return static_cast(h) && !h.empty() && h.key() == 1 && h.mapped() == 'y' - && h.get_allocator() == m.get_allocator(); + && h.get_allocator() == m.get_allocator(); }); allocation_allowed = true; @@ -567,11 +567,11 @@ void test_unordered_map() { nh1, nh2, [&m](NH& h) { return static_cast(h) && !h.empty() && h.key() == 0 && h.mapped() == 'x' - && h.get_allocator() == m.get_allocator(); + && h.get_allocator() == m.get_allocator(); }, [&m](NH& h) { return static_cast(h) && !h.empty() && h.key() == 1 && h.mapped() == 'y' - && h.get_allocator() == m.get_allocator(); + && h.get_allocator() == m.get_allocator(); }); allocation_allowed = true; diff --git a/tests/std/tests/P0218R1_filesystem/test.cpp b/tests/std/tests/P0218R1_filesystem/test.cpp index ef6d08aea10..7273aff888f 100644 --- a/tests/std/tests/P0218R1_filesystem/test.cpp +++ b/tests/std/tests/P0218R1_filesystem/test.cpp @@ -149,7 +149,7 @@ bool throws_filesystem_error(Lambda lambda, string_view functionName, const path } catch (const filesystem_error& err) { // Good! return string_view(err.what()).find(functionName) != string_view::npos && bad(err.code()) - && err.path1().native() == p1.native() && err.path2().native() == p2.native(); + && err.path1().native() == p1.native() && err.path2().native() == p2.native(); } } @@ -3457,7 +3457,7 @@ void test_permissions() { EXPECT(good(ec)); constexpr auto readonlyPerms = perms::owner_read | perms::owner_exec | perms::group_read | perms::group_exec - | perms::others_read | perms::others_exec; + | perms::others_read | perms::others_exec; permissions(filename, readonlyPerms, perm_options::replace); EXPECT(status(filename, ec).permissions() == readonlyPerms); EXPECT(good(ec)); diff --git a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp index 485774ec64f..2f07716f71b 100644 --- a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp +++ b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp @@ -360,8 +360,8 @@ namespace { for (std::size_t size : allocation_sizes) { for (auto align = 1_zu; align <= 512_zu && size % align == 0_zu; align *= 2_zu) { auto ptr = (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) - ? ::operator new(size) - : ::operator new (size, std::align_val_t{align}); + ? ::operator new(size) + : ::operator new (size, std::align_val_t{align}); ndr.deallocate(ptr, size, align); } } @@ -401,8 +401,8 @@ namespace { for (std::size_t size : allocation_sizes) { for (auto align = 1_zu; align <= 512_zu && size % align == 0_zu; align *= 2_zu) { void* ptr = align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__ - ? ::operator new(size) - : ::operator new (size, std::align_val_t{align}); + ? ::operator new(size) + : ::operator new (size, std::align_val_t{align}); nmr.deallocate(ptr, size, align); if (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) { ::operator delete(ptr, size); diff --git a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp index 85d455fa87b..40edfba826f 100644 --- a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp +++ b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp @@ -36,11 +36,11 @@ struct hash_callable>()(declval())) template constexpr bool hash_disabled() { return !is_default_constructible_v> // - && !is_copy_constructible_v> // - && !is_move_constructible_v> // - && !is_copy_assignable_v> // - && !is_move_assignable_v> // - && !hash_callable::value; + && !is_copy_constructible_v> // + && !is_move_constructible_v> // + && !is_copy_assignable_v> // + && !is_move_assignable_v> // + && !hash_callable::value; } template @@ -48,17 +48,17 @@ constexpr bool standard_hash_enabled() { // technically the standard doesn't require triviality here, but it's easy // for us to provide, so we should do that. return is_trivially_default_constructible_v> // - && is_trivially_copy_constructible_v> // - && is_trivially_move_constructible_v> // - && is_trivially_copy_assignable_v> // - && is_trivially_move_assignable_v> // - && is_trivial_v> // as a consequence of the above - && is_same_v::argument_type, T> // - && is_same_v::result_type, size_t> // - && (noexcept(hash{}(declval())) == NoExcept) // - && hash_disabled() // - && hash_disabled() // - && hash_disabled(); + && is_trivially_copy_constructible_v> // + && is_trivially_move_constructible_v> // + && is_trivially_copy_assignable_v> // + && is_trivially_move_assignable_v> // + && is_trivial_v> // as a consequence of the above + && is_same_v::argument_type, T> // + && is_same_v::result_type, size_t> // + && (noexcept(hash{}(declval())) == NoExcept) // + && hash_disabled() // + && hash_disabled() // + && hash_disabled(); } STATIC_ASSERT(standard_hash_enabled()); diff --git a/tests/std/tests/P0896R4_ranges_alg_equal/test.cpp b/tests/std/tests/P0896R4_ranges_alg_equal/test.cpp index c61c58e6227..32c6b8ad22a 100644 --- a/tests/std/tests/P0896R4_ranges_alg_equal/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_equal/test.cpp @@ -57,8 +57,8 @@ constexpr void smoke_test() { } { // calls with sized ranges of differing size perform no comparisons nor projections - constexpr auto proj = [](auto &&) -> int { abort(); }; - constexpr auto comp = [](auto&&, auto &&) -> bool { abort(); }; + constexpr auto proj = [](auto&&) -> int { abort(); }; + constexpr auto comp = [](auto&&, auto&&) -> bool { abort(); }; int const one_int[] = {0}; int const two_ints[] = {0, 1}; assert(!equal(one_int, two_ints, comp, proj, proj)); diff --git a/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp b/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp index 2a864462105..e761386399a 100644 --- a/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp +++ b/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp @@ -27,7 +27,7 @@ constexpr bool iter_test() { STATIC_ASSERT(!movable || indirectly_writable); constexpr bool can_write = derived_from // - || (derived_from && assignable_from); + || (derived_from && assignable_from); STATIC_ASSERT(!can_write || output_iterator); STATIC_ASSERT(!derived_from || input_iterator); diff --git a/tests/std/tests/P0896R4_views_drop_while/test.cpp b/tests/std/tests/P0896R4_views_drop_while/test.cpp index 8fe111ed586..874e30a4541 100644 --- a/tests/std/tests/P0896R4_views_drop_while/test.cpp +++ b/tests/std/tests/P0896R4_views_drop_while/test.cpp @@ -21,7 +21,7 @@ using Pred = remove_const_t)>; STATIC_ASSERT(is_nothrow_copy_constructible_v&& is_nothrow_move_constructible_v); constexpr auto pipeline = views::drop_while(is_less_than<3>) | views::drop_while(is_less_than<3>) - | views::drop_while(is_less_than<3>) | views::drop_while(is_less_than<3>); + | views::drop_while(is_less_than<3>) | views::drop_while(is_less_than<3>); template > using pipeline_t = ranges::drop_while_view< diff --git a/tests/std/tests/P0896R4_views_take_while/test.cpp b/tests/std/tests/P0896R4_views_take_while/test.cpp index 9bf13ae069d..2b3dbe1cd55 100644 --- a/tests/std/tests/P0896R4_views_take_while/test.cpp +++ b/tests/std/tests/P0896R4_views_take_while/test.cpp @@ -23,7 +23,7 @@ using Pred = remove_const_t)>; STATIC_ASSERT(is_nothrow_copy_constructible_v&& is_nothrow_move_constructible_v); constexpr auto pipeline = views::take_while(is_less_than<3>) | views::take_while(is_less_than<3>) - | views::take_while(is_less_than<3>) | views::take_while(is_less_than<3>); + | views::take_while(is_less_than<3>) | views::take_while(is_less_than<3>); template > using pipeline_t = ranges::take_while_view< diff --git a/tests/std/tests/P0896R4_views_transform_death/test.cpp b/tests/std/tests/P0896R4_views_transform_death/test.cpp index edb51eb5a62..29ca67cda9d 100644 --- a/tests/std/tests/P0896R4_views_transform_death/test.cpp +++ b/tests/std/tests/P0896R4_views_transform_death/test.cpp @@ -309,7 +309,7 @@ void test_iter_swap_value_initialized_iterator_right() { void test_sentinel_compare_value_initialized() { auto r = ranges::subrange{counted_iterator{some_ints, ranges::distance(some_ints)}, default_sentinel} - | views::transform(lambda); + | views::transform(lambda); using R = decltype(r); static_assert(!ranges::common_range); (void) (ranges::iterator_t{} == r.end()); @@ -317,7 +317,7 @@ void test_sentinel_compare_value_initialized() { void test_sentinel_difference_value_initialized() { auto r = ranges::subrange{counted_iterator{some_ints, ranges::distance(some_ints)}, default_sentinel} - | views::transform(lambda); + | views::transform(lambda); using R = decltype(r); static_assert(!ranges::common_range); static_assert(sized_sentinel_for, ranges::iterator_t>); @@ -326,7 +326,7 @@ void test_sentinel_difference_value_initialized() { void test_flipped_sentinel_difference_value_initialized() { auto r = ranges::subrange{counted_iterator{some_ints, ranges::distance(some_ints)}, default_sentinel} - | views::transform(lambda); + | views::transform(lambda); using R = decltype(r); static_assert(!ranges::common_range); static_assert(sized_sentinel_for, ranges::iterator_t>); diff --git a/tests/std/tests/P1502R1_standard_library_header_units/test.cpp b/tests/std/tests/P1502R1_standard_library_header_units/test.cpp index 00fec2b29bd..d660f96e77b 100644 --- a/tests/std/tests/P1502R1_standard_library_header_units/test.cpp +++ b/tests/std/tests/P1502R1_standard_library_header_units/test.cpp @@ -176,12 +176,8 @@ int main() { const to_chars_result result = to_chars(buf, end(buf), 3.14); assert(result.ec == errc{}); assert(result.ptr == end(buf)); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const string_view sv{buf, size(buf)}; assert(sv == "3.14"); -#else // ^^^ no workaround / workaround vvv - assert(buf[0] == '3' && buf[1] == '.' && buf[2] == '1' && buf[3] == '4'); -#endif // ^^^ workaround ^^^ } { @@ -193,13 +189,11 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, VSO-1236034 (error LNK2005: _Yarn) const string utf8_koshka_cat{"\xD0\xBA\xD0\xBE\xD1\x88\xD0\xBA\xD0\xB0_\xF0\x9F\x90\x88"}; const wstring utf16_koshka_cat{L"\x043A\x043E\x0448\x043A\x0430_\xD83D\xDC08"}; wstring_convert> conv; assert(conv.from_bytes(utf8_koshka_cat) == utf16_koshka_cat); assert(conv.to_bytes(utf16_koshka_cat) == utf8_koshka_cat); -#endif // ^^^ no workaround ^^^ static_assert(static_cast(codecvt_mode::consume_header) == 4); // TRANSITION, DevCom-1160041 (deprecated) } @@ -290,14 +284,12 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) constexpr wstring_view dot{L"."}; error_code ec{}; const filesystem::space_info info = filesystem::space(dot, ec); assert(!ec); assert(info.capacity > 0); assert(info.capacity != static_cast(-1)); -#endif // ^^^ no workaround ^^^ } { @@ -313,10 +305,8 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const ifstream f{}; assert(!f.is_open()); -#endif // ^^^ no workaround ^^^ } { @@ -348,7 +338,6 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) ostringstream oss; oss << "I have " << setfill('.') << setw(7) << 9 * 9 * 9 + 10 * 10 * 10 << " cute fluffy kittens."; assert(oss.str() == "I have ...1729 cute fluffy kittens."); @@ -356,18 +345,15 @@ int main() { oss << quoted(R"(Read "C:\Temp\Cat Names.txt" for more info.)"); const char* const expected_quoted = R"("Read \"C:\\Temp\\Cat Names.txt\" for more info.")"; assert(oss.str() == expected_quoted); -#endif // ^^^ no workaround ^^^ } { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) ios b{nullptr}; assert(b.rdbuf() == nullptr); assert(b.rdstate() == ios_base::badbit); assert(b.precision() == 6); static_assert(ios_base::floatfield == (ios_base::fixed | ios_base::scientific)); -#endif // ^^^ no workaround ^^^ } { @@ -378,18 +364,14 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) cout << "Testing P1502R1_standard_library_header_units.\n"; assert(cin.tie() == &cout); -#endif // ^^^ no workaround ^^^ } { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const istream is{nullptr}; assert(is.gcount() == 0); -#endif // ^^^ no workaround ^^^ } { @@ -538,10 +520,8 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const ostream os{nullptr}; assert(os.rdbuf() == nullptr); -#endif // ^^^ no workaround ^^^ } { @@ -593,7 +573,7 @@ int main() { #if 0 // TRANSITION, VSO-1088552 (deduction guides) assert(ranges::distance(views::filter(arr, [](int x) { return x == 0; })) == 4); static_assert(ranges::distance(views::filter(arr, [](int x) { return x != 0; })) == 5); -#elif defined(MSVC_INTERNAL_TESTING) // TRANSITION, VSO-1237145 (trailing requires clause) +#else // ^^^ no workaround / workaround vvv auto is_zero = [](int x) { return x == 0; }; using FV1 = ranges::filter_view, decltype(is_zero)>; assert(ranges::distance(FV1{arr, is_zero}) == 4); @@ -610,7 +590,6 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const regex r{R"(\w+)"}; const string s{"cute! fluffy? kittens."}; vector v; @@ -621,7 +600,6 @@ int main() { const vector expected{"cute", "fluffy", "kittens"}; assert(v == expected); -#endif // ^^^ no workaround ^^^ } { @@ -721,11 +699,9 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) ostringstream oss; oss << "I have " << 9 * 9 * 9 + 10 * 10 * 10 << " cute fluffy kittens."; assert(oss.str() == "I have 1729 cute fluffy kittens."); -#endif // ^^^ no workaround ^^^ } { @@ -746,7 +722,6 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) bool caught_puppies = false; try { @@ -758,7 +733,6 @@ int main() { } assert(caught_puppies); -#endif // ^^^ no workaround ^^^ } { @@ -799,41 +773,33 @@ int main() { { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) istringstream iss{"kittens"}; assert(iss.rdbuf()->in_avail() == 7); -#endif // ^^^ no workaround ^^^ } { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) constexpr string_view catenary{"catenary"}; assert(catenary.starts_with("cat")); assert(!catenary.starts_with("dog")); static_assert(catenary.starts_with("cat")); static_assert(!catenary.starts_with("dog")); -#endif // ^^^ no workaround ^^^ } { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) const string small_string{"homeowner"}; const string large_string{"Cute fluffy kittens are so adorable when they meow and purr."}; assert(small_string.find("meow") == 2); assert(large_string.find("meow") == 46); -#endif // ^^^ no workaround ^^^ } { puts("Testing ."); -#ifdef MSVC_INTERNAL_TESTING // TRANSITION, DevCom-1224512 (char_traits) istrstream istr{"1729"}; int n = -1; istr >> n; assert(n == 1729); -#endif // ^^^ no workaround ^^^ } { diff --git a/tests/tr1/include/tdefs.h b/tests/tr1/include/tdefs.h index eecc8f1f321..51aa54f728f 100644 --- a/tests/tr1/include/tdefs.h +++ b/tests/tr1/include/tdefs.h @@ -81,13 +81,13 @@ int total_fail = 0; #ifdef AFMT int afmt = 1; #else // AFMT -int afmt = 0; +int afmt = 0; #endif // AFMT #ifdef TERSE int terse = 1; #else // TERSE -int terse = 0; +int terse = 0; #endif // TERSE #ifdef VERBOSE diff --git a/tools/inc/stljobs.h b/tools/inc/stljobs.h index 9e494a86e14..a538a9e8456 100644 --- a/tools/inc/stljobs.h +++ b/tools/inc/stljobs.h @@ -558,19 +558,19 @@ struct subprocess_executive { // turn on all reasonable corruption detecting mitigations unsigned long long mitigations = PROCESS_CREATION_MITIGATION_POLICY_DEP_ENABLE - | PROCESS_CREATION_MITIGATION_POLICY_SEHOP_ENABLE - | PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_ON_REQ_RELOCS - | PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_PROHIBIT_DYNAMIC_CODE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_FONT_DISABLE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_IMAGE_LOAD_NO_REMOTE_ALWAYS_ON - | PROCESS_CREATION_MITIGATION_POLICY_IMAGE_LOAD_NO_LOW_LABEL_ALWAYS_ON; + | PROCESS_CREATION_MITIGATION_POLICY_SEHOP_ENABLE + | PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_ON_REQ_RELOCS + | PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_PROHIBIT_DYNAMIC_CODE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_FONT_DISABLE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_IMAGE_LOAD_NO_REMOTE_ALWAYS_ON + | PROCESS_CREATION_MITIGATION_POLICY_IMAGE_LOAD_NO_LOW_LABEL_ALWAYS_ON; procAttributeList.update_attribute(PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY, &mitigations, sizeof(mitigations)); STARTUPINFOEXW startupInfo{}; diff --git a/tools/validate/validate.cpp b/tools/validate/validate.cpp index 4e03db7ba13..192a43833f3 100644 --- a/tools/validate/validate.cpp +++ b/tools/validate/validate.cpp @@ -247,8 +247,8 @@ int main() { } const TabPolicy tab_policy = binary_search(tabby_filenames.begin(), tabby_filenames.end(), filename) - ? TabPolicy::Allowed - : TabPolicy::Forbidden; + ? TabPolicy::Allowed + : TabPolicy::Forbidden; scan_file(filepath, tab_policy, buffer); } diff --git a/vcpkg b/vcpkg index 6185aa76504..acb6b10e7fd 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 6185aa76504a5025f36754324abf307cc776f3da +Subproject commit acb6b10e7fdf5e8519c18398d0b069e1d58ca025