Skip to content

Commit f2a2983

Browse files
committed
Merge remote-tracking branch 'upstream/main' into to_underlying
2 parents 69a4f0a + 1866b84 commit f2a2983

File tree

60 files changed

+1180
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1180
-481
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ add_compile_definitions(
6767
_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH WIN32_LEAN_AND_MEAN STRICT _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS
6868
_CRT_DECLARE_NONSTDC_NAMES=1 )
6969

70-
add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guard:cf /Z7 /Gm- /Gy /Zp8 /std:c++latest /permissive- /Zc:threadSafeInit- /Zl)
70+
add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guard:cf /Z7 /Gm- /Gy /Zp8 /std:c++latest /permissive- /Zc:threadSafeInit- /Zl /ZH:SHA_256)
7171

7272
set(VCLIBS_DEBUG_OPTIONS "/Od")
7373
set(VCLIBS_RELEASE_OPTIONS "/O2;/Os") # TRANSITION: Potentially remove /Os

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem
143143
The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to
144144
acquire this dependency.
145145

146-
1. Install Visual Studio 2019 16.10 Preview 4 or later.
146+
1. Install Visual Studio 2019 16.11 Preview 1 or later.
147147
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
148148
This will ensure that you're using supported versions of CMake and Ninja.
149149
* Otherwise, install [CMake][] 3.20 or later, and [Ninja][] 1.10.2 or later.
@@ -158,7 +158,7 @@ acquire this dependency.
158158

159159
# How To Build With A Native Tools Command Prompt
160160

161-
1. Install Visual Studio 2019 16.10 Preview 4 or later.
161+
1. Install Visual Studio 2019 16.11 Preview 1 or later.
162162
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
163163
This will ensure that you're using supported versions of CMake and Ninja.
164164
* Otherwise, install [CMake][] 3.20 or later, and [Ninja][] 1.10.2 or later.

azure-devops/create-vmss.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $ProtoVMName = 'PROTOTYPE'
2727
$LiveVMPrefix = 'BUILD'
2828
$ImagePublisher = 'MicrosoftWindowsDesktop'
2929
$ImageOffer = 'Windows-10'
30-
$ImageSku = '20h2-ent-g2'
30+
$ImageSku = '21h1-ent-g2'
3131

3232
$ProgressActivity = 'Creating Scale Set'
3333
$TotalProgress = 14
@@ -310,6 +310,8 @@ Write-Progress `
310310
-Status 'Sleeping after restart' `
311311
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
312312

313+
# The VM appears to be busy immediately after restarting.
314+
# This workaround waits for a minute before attempting to run sysprep.ps1.
313315
Start-Sleep -Seconds 60
314316

315317
####################################################################################################

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variables:
88
buildOutputLocation: 'D:\build'
99
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'
1010

11-
pool: 'StlBuild-2021-05-18'
11+
pool: 'StlBuild-2021-06-02'
1212

1313
stages:
1414
- stage: Code_Format

stl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(HEADERS
55
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_all_public_headers.hpp
66
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_system_error_abi.hpp
77
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_tzdb.hpp
8+
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_xlocinfo_types.hpp
89
${CMAKE_CURRENT_LIST_DIR}/inc/algorithm
910
${CMAKE_CURRENT_LIST_DIR}/inc/any
1011
${CMAKE_CURRENT_LIST_DIR}/inc/array
@@ -220,7 +221,6 @@ set(HEADERS
220221
${CMAKE_CURRENT_LIST_DIR}/inc/xlocale
221222
${CMAKE_CURRENT_LIST_DIR}/inc/xlocbuf
222223
${CMAKE_CURRENT_LIST_DIR}/inc/xlocinfo
223-
${CMAKE_CURRENT_LIST_DIR}/inc/xlocinfo.h
224224
${CMAKE_CURRENT_LIST_DIR}/inc/xlocmes
225225
${CMAKE_CURRENT_LIST_DIR}/inc/xlocmon
226226
${CMAKE_CURRENT_LIST_DIR}/inc/xlocnum

stl/inc/__msvc_xlocinfo_types.hpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// __msvc_xlocinfo_types.hpp internal header (core)
2+
3+
// Copyright (c) Microsoft Corporation.
4+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
#pragma once
7+
#ifndef __MSVC_XLOCINFO_TYPES_HPP
8+
#define __MSVC_XLOCINFO_TYPES_HPP
9+
#include <yvals_core.h>
10+
#if _STL_COMPILER_PREPROCESSOR
11+
12+
#pragma pack(push, _CRT_PACKING)
13+
#pragma warning(push, _STL_WARNING_LEVEL)
14+
#pragma warning(disable : _STL_DISABLED_WARNINGS)
15+
_STL_DISABLE_CLANG_WARNINGS
16+
#pragma push_macro("new")
17+
#undef new
18+
19+
_EXTERN_C_UNLESS_PURE
20+
21+
struct _Collvec { // stuff needed by _Strcoll, etc.
22+
unsigned int _Page; // UINT
23+
wchar_t* _LocaleName;
24+
};
25+
26+
struct _Ctypevec { // stuff needed by _Tolower, etc.
27+
unsigned int _Page; // UINT
28+
const short* _Table;
29+
int _Delfl;
30+
wchar_t* _LocaleName;
31+
};
32+
33+
struct _Cvtvec { // stuff needed by _Mbrtowc, etc.
34+
unsigned int _Page; // UINT
35+
unsigned int _Mbcurmax;
36+
int _Isclocale; // LCID == _CLOCALEHANDLE
37+
unsigned char _Isleadbyte[32]; // 256 bits
38+
};
39+
40+
_END_EXTERN_C_UNLESS_PURE
41+
42+
#pragma pop_macro("new")
43+
_STL_RESTORE_CLANG_WARNINGS
44+
#pragma warning(pop)
45+
#pragma pack(pop)
46+
#endif // _STL_COMPILER_PREPROCESSOR
47+
#endif // __MSVC_XLOCINFO_TYPES_HPP

stl/inc/algorithm

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4072,9 +4072,12 @@ namespace ranges {
40724072

40734073
// VARIABLE ranges::unique_copy
40744074
// clang-format off
4075+
template <class _It, class _Ty>
4076+
concept _Is_input_with_value_type = input_iterator<_It> && same_as<iter_value_t<_It>, _Ty>;
4077+
40754078
template <class _It, class _Out>
40764079
concept _Can_reread_or_store = forward_iterator<_It>
4077-
|| (input_iterator<_Out> && same_as<iter_value_t<_It>, iter_value_t<_Out>>)
4080+
|| _Is_input_with_value_type<_Out, iter_value_t<_It>>
40784081
|| indirectly_copyable_storable<_It, _Out>;
40794082
// clang-format on
40804083
class _Unique_copy_fn : private _Not_quite_object {
@@ -4127,7 +4130,7 @@ namespace ranges {
41274130
return {_STD move(_First), _STD move(_Result)};
41284131
}
41294132

4130-
if constexpr (input_iterator<_Out> && same_as<iter_value_t<_It>, iter_value_t<_Out>>) {
4133+
if constexpr (_Is_input_with_value_type<_Out, iter_value_t<_It>>) {
41314134
// Can reread _Result
41324135
*_Result = *_First;
41334136

@@ -10257,12 +10260,27 @@ namespace ranges {
1025710260

1025810261
using _Memcmp_classification_pred =
1025910262
typename decltype(_Lex_compare_memcmp_classify(_First1, _First2, _Pred))::_Pred;
10260-
if constexpr (!is_void_v<_Memcmp_classification_pred> && sized_sentinel_for<_Se1, _It1> //
10261-
&& sized_sentinel_for<_Se2, _It2> && same_as<_Pj1, identity> && same_as<_Pj2, identity>) {
10263+
constexpr bool _Is_sized1 = sized_sentinel_for<_Se1, _It1>;
10264+
constexpr bool _Is_sized2 = sized_sentinel_for<_Se2, _It2>;
10265+
if constexpr (!is_void_v<_Memcmp_classification_pred> && _Sized_or_unreachable_sentinel_for<_Se1, _It1> //
10266+
&& _Sized_or_unreachable_sentinel_for<_Se2, _It2> //
10267+
&& same_as<_Pj1, identity> && same_as<_Pj2, identity>) {
1026210268
if (!_STD is_constant_evaluated()) {
10263-
const auto _Num1 = static_cast<size_t>(_Last1 - _First1);
10264-
const auto _Num2 = static_cast<size_t>(_Last2 - _First2);
10265-
const int _Ans = _Memcmp_count(_First1, _First2, (_STD min)(_Num1, _Num2));
10269+
size_t _Num1;
10270+
if constexpr (_Is_sized1) {
10271+
_Num1 = static_cast<size_t>(_Last1 - _First1);
10272+
} else {
10273+
_Num1 = SIZE_MAX;
10274+
}
10275+
10276+
size_t _Num2;
10277+
if constexpr (_Is_sized2) {
10278+
_Num2 = static_cast<size_t>(_Last2 - _First2);
10279+
} else {
10280+
_Num2 = SIZE_MAX;
10281+
}
10282+
10283+
const int _Ans = _Memcmp_count(_First1, _First2, (_STD min)(_Num1, _Num2));
1026610284
return _Memcmp_classification_pred{}(_Ans, 0) || (_Ans == 0 && _Num1 < _Num2);
1026710285
}
1026810286
}

stl/inc/bit

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,6 @@ _NODISCARD constexpr _Ty rotr(const _Ty _Val, const int _Rotation) noexcept {
9696
}
9797
}
9898

99-
// Implementation of popcount without using specialized CPU instructions.
100-
// Used at compile time and when said instructions are not supported.
101-
template <class _Ty>
102-
_NODISCARD constexpr int _Popcount_fallback(_Ty _Val) noexcept {
103-
constexpr int _Digits = numeric_limits<_Ty>::digits;
104-
// we static_cast these bit patterns in order to truncate them to the correct size
105-
_Val = static_cast<_Ty>(_Val - ((_Val >> 1) & static_cast<_Ty>(0x5555'5555'5555'5555ull)));
106-
_Val = static_cast<_Ty>((_Val & static_cast<_Ty>(0x3333'3333'3333'3333ull))
107-
+ ((_Val >> 2) & static_cast<_Ty>(0x3333'3333'3333'3333ull)));
108-
_Val = static_cast<_Ty>((_Val + (_Val >> 4)) & static_cast<_Ty>(0x0F0F'0F0F'0F0F'0F0Full));
109-
for (int _Shift_digits = 8; _Shift_digits < _Digits; _Shift_digits <<= 1) {
110-
_Val = static_cast<_Ty>(_Val + static_cast<_Ty>(_Val >> _Shift_digits));
111-
}
112-
// we want the bottom "slot" that's big enough to store _Digits
113-
return static_cast<int>(_Val & static_cast<_Ty>(_Digits + _Digits - 1));
114-
}
115-
11699
#if defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
117100

118101
extern "C" {
@@ -184,32 +167,8 @@ _NODISCARD int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept {
184167
}
185168
#endif // __AVX2__
186169
}
187-
188-
template <class _Ty>
189-
_NODISCARD int _Checked_x86_x64_popcount(const _Ty _Val) noexcept {
190-
constexpr int _Digits = numeric_limits<_Ty>::digits;
191-
#ifndef __AVX__
192-
const bool _Definitely_have_popcnt = __isa_available >= __ISA_AVAILABLE_SSE42;
193-
if (!_Definitely_have_popcnt) {
194-
return _Popcount_fallback(_Val);
195-
}
196-
#endif // !defined(__AVX__)
197-
198-
if constexpr (_Digits <= 16) {
199-
return static_cast<int>(__popcnt16(_Val));
200-
} else if constexpr (_Digits == 32) {
201-
return static_cast<int>(__popcnt(_Val));
202-
} else {
203-
#ifdef _M_IX86
204-
return static_cast<int>(__popcnt(_Val >> 32) + __popcnt(static_cast<unsigned int>(_Val)));
205-
#else // ^^^ _M_IX86 / !_M_IX86 vvv
206-
return static_cast<int>(__popcnt64(_Val));
207-
#endif // _M_IX86
208-
}
209-
}
210170
#endif // defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
211171

212-
213172
#if defined(_M_ARM) || defined(_M_ARM64)
214173
#ifdef __clang__ // TRANSITION, GH-1586
215174
_NODISCARD constexpr int _Clang_arm_arm64_countl_zero(const unsigned short _Val) {
@@ -283,14 +242,9 @@ _NODISCARD constexpr int countr_one(const _Ty _Val) noexcept {
283242
return _Countr_zero(static_cast<_Ty>(~_Val));
284243
}
285244

286-
template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> _Enabled = 0>
245+
template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0>
287246
_NODISCARD constexpr int popcount(const _Ty _Val) noexcept {
288-
#if defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
289-
if (!_STD is_constant_evaluated()) {
290-
return _Checked_x86_x64_popcount(_Val);
291-
}
292-
#endif // defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
293-
return _Popcount_fallback(_Val);
247+
return _Popcount(_Val);
294248
}
295249

296250
enum class endian { little = 0, big = 1, native = little };

stl/inc/execution

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ struct _Static_partition_range<_FwdIt, _Diff, false> {
927927
auto _Result = _Division_points.begin();
928928
*_Result = _Get_unwrapped(_First);
929929
for (_Diff _Idx{}; _Idx < _Unchunked_items; ++_Idx) { // record bounds of chunks with an extra item
930-
for (_Diff _This_chunk_size = _Chunk_size; 0 < _This_chunk_size--;) {
930+
for (_Diff _This_chunk_size = _Chunk_size + 1; 0 < _This_chunk_size--;) {
931931
if (_First == _Last) {
932932
return false;
933933
}

0 commit comments

Comments
 (0)