Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
54be1fd
STL updates for new EDG version (#1216)
CaseyCarter Aug 21, 2020
a293fad
Updated README.md - Use the vcpkg submodule instead of separately clo…
amit-rastogi Aug 22, 2020
aafee76
Implement ranges::ref_view (#1132)
miscco Aug 22, 2020
465d0a5
Fix errors in hyperbolic function crossover (#1156)
MattStephanson Aug 22, 2020
0b81475
Fix ostream << floating_point not correctly handling precision (#1173)
statementreply Aug 22, 2020
0926c82
Add test to cover deque::erase(iter, iter) avoiding self-move-assigns…
Arzaghi Aug 22, 2020
22d061b
Update test configurations (remove /await and skips, add missing opti…
StephanTLavavej Aug 22, 2020
8ee6e65
Fix counted_iterator unwrapping bug (#1213)
CaseyCarter Aug 22, 2020
7a7602c
Limit line length to 120 columns (#1214)
CaseyCarter Aug 22, 2020
484fbc9
Test <coroutine> (#1215)
StephanTLavavej Aug 22, 2020
5bf2826
Turn on /analyze (for PR/CI builds) and fix resulting warnings (#1009)
BillyONeal Aug 26, 2020
fb11d09
<valarray>: Expand macros, avoid magic statics (#1165)
AlexGuteniev Aug 26, 2020
ea1aaf7
get_time() should ignore case when parsing days and months (#1168)
Arzaghi Aug 26, 2020
7b0167c
Implement views::empty and views::single range factories (#1201)
CaseyCarter Aug 26, 2020
20fe376
Coroutine promise types must have member unhandled_exception in C++20…
CaseyCarter Aug 26, 2020
1e26743
Improve vector growth performance near max_size (#1221)
Arzaghi Aug 26, 2020
2bec360
Revert 64-bit interlocked intrinsics on x86 (#1222)
StephanTLavavej Aug 26, 2020
ab6cbd3
LWG-1203 More useful rvalue stream insertion (#1225)
StephanTLavavej Aug 26, 2020
2c912e9
Strengthen noexcept specification for container iterators (#1227)
miscco Aug 26, 2020
0c368b1
CMakeLists.txt: Remove unnecessary /d2Zi+ option (#1218)
Arzaghi Aug 26, 2020
c9a43aa
README improvements, minor cleanups (#1226)
StephanTLavavej Aug 26, 2020
c74ab69
VS 2019 16.8 Preview 2 toolset upgrade (#1233)
StephanTLavavej Aug 27, 2020
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
Expand Up @@ -67,8 +67,7 @@ add_compile_definitions(
_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH WIN32_LEAN_AND_MEAN STRICT _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS
_CRT_DECLARE_NONSTDC_NAMES=1 )

# TRANSITION, /analyze ?
add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guard:cf /Z7 /d2Zi+ /Gm- /Gy /Zp8 /std:c++latest /permissive- /Zc:threadSafeInit- /Zl)
add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guard:cf /Z7 /Gm- /Gy /Zp8 /std:c++latest /permissive- /Zc:threadSafeInit- /Zl)

set(VCLIBS_DEBUG_OPTIONS "/Od")
set(VCLIBS_RELEASE_OPTIONS "/O2;/Os") # TRANSITION: Potentially remove /Os
Expand Down
118 changes: 61 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Microsoft's C++ Standard Library

This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL),
which ships as part of the MSVC toolset and the Visual Studio IDE. Our [Changelog][] tracks which updates to this
repository appear in each VS release.
which ships as part of the MSVC toolset and the Visual Studio IDE.

* Our [Changelog][] tracks which updates to this repository appear in each VS release.
* Our [Status Chart][] displays our overall progress over time.
* Join our [Discord server][].

[![Build Status](https://dev.azure.com/vclibs/STL/_apis/build/status/microsoft.STL?branchName=master)][Pipelines]

Expand Down Expand Up @@ -140,38 +143,46 @@ 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 1 or later.
2. Invoke `git clone https://github.com/microsoft/vcpkg`
3. Invoke `cd vcpkg`
4. Invoke `.\bootstrap-vcpkg.bat`
5. Assuming you are targeting x86 and x64, invoke `.\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows`
to install the boost-math dependency. Add `boost-math:arm-windows boost-math:arm64-windows` to this to target ARM
and ARM64.
6. Run `.\vcpkg.exe integrate install` which tells Visual Studio which vcpkg instance you wish to use. If you have never
done this before, you may be prompted to elevate.
7. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL to this
repository, typically `https://github.com/microsoft/STL`
8. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake
settings are set by `CMakeSettings.json` and `vcpkg integrate`
1. Install Visual Studio 2019 16.8 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.17 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".
4. In the terminal, invoke `git submodule update --init vcpkg`
5. In the terminal, invoke `.\vcpkg\bootstrap-vcpkg.bat`
6. In the terminal, invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows`
7. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake
settings are set by `CMakeSettings.json`.

# How To Build With A Native Tools Command Prompt

These instructions assume you're targeting `x64-windows`; you can change this constant below to target other
architectures.

1. Install Visual Studio 2019 16.8 Preview 1 or later.
1. Install Visual Studio 2019 16.8 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.17 or later, and [Ninja][] 1.8.2 or later.
2. Open an "x64 Native Tools Command Prompt for VS 2019".
2. Open a command prompt.
3. Change directories to a location where you'd like a clone of this STL repository.
4. Invoke `git clone https://github.com/microsoft/STL`
5. Invoke `cd STL`
6. Invoke `git submodule update --init vcpkg`
7. Invoke `.\vcpkg\bootstrap-vcpkg.bat`
8. Invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows` to install the boost-math dependency.
9. Invoke `cmake -G Ninja -S . -B {wherever you want binaries}` to configure the project. For example, `cmake -G Ninja -S . -B out\build\x64`
10. Invoke `ninja -C {wherever you want binaries}` to build the project. For example, `ninja -C out\build\x64`
4. `git clone https://github.com/microsoft/STL`
5. `cd STL`
6. `git submodule update --init vcpkg`
7. `.\vcpkg\bootstrap-vcpkg.bat`
8. `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows`

To build the x86 target:

1. Open an "x86 Native Tools Command Prompt for VS 2019".
2. Change directories to the previously cloned `STL` directory.
3. `cmake -G Ninja -S . -B out\build\x86`
4. `ninja -C out\build\x86`

To build the x64 target:

1. Open an "x64 Native Tools Command Prompt for VS 2019".
2. Change directories to the previously cloned `STL` directory.
3. `cmake -G Ninja -S . -B out\build\x64`
4. `ninja -C out\build\x64`

# How To Consume

Expand All @@ -197,26 +208,26 @@ for DLL dependencies according to directories in the `PATH` environment variable
"x64 Native Tools Command Prompt for VS 2019":

```
C:\Users\bion\Desktop>set INCLUDE=C:\Dev\STL\out\build\x64\out\inc;%INCLUDE%
C:\Users\username\Desktop>set INCLUDE=C:\Dev\STL\out\build\x64\out\inc;%INCLUDE%

C:\Users\bion\Desktop>set LIB=C:\Dev\STL\out\build\x64\out\lib\amd64;%LIB%
C:\Users\username\Desktop>set LIB=C:\Dev\STL\out\build\x64\out\lib\amd64;%LIB%

C:\Users\bion\Desktop>set PATH=C:\Dev\STL\out\build\x64\out\bin\amd64;%PATH%
C:\Users\username\Desktop>set PATH=C:\Dev\STL\out\build\x64\out\bin\amd64;%PATH%

C:\Users\bion\Desktop>type example.cpp
C:\Users\username\Desktop>type example.cpp
#include <iostream>

int main() {
std::cout << "Hello STL OSS world!\n";
}

C:\Users\bion\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp
C:\Users\username\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp
example.cpp

C:\Users\bion\Desktop>.\example.exe
C:\Users\username\Desktop>.\example.exe
Hello STL OSS world!

C:\Users\bion\Desktop>dumpbin /IMPORTS .\example.exe | findstr msvcp
C:\Users\username\Desktop>dumpbin /IMPORTS .\example.exe | findstr msvcp
msvcp140d_oss.dll
```

Expand Down Expand Up @@ -245,29 +256,20 @@ under a category in libcxx, or running a single test in `std` and `tr1`.

## Examples

```
:: This command will run all of the testsuites with verbose output.

C:\STL\out\build\x64>ctest -V

:: This command will also run all of the testsuites.

C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test ..\..\..\tests\std ..\..\..\tests\tr1

:: This command will run all of the std testsuite.

C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std

:: If you want to run a subset of a testsuite you need to point it to the right place in the sources. The following
:: will run the single test found under VSO_0000000_any_calling_conventions.

C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std\tests\VSO_0000000_any_calling_conventions

:: You can invoke stl-lit with any arbitrary subdirectory of a testsuite. In libcxx this allows you to have finer
:: control over what category of tests you would like to run. The following will run all the libcxx map tests.

C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test\std\containers\associative\map
```
These examples assume that your current directory is `C:\Dev\STL\out\build\x64`.

* This command will run all of the testsuites with verbose output.
+ `ctest -V`
* This command will also run all of the testsuites.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test ..\..\..\tests\std ..\..\..\tests\tr1`
* This command will run all of the std testsuite.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std`
* If you want to run a subset of a testsuite, you need to point it to the right place in the sources. The following
will run the single test found under VSO_0000000_any_calling_conventions.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std\tests\VSO_0000000_any_calling_conventions`
* You can invoke `stl-lit` with any arbitrary subdirectory of a testsuite. In libcxx this allows you to have finer
control over what category of tests you would like to run. The following will run all the libcxx map tests.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test\std\containers\associative\map`

## Interpreting The Results Of Tests

Expand Down Expand Up @@ -396,6 +398,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
[Code of Conduct FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
[Compiler Explorer]: https://godbolt.org
[Developer Community]: https://developercommunity.visualstudio.com/spaces/62/index.html
[Discord server]: https://discord.gg/XWanNww
[How To Build With A Native Tools Command Prompt]: #how-to-build-with-a-native-tools-command-prompt
[How To Build With The Visual Studio IDE]: #how-to-build-with-the-visual-studio-ide
[LICENSE.txt]: LICENSE.txt
Expand All @@ -409,6 +412,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
[Pipelines]: https://dev.azure.com/vclibs/STL/_build/latest?definitionId=2&branchName=master
[Python]: https://www.python.org/downloads/windows/
[Roadmap]: https://github.com/microsoft/STL/wiki/Roadmap
[Status Chart]: https://microsoft.github.io/STL/
[Wandbox]: https://wandbox.org
[bug tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3Abug
[cxx20 tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3Acxx20
Expand Down
2 changes: 2 additions & 0 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps
or are running from Azure Cloud Shell.
#>

$ErrorActionPreference = 'Stop'

$Location = 'westus2'
$Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D16as_v4'
Expand Down
3 changes: 2 additions & 1 deletion azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ $Sku = 'Enterprise'
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/16/pre/vs_enterprise.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.8.5/python-3.8.5-amd64.exe'

$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe'
$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 ' + `
'nvdisasm_10.1 nvprof_10.1 visual_profiler_10.1 visual_studio_integration_10.1 cublas_10.1 cublas_dev_10.1 ' + `
'cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 ' + `
Expand Down
1 change: 1 addition & 0 deletions azure-devops/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$(vcpkgLocation)\scripts\buildsystems\vcpkg.cmake ^
-DVCPKG_TARGET_TRIPLET=${{ parameters.targetPlatform }}-windows -DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release -DLIT_FLAGS=$(litFlags) ^
-DCMAKE_CXX_FLAGS=/analyze ^
-S $(Build.SourcesDirectory) -B $(buildOutputLocation)
cmake --build $(buildOutputLocation)
displayName: 'Build the STL'
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Build STL targeting x86, x64, arm, arm64

variables:
agentPool: 'StlBuild-2020-08-11'
agentPool: 'StlBuild-2020-08-26'
tmpDir: 'D:\Temp'

stages:
Expand Down
12 changes: 6 additions & 6 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ struct _Atomic_storage<_Ty, 8> { // lock-free using 8-byte intrinsics
return reinterpret_cast<_TVal&>(_As_bytes);
}

#if defined(_M_IX86) && defined(__clang__) // TRANSITION, LLVM-46595
#ifdef _M_IX86
_TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept {
// exchange with (effectively) sequential consistency
_TVal _Temp{load()};
Expand All @@ -1067,15 +1067,15 @@ struct _Atomic_storage<_Ty, 8> { // lock-free using 8-byte intrinsics

return _Temp;
}
#else // ^^^ defined(_M_IX86) && defined(__clang__), LLVM-46595 / !defined(_M_IX86) || !defined(__clang__) vvv
#else // ^^^ _M_IX86 / !_M_IX86 vvv
_TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept {
// exchange with given memory order
long long _As_bytes;
_ATOMIC_CHOOSE_INTRINSIC(_Order, _As_bytes, _InterlockedExchange64, _Atomic_address_as<long long>(_Storage),
_Atomic_reinterpret_as<long long>(_Value));
return reinterpret_cast<_TVal&>(_As_bytes);
}
#endif // ^^^ !defined(_M_IX86) || !defined(__clang__) ^^^
#endif // _M_IX86

bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired,
const memory_order _Order = memory_order_seq_cst) noexcept { // CAS with given memory order
Expand Down Expand Up @@ -1517,7 +1517,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
using _Base::_Base;
#endif // ^^^ no workaround ^^^

#if defined(_M_IX86) && defined(__clang__) // TRANSITION, LLVM-46595
#ifdef _M_IX86
_TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept {
// effectively sequential consistency
_TVal _Temp{this->load()};
Expand Down Expand Up @@ -1570,7 +1570,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
return fetch_add(static_cast<_TVal>(-1)) - static_cast<_TVal>(1);
}

#else // ^^^ defined(_M_IX86) && defined(__clang__), LLVM-46595 / !defined(_M_IX86) || !defined(__clang__) vvv
#else // ^^^ _M_IX86 / !_M_IX86 vvv
_TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept {
long long _Result;
_ATOMIC_CHOOSE_INTRINSIC(_Order, _Result, _InterlockedExchangeAdd64,
Expand Down Expand Up @@ -1620,7 +1620,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
_TVal operator--() noexcept {
return static_cast<_TVal>(_InterlockedDecrement64(_Atomic_address_as<long long>(this->_Storage)));
}
#endif // ^^^ !defined(_M_IX86) || !defined(__clang__) ^^^
#endif // _M_IX86
};

#if 1 // TRANSITION, ABI
Expand Down
Loading