Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 19 additions & 14 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ assignees: ''

---

**Describe the bug**
# Describe the bug
A clear and concise description of what the bug is. Please check that you've
read the guidelines for submitting STL bug reports in `README.md`. If you are
having problems with any component that is not the STL, instructions to get
to the right place are there.

**Command-line test case**
# Command-line test case
```
C:\Temp>type repro.cpp
#include <iostream>
Expand All @@ -26,12 +26,18 @@ int main() {
std::cout << "test failure\n";
}

C:\Temp>cl /EHsc /W4 /WX .\repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28019.1 for x64
C:\Temp>cl /EHsc /W4 /WX /std:c++latest .\repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32522 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.

repro.cpp
Microsoft (R) Incremental Linker Version 14.23.28019.1
Microsoft (R) Incremental Linker Version 14.36.32522.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:repro.exe
Expand All @@ -41,25 +47,24 @@ C:\Temp>.\repro.exe
test failure
```

**Expected behavior**
# Expected behavior
A clear and concise description of what you expected to happen.
Alternatively, include `static_assert` or `assert` lines in your
test case above whose failure clearly indicates the problem.

**STL version**
# STL version
* Option 1: Visual Studio version
* Displayed in Help > About Microsoft Visual Studio
* Example:
+ Help > About Microsoft Visual Studio > Copy Info, we need only the first two lines
+ Example:
```
Microsoft Visual Studio Community 2019 Preview
Version 16.5.0 Preview 5.0
Microsoft Visual Studio Community 2022
Version 17.6.0 Preview 3.0
```

* Option 2: git commit hash
* Example:
+ Example:
```
https://github.com/microsoft/STL/commit/2195148
```

**Additional context**
# Additional context
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion 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.25.2)
cmake_minimum_required(VERSION 3.26.0)

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 @@ -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.6 Preview 1 or later.
1. Install Visual Studio 2022 17.6 Preview 3 or later.
* Select "Windows 11 SDK (10.0.22000.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.25.2 or later, and [Ninja][] 1.11.0 or later.
* Otherwise, install [CMake][] 3.26.0 or later, and [Ninja][] 1.11.0 or later.
* We recommend selecting "Python 3 64-bit" in the VS Installer.
* Otherwise, make sure [Python][] 3.9 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,
Expand All @@ -157,11 +157,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.6 Preview 1 or later.
1. Install Visual Studio 2022 17.6 Preview 3 or later.
* Select "Windows 11 SDK (10.0.22000.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.25.2 or later, and [Ninja][] 1.11.0 or later.
* Otherwise, install [CMake][] 3.26.0 or later, and [Ninja][] 1.11.0 or later.
* We recommend selecting "Python 3 64-bit" in the VS Installer.
* Otherwise, make sure [Python][] 3.9 or later is available to CMake.
2. Open a command prompt.
Expand Down
22 changes: 18 additions & 4 deletions azure-devops/create-1es-hosted-pool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ See https://github.com/microsoft/STL/wiki/Checklist-for-Toolset-Updates for more

$ErrorActionPreference = 'Stop'

# https://aka.ms/azps-changewarnings
$Env:SuppressAzurePowerShellBreakingChangeWarnings = 'true'

$CurrentDate = Get-Date

$Location = 'eastus'
Expand All @@ -24,7 +21,7 @@ $ImageOffer = 'WindowsServer'
$ImageSku = '2022-datacenter-g2'

$ProgressActivity = 'Preparing STL CI pool'
$TotalProgress = 25
$TotalProgress = 26
$CurrentProgress = 1

<#
Expand Down Expand Up @@ -120,6 +117,13 @@ function Wait-Shutdown {
}
}

####################################################################################################
Display-ProgressBar -Status 'Silencing breaking change warnings'

# https://aka.ms/azps-changewarnings
Update-AzConfig `
-DisplayBreakingChangeWarning $false `
-Scope 'Process' | Out-Null

####################################################################################################
Display-ProgressBar -Status 'Setting the subscription context'
Expand Down Expand Up @@ -207,6 +211,15 @@ $VM = Set-AzVMBootDiagnostic `
-VM $VM `
-Disable

$VM = Set-AzVMSecurityProfile `
-VM $VM `
-SecurityType 'TrustedLaunch'

$VM = Set-AzVMUefi `
-VM $VM `
-EnableVtpm $true `
-EnableSecureBoot $true

New-AzVm `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
Expand Down Expand Up @@ -305,6 +318,7 @@ New-AzGalleryImageDefinition `
-Publisher $ImagePublisher `
-Offer $ImageOffer `
-Sku $ImageSku `
-Feature @(@{ Name = 'SecurityType'; Value = 'TrustedLaunch'; }) `
-HyperVGeneration 'V2' | Out-Null

####################################################################################################
Expand Down
29 changes: 3 additions & 26 deletions azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if ([string]::IsNullOrEmpty($AdminUserPassword)) {
$PsExecPath = Join-Path $ExtractedPsToolsPath 'PsExec64.exe'

# https://github.com/PowerShell/PowerShell/releases/latest
$PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/PowerShell-7.3.2-win-x64.zip'
$PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/PowerShell-7.3.3-win-x64.zip'
Write-Host "Downloading: $PowerShellZipUrl"
$ExtractedPowerShellPath = DownloadAndExtractZip -Url $PowerShellZipUrl
$PwshPath = Join-Path $ExtractedPowerShellPath 'pwsh.exe'
Expand Down Expand Up @@ -128,20 +128,15 @@ $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.ARM64EC',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'Microsoft.VisualStudio.Component.Windows11SDK.22000'
)

$ReleaseInPath = 'Preview'
$Sku = 'Enterprise'
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.11.3/python-3.11.3-amd64.exe'

$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_511.23_windows.exe'

Expand Down Expand Up @@ -187,19 +182,11 @@ The set of VS workloads to install.

.PARAMETER BootstrapperUrl
The URL of the Visual Studio installer, i.e. one of vs_*.exe.

.PARAMETER InstallPath
The path to install Visual Studio at.

.PARAMETER Nickname
The nickname to give the installation.
#>
Function InstallVisualStudio {
Param(
[String[]]$Workloads,
[String]$BootstrapperUrl,
[String]$InstallPath = $null,
[String]$Nickname = $null
[String]$BootstrapperUrl
)

try {
Expand All @@ -213,16 +200,6 @@ Function InstallVisualStudio {
$args += $workload
}

if (-not ([String]::IsNullOrWhiteSpace($InstallPath))) {
$args += '--installpath'
$args += $InstallPath
}

if (-not ([String]::IsNullOrWhiteSpace($Nickname))) {
$args += '--nickname'
$args += $Nickname
}

$proc = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru
PrintMsiExitCodeMessage $proc.ExitCode
}
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variables:
benchmarkBuildOutputLocation: 'D:\benchmark'

pool:
name: 'StlBuild-2023-02-21T1058-Pool'
name: 'StlBuild-2023-04-11T1428-Pool'
demands: EnableSpotVM -equals true

pr:
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.25.2)
cmake_minimum_required(VERSION 3.26.0)
project(msvc_standard_libraries_benchmarks LANGUAGES CXX)

if(DEFINED STL_BINARY_DIR)
Expand Down
2 changes: 1 addition & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded")

add_compile_options(/WX /Gy
"$<$<COMPILE_LANGUAGE:CXX>:/diagnostics:caret;/W4;/w14265;/w15038;/fastfail;/guard:cf;/Zp8;/std:c++latest;/permissive-;/Zc:threadSafeInit-;/Zl>"
"$<$<COMPILE_LANGUAGE:ASM_MASM>:/W3;/nologo>"
"$<$<COMPILE_LANGUAGE:ASM_MASM>:/W3;/nologo;/quiet>"
)

include_directories(BEFORE
Expand Down
19 changes: 6 additions & 13 deletions stl/inc/array
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ struct pointer_traits<_Array_iterator<_Ty, _Size>> {
_EXPORT_STD template <class _Ty, size_t _Size>
class array { // fixed size array of values
public:
static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types "
"because of [container.requirements].");

using value_type = _Ty;
using size_type = size_t;
using difference_type = ptrdiff_t;
Expand Down Expand Up @@ -592,6 +595,9 @@ struct _Empty_array_element {};
template <class _Ty>
class array<_Ty, 0> {
public:
static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types "
"because of [container.requirements].");

using value_type = _Ty;
using size_type = size_t;
using difference_type = ptrdiff_t;
Expand Down Expand Up @@ -769,11 +775,7 @@ _CONSTEXPR20 void swap(array<_Ty, _Size>& _Left, array<_Ty, _Size>& _Right) noex

_EXPORT_STD template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator==(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD equal(_Left.begin(), _Left.end(), _Right.begin());
#else // ^^^ workaround / no workaround vvv
return _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin());
#endif // ^^^ no workaround ^^^
}

#if !_HAS_CXX20
Expand All @@ -787,23 +789,14 @@ _NODISCARD bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Siz
_EXPORT_STD template <class _Ty, size_t _Size>
_NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>(
const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD lexicographical_compare_three_way(
_Left.begin(), _Left.end(), _Right.begin(), _Right.end(), _Synth_three_way{});
#else // ^^^ workaround / no workaround vvv
return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(),
_Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{});
#endif // ^^^ no workaround ^^^
}
#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv
template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator<(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD lexicographical_compare(_Left.begin(), _Left.end(), _Right.begin(), _Right.end());
#else // ^^^ workaround / no workaround vvv
return _STD lexicographical_compare(
_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end());
#endif // ^^^ no workaround ^^^
}

template <class _Ty, size_t _Size>
Expand Down
20 changes: 11 additions & 9 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ extern "C" _NODISCARD char __stdcall __std_atomic_has_cmpxchg16b() noexcept;
// Controls whether ARM64 ldar/ldapr/stlr should be used
#ifndef _STD_ATOMIC_USE_ARM64_LDAR_STLR
#if defined(_M_ARM64) || defined(_M_ARM64EC)
#if defined(_HAS_ARM64_LOAD_ACQUIRE) && _HAS_ARM64_LOAD_ACQUIRE == 1 // TRANSITION, VS 2022 17.7 Preview 1
#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 1
#else // ^^^ updated intrin0.inl.h is available / workaround vvv
#ifdef __clang__ // TRANSITION, LLVM-62103
#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 0
#endif // ^^^ workaround ^^^
#else // ^^^ Clang doesn't support new intrinsics / __load_acquire/__stlr intrinsics are available vvv
#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 1
#endif // ^^^ __load_acquire/__stlr intrinsics are available ^^^
#else // ^^^ ARM64/ARM64EC / Other architectures vvv
#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 0
#endif // defined(_M_ARM64) || defined(_M_ARM64EC)
Expand Down Expand Up @@ -141,7 +141,7 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept {
#if _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1

#define __LOAD_ACQUIRE_ARM64(_Width, _Ptr) \
__load_acquire##_Width(reinterpret_cast<const volatile unsigned __int##_Width*>(_Ptr))
static_cast<__int##_Width>(__load_acquire##_Width(reinterpret_cast<const volatile unsigned __int##_Width*>(_Ptr)))

#define _ATOMIC_LOAD_ARM64(_Result, _Width, _Ptr, _Order_var) \
switch (_Order_var) { \
Expand Down Expand Up @@ -184,7 +184,8 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept {

#define __STORE_RELEASE(_Width, _Ptr, _Desired) \
_Compiler_barrier(); \
__stlr##_Width(reinterpret_cast<volatile unsigned __int##_Width*>(_Ptr), (_Desired));
__stlr##_Width( \
reinterpret_cast<volatile unsigned __int##_Width*>(_Ptr), static_cast<unsigned __int##_Width>(_Desired));

#else // ^^^ _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1 ^^^ / vvv _STD_ATOMIC_USE_ARM64_LDAR_STLR == 0 vvv

Expand Down Expand Up @@ -214,9 +215,10 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept {
_Memory_barrier();

#if _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1
#define _ATOMIC_STORE_SEQ_CST_ARM64(_Width, _Ptr, _Desired) \
_Compiler_barrier(); \
__stlr##_Width(reinterpret_cast<volatile unsigned __int##_Width*>(_Ptr), (_Desired)); \
#define _ATOMIC_STORE_SEQ_CST_ARM64(_Width, _Ptr, _Desired) \
_Compiler_barrier(); \
__stlr##_Width( \
reinterpret_cast<volatile unsigned __int##_Width*>(_Ptr), static_cast<unsigned __int##_Width>(_Desired)); \
_Memory_barrier();
#else
#define _ATOMIC_STORE_SEQ_CST_ARM64 _ATOMIC_STORE_SEQ_CST_ARM
Expand Down
1 change: 1 addition & 0 deletions stl/inc/bit
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
_EMIT_STL_WARNING(STL4038, "The contents of <bit> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <cstdlib>
#include <isa_availability.h>
#include <limits>
#include <type_traits>
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -4998,7 +4998,7 @@ namespace chrono {
_Write_seconds(_Os, _Hh_mm_ss_part_underflow_to_zero(_Val));
}

_EXPORT_STD /* TRANSITION, VSO-1582358 */ template <class _Ty>
template <class _Ty>
_NODISCARD tm _Fill_tm(const _Ty& _Val) {
unsigned int _Day = 0;
unsigned int _Month = 0;
Expand Down Expand Up @@ -6011,7 +6011,7 @@ namespace chrono {
template <class _Duration>
_NODISCARD string ambiguous_local_time::_Make_string(const local_time<_Duration>& _Tp, const local_info& _Info) {
ostringstream _Os;
_Os << _Tp << " is ambiguous. It could be\n"
_Os << _Tp << " is ambiguous. It could be\n"
<< _Tp << ' ' << _Info.first.abbrev << " == " << _Tp - _Info.first.offset << " UTC or\n"
<< _Tp << ' ' << _Info.second.abbrev << " == " << _Tp - _Info.second.offset << " UTC";
return _STD move(_Os).str();
Expand Down
Loading