Skip to content

Commit

Permalink
VS 2019 16.9 Preview 1 toolset update (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej authored Nov 13, 2020
1 parent 9959929 commit ea156e7
Show file tree
Hide file tree
Showing 22 changed files with 90 additions and 119 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: cxx20 Feature
name: cxx23 Feature
about: For STL maintainers only
title: PAPER_NUMBER PAPER_TITLE
labels: cxx20
labels: cxx23
assignees: ''

---
Expand All @@ -22,3 +22,8 @@ the https://wg21.link redirector will start working.

Feature-test macro:
`#define MACRO_NAME MACRO_VALUE`

Note: We're still working on finishing C++20. Until we're done
with that (and the compiler implements distinct `/std:c++20` and
`/std:c++latest` options), we won't be able to review PRs for
C++23 features.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/vcpkg
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()

cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.18)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(msvc_standard_libraries LANGUAGES CXX)

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ 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.8 Preview 5 or later.
1. Install Visual Studio 2019 16.9 Preview 1 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.17 or later, and [Ninja][] 1.8.2 or later.
* Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later.
2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository,
`https://github.com/microsoft/STL`.
3. Open a terminal in the IDE with `` Ctrl + ` `` (by default) or press on "View" in the top bar, and then "Terminal".
Expand All @@ -158,10 +158,10 @@ acquire this dependency.

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2019 16.8 Preview 5 or later.
1. Install Visual Studio 2019 16.9 Preview 1 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.17 or later, and [Ninja][] 1.8.2 or later.
* Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later.
2. Open a command prompt.
3. Change directories to a location where you'd like a clone of this STL repository.
4. `git clone https://github.com/microsoft/STL`
Expand Down
12 changes: 9 additions & 3 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $LiveVMPrefix = 'BUILD'
$WindowsServerSku = '2019-Datacenter'

$ProgressActivity = 'Creating Scale Set'
$TotalProgress = 11
$TotalProgress = 12
$CurrentProgress = 1

<#
Expand Down Expand Up @@ -159,6 +159,14 @@ function Wait-Shutdown {
}


####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Setting the subscription context' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

Set-AzContext -SubscriptionName CPP_STL_GitHub

####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
Expand Down Expand Up @@ -391,6 +399,4 @@ New-AzVmss `
Write-Progress -Activity $ProgressActivity -Completed
Write-Host "Location: $Location"
Write-Host "Resource group name: $ResourceGroupName"
Write-Host "User name: AdminUser"
Write-Host "Using generated password: $AdminPW"
Write-Host 'Finished!'
37 changes: 37 additions & 0 deletions azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ $Workloads = @(
'Microsoft.VisualStudio.Component.VC.CMake.Project',
'Microsoft.VisualStudio.Component.VC.CoreIde',
'Microsoft.VisualStudio.Component.VC.Llvm.Clang',
'Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre',
'Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre',
'Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre',
'Microsoft.VisualStudio.Component.VC.Tools.ARM',
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
Expand All @@ -99,6 +102,9 @@ $Sku = 'Enterprise'
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/16/pre/vs_enterprise.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe'

# https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
$WindowsDriverKitUrl = 'https://go.microsoft.com/fwlink/?linkid=2128854'

$CudaUrl = `
'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe'
$CudaFeatures = 'nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 ' + `
Expand Down Expand Up @@ -223,6 +229,36 @@ Function InstallPython {
}
}

<#
.SYNOPSIS
Installs the Windows Driver Kit.
.DESCRIPTION
InstallWindowsDriverKit installs the Windows Driver Kit from the supplied URL.
.PARAMETER Url
The URL of the Windows Driver Kit installer.
#>
Function InstallWindowsDriverKit {
Param(
[String]$Url
)

Write-Host 'Downloading the Windows Driver Kit...'
[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
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
}
}

<#
.SYNOPSIS
Installs NVIDIA's CUDA Toolkit.
Expand Down Expand Up @@ -300,6 +336,7 @@ Add-MpPreference -ExclusionProcess python.exe

InstallPython $PythonUrl
InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl
InstallWindowsDriverKit $WindowsDriverKitUrl
InstallCuda -Url $CudaUrl -Features $CudaFeatures

Write-Host 'Updating PATH...'
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
variables:
tmpDir: 'D:\Temp'

pool: 'StlBuild-2020-10-23'
pool: 'StlBuild-2020-11-10'

stages:
- stage: Code_Format
Expand Down
8 changes: 0 additions & 8 deletions stl/inc/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ namespace filesystem {

_NODISCARD inline bool _Is_drive_prefix_with_slash_slash_question(const wstring_view _Text) {
// test if _Text starts with a \\?\X: prefix
using namespace _STD string_view_literals; // TRANSITION, VSO-571749
return _Text.size() >= 6 && _Text._Starts_with(LR"(\\?\)"sv) && _Is_drive_prefix(_Text.data() + 4);
}

Expand Down Expand Up @@ -1250,8 +1249,6 @@ namespace filesystem {
}

_NODISCARD path lexically_normal() const {
using namespace _STD string_view_literals; // TRANSITION, VSO-571749

constexpr wstring_view _Dot = L"."sv;
constexpr wstring_view _Dot_dot = L".."sv;

Expand Down Expand Up @@ -1686,8 +1683,6 @@ namespace filesystem {
}

_NODISCARD inline path path::lexically_relative(const path& _Base) const {
using namespace _STD string_view_literals; // TRANSITION, VSO-571749

constexpr wstring_view _Dot = L"."sv;
constexpr wstring_view _Dot_dot = L".."sv;

Expand Down Expand Up @@ -1810,7 +1805,6 @@ namespace filesystem {

private:
static string _Pretty_message(const string_view _Op, const path& _Path1, const path& _Path2 = {}) {
using namespace _STD string_view_literals; // TRANSITION, VSO-571749
string _Result;
// Convert the paths to narrow encoding in a way that gracefully handles non-encodable characters
const auto _Code_page = __std_fs_code_page();
Expand Down Expand Up @@ -2550,7 +2544,6 @@ namespace filesystem {

_NODISCARD static __std_win_error _Open_dir(
path& _Path, const directory_options _Options_arg, _Find_file_handle& _Dir, __std_fs_find_data& _Data) {
using namespace _STD string_view_literals; // TRANSITION, VSO-571749
const size_t _Null_term_len = _CSTD wcslen(_Path.c_str());
if (_Null_term_len == 0 || _Null_term_len != _Path.native().size()) {
return __std_win_error::_File_not_found;
Expand Down Expand Up @@ -3021,7 +3014,6 @@ namespace filesystem {

// FUNCTION canonical
_NODISCARD inline __std_win_error _Canonical(path& _Result, const wstring& _Text) { // pre: _Result.empty()
using namespace _STD string_view_literals; // TRANSITION, VSO-571749
if (_Text.empty()) {
return __std_win_error::_Success;
}
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/memory_resource
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ namespace pmr {
}

protected:
virtual void* do_allocate(size_t _Bytes, size_t _Align) override { // TRANSITION, DevCom-1159869
virtual void* do_allocate(const size_t _Bytes, const size_t _Align) override {
// allocate from the current buffer or a new larger buffer from upstream
if (!_STD align(_Align, _Bytes, _Current_buffer, _Space_available)) {
_Increase_capacity(_Bytes, _Align);
Expand Down
24 changes: 11 additions & 13 deletions stl/inc/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ public:
template <size_t _Index, class... _Types>
friend constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const tuple<_Types...>&& _Tuple) noexcept;

template <size_t _Index, class... _Types>
friend constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept;

template <class _Ty, class... _Types>
friend constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept;

Expand Down Expand Up @@ -796,6 +799,14 @@ _NODISCARD constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const
return static_cast<const _Ty&&>(static_cast<const _Ttype&>(_Tuple)._Myfirst._Val);
}

template <size_t _Index, class... _Types>
_NODISCARD constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept {
// used by pair's piecewise constructor
using _Ty = tuple_element_t<_Index, tuple<_Types...>>;
using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype;
return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val);
}

// FUNCTION TEMPLATE get (by type)
template <class _Ty, class... _Types>
_NODISCARD constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept {
Expand Down Expand Up @@ -971,19 +982,6 @@ _NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) { // construct _Ty from
}
#endif // _HAS_CXX17

// TEMPLATE CONSTRUCTOR pair::pair(tuple, tuple, sequence, sequence)
template <class _Ty1, class _Ty2>
template <class _Tuple1, class _Tuple2, size_t... _Indexes1, size_t... _Indexes2>
constexpr pair<_Ty1, _Ty2>::pair(
_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>)
: first(_STD get<_Indexes1>(_STD move(_Val1))...), second(_STD get<_Indexes2>(_STD move(_Val2))...) {}

// TEMPLATE CONSTRUCTOR pair::pair(piecewise_construct_t, tuple, tuple)
template <class _Ty1, class _Ty2>
template <class... _Types1, class... _Types2>
_CONSTEXPR20 pair<_Ty1, _Ty2>::pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2)
: pair(_Val1, _Val2, index_sequence_for<_Types1...>{}, index_sequence_for<_Types2...>{}) {}

// STRUCT TEMPLATE uses_allocator
template <class... _Types, class _Alloc>
struct uses_allocator<tuple<_Types...>, _Alloc> : true_type {}; // true_type if container allocator enabled
Expand Down
9 changes: 7 additions & 2 deletions stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ _INLINE_VAR constexpr piecewise_construct_t piecewise_construct{};
template <class...>
class tuple;

template <size_t _Index, class... _Types>
_NODISCARD constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept;

template <class _Ty1, class _Ty2>
struct pair { // store a pair of values
using first_type = _Ty1;
Expand Down Expand Up @@ -263,10 +266,12 @@ struct pair { // store a pair of values
#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^

template <class _Tuple1, class _Tuple2, size_t... _Indexes1, size_t... _Indexes2>
constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>);
constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>)
: first(_Tuple_get<_Indexes1>(_STD move(_Val1))...), second(_Tuple_get<_Indexes2>(_STD move(_Val2))...) {}

template <class... _Types1, class... _Types2>
_CONSTEXPR20 pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2);
_CONSTEXPR20 pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2)
: pair(_Val1, _Val2, index_sequence_for<_Types1...>{}, index_sequence_for<_Types2...>{}) {}

pair& operator=(const volatile pair&) = delete;

Expand Down
6 changes: 1 addition & 5 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,12 +1184,8 @@
#define __cpp_lib_constexpr_tuple 201811L
#define __cpp_lib_constexpr_utility 201811L

#ifdef __cpp_impl_coroutine // TRANSITION, Clang and EDG coroutine support
#if __cpp_impl_coroutine >= 201902L
#ifdef __cpp_impl_coroutine // TRANSITION, Clang coroutine support
#define __cpp_lib_coroutine 201902L
#else // ^^^ __cpp_impl_coroutine >= 201902L ^^^ / vvv __cpp_impl_coroutine < 201902L vvv
#define __cpp_lib_coroutine 197000L // TRANSITION, VS 2019 16.8 Preview 4
#endif // ^^^ __cpp_impl_coroutine < 201902L ^^^
#endif // __cpp_impl_coroutine

#define __cpp_lib_destroying_delete 201806L
Expand Down
2 changes: 1 addition & 1 deletion tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp FAIL
std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp FAIL
std/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp FAIL
std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp FAIL
std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp:1 FAIL
std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp FAIL
std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.pass.cpp FAIL
std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp FAIL
Expand Down
6 changes: 2 additions & 4 deletions tests/std/tests/P0433R2_deduction_guides/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,12 @@ long add(short x, int y) {
return x + y;
}

struct UniqueTagCanDeduceFrom {}; // TRANSITION, VSO-587956

template <typename Void, template <typename...> class ClassTemplate, typename... CtorArgs>
struct CanDeduceFromHelper : false_type {};

template <template <typename...> class ClassTemplate, typename... CtorArgs>
struct CanDeduceFromHelper<void_t<UniqueTagCanDeduceFrom, decltype(ClassTemplate(declval<CtorArgs>()...))>,
ClassTemplate, CtorArgs...> : true_type {};
struct CanDeduceFromHelper<void_t<decltype(ClassTemplate(declval<CtorArgs>()...))>, ClassTemplate, CtorArgs...>
: true_type {};

template <template <typename...> class ClassTemplate, typename... CtorArgs>
constexpr bool CanDeduceFrom = CanDeduceFromHelper<void, ClassTemplate, CtorArgs...>::value;
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/P0896R4_ranges_range_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,8 @@ namespace borrowed_range_testing {
STATIC_ASSERT(test_borrowed_range<std::span<int>, std::span<int>::iterator>());
STATIC_ASSERT(test_borrowed_range<std::span<int, 42>, std::span<int, 42>::iterator>());
STATIC_ASSERT(test_borrowed_range<ranges::subrange<int*, int*>, int*>());
#if 0 // TRANSITION, future
STATIC_ASSERT(test_borrowed_range<ranges::ref_view<int[42]>, int*>());
#if 0 // TRANSITION, future
STATIC_ASSERT(test_borrowed_range<ranges::iota_view<int, int>, ...>());
#endif // TRANSITION, future

Expand Down
3 changes: 0 additions & 3 deletions tests/std/tests/P0896R4_views_common/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate common_view::base() && (NB: do this last since it leaves r moved-from)
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
same_as<V> auto b2 = move(r).base();
static_assert(noexcept(move(r).base()) == is_nothrow_move_constructible_v<V>);
if (!is_empty) {
Expand Down
3 changes: 0 additions & 3 deletions tests/std/tests/P0896R4_views_drop_while/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate deduction guide
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
same_as<R> auto r = drop_while_view{forward<Rng>(rng), is_less_than<3>};
assert(ranges::equal(r, expected));
if constexpr (forward_range<V>) {
Expand Down
6 changes: 0 additions & 6 deletions tests/std/tests/P0896R4_views_filter/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate deduction guide
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
same_as<F> auto r = filter_view{forward<Rng>(rng), is_even};
assert(ranges::equal(r, expected));
if constexpr (forward_range<V>) {
Expand Down Expand Up @@ -263,9 +260,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate filter_view::base() && (NB: do this last since it leaves r moved-from)
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
if (forward_range<V>) { // intentionally not if constexpr
same_as<V> auto b2 = move(r).base();
STATIC_ASSERT(noexcept(move(r).base()) == is_nothrow_move_constructible_v<V>);
Expand Down
6 changes: 0 additions & 6 deletions tests/std/tests/P0896R4_views_reverse/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate deduction guide
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
same_as<R> auto r = reverse_view{forward<Rng>(rng)};
assert(ranges::equal(r, expected));

Expand Down Expand Up @@ -294,9 +291,6 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Validate reverse_view::base() && (NB: do this last since it leaves r moved-from)
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1159442
(void) 42;
#endif // TRANSITION, DevCom-1159442
same_as<V> auto b2 = move(r).base();
static_assert(noexcept(move(r).base()) == is_nothrow_move_constructible_v<V>);
if (!is_empty) {
Expand Down
Loading

0 comments on commit ea156e7

Please sign in to comment.