Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c19507f
Work around a compiler back-end assertion in vectorized minmax (#4739)
StephanTLavavej Jun 19, 2024
881bcad
Build the x86 STL with `/arch:SSE2` instead of `/arch:IA32` (#4741)
StephanTLavavej Jun 21, 2024
0be5257
Drop support for Win7 / Server 2008 R2 (#4742)
StephanTLavavej Jun 25, 2024
243ac89
`<cmath>`: Enable Clang FP comparison intrinsics for heterogeneous FP…
frederick-vs-ja Jun 27, 2024
756f6d5
Implement `range-default-formatter` (#4716)
frederick-vs-ja Jun 27, 2024
d6b0352
Use `requires`-clauses and concepts for container-like components sin…
frederick-vs-ja Jun 27, 2024
14b54ca
Fix `atomic_ref::is_lock_free()` on x64 (#4729)
StephanTLavavej Jun 27, 2024
f9b0af8
Implement P0952R2: 'A new specification for `std::generate_canonical`…
MattStephanson Jun 27, 2024
165fc94
C++26 freestanding feature-test macros: Partial Classes and `inout` `…
frederick-vs-ja Jun 27, 2024
7e24bc4
Implement LWG-4061 Should `std::basic_format_context` be default-cons…
frederick-vs-ja Jul 5, 2024
8e56d6b
Properly test the resolution of LWG-4053 (#4748)
frederick-vs-ja Jul 5, 2024
153b940
`<xtree>`: Use scope guard for node copy failure (#4749)
frederick-vs-ja Jul 5, 2024
557eae3
Inline `_Memcmp_ranges` that is used only once (#4753)
AlexGuteniev Jul 5, 2024
9b63e8c
Updated _MSVC_STL_UPDATE to July 2024 (#4754)
ravixalgorithm Jul 5, 2024
d09326a
Inspect unwrapped iterators by `_Prefer_iterator_copies` (#4775)
AlexGuteniev Jul 5, 2024
4406e0e
P2968R2 Make std::ignore A First-Class Object (#4777)
NeilGeorge1 Jul 5, 2024
184ce39
Remove `_NODISCARD_FRIEND` workaround (#4782)
fsb4000 Jul 5, 2024
4bffb54
Implement LWG-3944 Formatters converting sequences of `char` to seque…
frederick-vs-ja Jul 5, 2024
679783a
Implement LWG-4096 `views::iota(views::iota(0))` should be rejected (…
frederick-vs-ja Jul 5, 2024
53f1faf
Implement LWG-4106 `basic_format_args` should not be default-construc…
frederick-vs-ja Jul 5, 2024
ef1d621
Always use cmpxchg16b on x64 for `atomic_ref<16 bytes>` (#4751)
StephanTLavavej Jul 5, 2024
3962da0
Toolset update: VS 2022 17.11 Preview 3 (#4824)
StephanTLavavej Jul 11, 2024
39dd503
`<numeric>`: check for gcd / lcm overflows (#4776)
AlexGuteniev Jul 11, 2024
a395844
Implement LWG-4083 `views::as_rvalue` should reject non-input ranges …
frederick-vs-ja Jul 11, 2024
de1eb6f
Implement LWG-4074 `compatible-joinable-ranges` is underconstrained (…
frederick-vs-ja Jul 11, 2024
5236e38
Implement LWG-4098 `views::adjacent<0>` should reject non-forward ran…
frederick-vs-ja Jul 11, 2024
0207572
Implement P2997R1 Removing The Common Reference Requirement From The …
frederick-vs-ja Jul 11, 2024
afb1fc1
Fix `<bitset>` benchmark correctness (#4817)
AlexGuteniev Jul 11, 2024
0586819
Fewer allocations to put smaller bitset to stream (#4818)
AlexGuteniev Jul 11, 2024
ecbc1ef
Use `requires`-clauses for `pair` and `tuple` since C++20 (#4819)
frederick-vs-ja Jul 11, 2024
5d4e965
Merge branch 'main' into merge-generator
StephanTLavavej Jul 11, 2024
156b2dd
`_NODISCARD_FRIEND` => `_NODISCARD friend`
StephanTLavavej Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.28.0)
cmake_minimum_required(VERSION 3.29.0)

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(msvc_standard_libraries LANGUAGES CXX)
Expand Down Expand Up @@ -58,7 +58,6 @@ if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86")
# Note that we set _WIN32_WINNT to a high level to make declarations available, but still engage downlevel
# runtime dynamic linking by setting our own _STL_WIN32_WINNT back to Windows XP.
add_compile_definitions(_X86_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/arch:IA32>)
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64")
set(VCLIBS_TARGET_ARCHITECTURE "x64")
set(VCLIBS_I386_OR_AMD64 "amd64")
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.11 Preview 2 or later.
1. Install Visual Studio 2022 17.11 Preview 3 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* 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.28.0 or later, and [Ninja][] 1.11.0 or later.
* Otherwise, install [CMake][] 3.29.0 or later, and [Ninja][] 1.11.0 or later.
* Make sure [Python][] 3.12 or later is available to CMake.
2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository,
`https://github.com/microsoft/STL`.
Expand All @@ -156,11 +156,11 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.11 Preview 2 or later.
1. Install Visual Studio 2022 17.11 Preview 3 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* 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.28.0 or later, and [Ninja][] 1.11.0 or later.
* Otherwise, install [CMake][] 3.29.0 or later, and [Ninja][] 1.11.0 or later.
* Make sure [Python][] 3.12 or later is available to CMake.
2. Open a command prompt.
3. Change directories to a location where you'd like a clone of this STL repository.
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

variables:
- name: poolName
value: 'StlBuild-2024-06-11T1315-Pool'
value: 'StlBuild-2024-07-09T1614-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/create-1es-hosted-pool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $ErrorActionPreference = 'Stop'

$CurrentDate = Get-Date

$Location = 'eastus'
$Location = 'eastus2'
$VMSize = 'Standard_D32ads_v5'
$ProtoVMName = 'PROTOTYPE'
$ImagePublisher = 'MicrosoftWindowsServer'
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ foreach ($workload in $VisualStudioWorkloads) {
}

# https://github.com/PowerShell/PowerShell/releases/latest
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi'
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.3/PowerShell-7.4.3-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe'
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.28.0)
cmake_minimum_required(VERSION 3.29.0)
project(msvc_standard_libraries_benchmarks LANGUAGES CXX)

if(DEFINED STL_BINARY_DIR)
Expand Down
31 changes: 21 additions & 10 deletions benchmarks/src/bitset_to_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,52 @@
using namespace std;

namespace {
const auto random_bits = [] {
template <size_t Elems>
auto random_bits_init() {
mt19937_64 rnd{};
array<uint64_t, 32> arr;
array<uint64_t, Elems> arr;
for (auto& d : arr) {
d = rnd();
}
return arr;
}();
}

template <size_t Elems = 32>
const auto random_bits = random_bits_init<Elems>();

template <size_t N, class charT>
void BM_bitset_to_string(benchmark::State& state) {
static_assert(N <= 64);

for (auto _ : state) {
for (const auto& bits : random_bits) {
for (const auto& bits : random_bits<>) {
benchmark::DoNotOptimize(bits);
bitset<N> bs{bits};
benchmark::DoNotOptimize(bs.to_string<charT>());
}
}
}

template <class charT>
template <size_t N, class charT>
void BM_bitset_to_string_large_single(benchmark::State& state) {
const auto large_bitset = bit_cast<bitset<CHAR_BIT * sizeof(random_bits)>>(random_bits);
static_assert(N % 64 == 0 && N >= 64);
const auto& bitset_data = random_bits<N / 64>;

const auto large_bitset = bit_cast<bitset<N>>(bitset_data);
for (auto _ : state) {
benchmark::DoNotOptimize(large_bitset);
benchmark::DoNotOptimize(large_bitset.to_string<charT>());
}
}
} // namespace

BENCHMARK(BM_bitset_to_string<15, char>);
BENCHMARK(BM_bitset_to_string<64, char>);
BENCHMARK(BM_bitset_to_string<512, char>);
BENCHMARK(BM_bitset_to_string_large_single<char>);
BENCHMARK(BM_bitset_to_string_large_single<512, char>);
BENCHMARK(BM_bitset_to_string_large_single<2048, char>);
BENCHMARK(BM_bitset_to_string<7, wchar_t>);
BENCHMARK(BM_bitset_to_string<64, wchar_t>);
BENCHMARK(BM_bitset_to_string<512, wchar_t>);
BENCHMARK(BM_bitset_to_string_large_single<wchar_t>);
BENCHMARK(BM_bitset_to_string_large_single<512, wchar_t>);
BENCHMARK(BM_bitset_to_string_large_single<2048, wchar_t>);

BENCHMARK_MAIN();
2 changes: 1 addition & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG)
generate_satellite_def("atomic_wait" "${D_SUFFIX}")

add_library(msvcp${D_SUFFIX}_atomic_wait SHARED "${CMAKE_BINARY_DIR}/msvcp_atomic_wait${D_SUFFIX}.def")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "advapi32.lib")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "advapi32.lib" "synchronization.lib")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_atomic_wait${D_SUFFIX}${VCLIBS_SUFFIX}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES OUTPUT_NAME "msvcp140${D_SUFFIX}_atomic_wait${VCLIBS_SUFFIX}")
Expand Down
5 changes: 2 additions & 3 deletions stl/inc/__msvc_bit_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,8 @@ _NODISCARD int _Checked_x86_x64_countr_zero(const _Ty _Val) noexcept {

#endif // _HAS_TZCNT_BSF_INTRINSICS

// TRANSITION, remove `_MSC_VER > 1940` check after MSVC-internal toolset update
#if (defined(_M_IX86) || defined(_M_X64) || (defined(_M_ARM64) && _MSC_VER > 1940)) && !defined(_M_CEE_PURE) \
&& !defined(__CUDACC__) && !defined(__INTEL_COMPILER)
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64)) && !defined(_M_CEE_PURE) && !defined(__CUDACC__) \
&& !defined(__INTEL_COMPILER)
#define _HAS_POPCNT_INTRINSICS 1
#if defined(__AVX__) || defined(_M_ARM64) || defined(_M_ARM64EC)
#define _POPCNT_INTRINSICS_ALWAYS_AVAILABLE 1
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ namespace chrono {
return time_point<_Clock, _To>(_CHRONO round<_To>(_Time.time_since_epoch()));
}

_EXPORT_STD struct system_clock { // wraps GetSystemTimePreciseAsFileTime/GetSystemTimeAsFileTime
_EXPORT_STD struct system_clock { // wraps GetSystemTimePreciseAsFileTime
using rep = long long;
using period = ratio<1, 10'000'000>; // 100 nanoseconds
using duration = _CHRONO duration<rep, period>;
Expand Down
87 changes: 82 additions & 5 deletions stl/inc/__msvc_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>
#if _HAS_CXX23
#include <xutility>
#endif // _HAS_CXX23

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
Expand Down Expand Up @@ -268,17 +271,91 @@ struct formatter<basic_string_view<_CharT, _Traits>, _CharT>
};

#if _HAS_CXX23
_EXPORT_STD template <class, class>
struct pair;
template <>
struct formatter<char*, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <>
struct formatter<const char*, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <size_t _Size>
struct formatter<char[_Size], wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

_EXPORT_STD template <class...>
class tuple;
template <class _Traits, class _Allocator>
struct formatter<basic_string<char, _Traits, _Allocator>, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

// Specializations for pairs and tuples are forward-declared to avoid any risk of using the disabled primary template.
template <class _Traits>
struct formatter<basic_string_view<char, _Traits>, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

_EXPORT_STD enum class range_format { disabled, map, set, sequence, string, debug_string };

template <class _Ty>
struct _Invalid_format_kind {
static_assert(_Always_false<_Ty>, "A program that instantiates the primary template of format_kind is ill-formed. "
"(N4981 [format.range.fmtkind]/1)");
};

_EXPORT_STD template <class _Ty>
constexpr _Invalid_format_kind<_Ty> format_kind;

template <class _Ty>
constexpr bool _Is_two_tuple = false;

template <class _Ty, class _Uty>
constexpr bool _Is_two_tuple<pair<_Ty, _Uty>> = true;

template <class _Ty, class _Uty>
constexpr bool _Is_two_tuple<tuple<_Ty, _Uty>> = true;

template <_RANGES input_range _Rng>
requires same_as<_Rng, remove_cvref_t<_Rng>>
constexpr range_format format_kind<_Rng> = []() consteval {
using _Ref_value_t = remove_cvref_t<_RANGES range_reference_t<_Rng>>;
if constexpr (same_as<_Ref_value_t, _Rng>) {
return range_format::disabled;
} else if constexpr (requires { typename _Rng::key_type; }) {
if constexpr (requires { typename _Rng::mapped_type; } && _Is_two_tuple<_Ref_value_t>) {
return range_format::map;
} else {
return range_format::set;
}
} else {
return range_format::sequence;
}
}();

// Specializations for pairs, tuples, and ranges are forward-declared to avoid any risk of using the disabled primary
// template.

// Per LWG-3997, `_CharT` in library-provided `formatter` specializations is
// constrained to character types supported by `format`.

template <class _Rng>
concept _Formatting_enabled_range = format_kind<_Rng> != range_format::disabled;

template <_RANGES input_range _Rng, _Format_supported_charT _CharT>
requires _Formatting_enabled_range<_Rng>
struct formatter<_Rng, _CharT>;

template <_Format_supported_charT _CharT, class _Ty1, class _Ty2>
struct formatter<pair<_Ty1, _Ty2>, _CharT>;

Expand Down
Loading