Skip to content

Commit c9a43aa

Browse files
README improvements, minor cleanups (#1226)
Co-authored-by: mnatsuhara <[email protected]>
1 parent 0c368b1 commit c9a43aa

File tree

9 files changed

+85
-66
lines changed

9 files changed

+85
-66
lines changed

README.md

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Microsoft's C++ Standard Library
22

33
This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL),
4-
which ships as part of the MSVC toolset and the Visual Studio IDE. Our [Changelog][] tracks which updates to this
5-
repository appear in each VS release.
4+
which ships as part of the MSVC toolset and the Visual Studio IDE.
5+
6+
* Our [Changelog][] tracks which updates to this repository appear in each VS release.
7+
* Our [Status Chart][] displays our overall progress over time.
8+
* Join our [Discord server][].
69

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

@@ -147,30 +150,39 @@ acquire this dependency.
147150
2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository,
148151
`https://github.com/microsoft/STL`.
149152
3. Open a terminal in the IDE with `` Ctrl + ` `` (by default) or press on "View" in the top bar, and then "Terminal".
150-
4. Invoke `git submodule update --init vcpkg` in the terminal.
151-
5. Invoke `.\vcpkg\bootstrap-vcpkg.bat` in the terminal.
152-
6. Invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows` to install the boost-math dependency.
153+
4. In the terminal, invoke `git submodule update --init vcpkg`
154+
5. In the terminal, invoke `.\vcpkg\bootstrap-vcpkg.bat`
155+
6. In the terminal, invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows`
153156
7. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake
154157
settings are set by `CMakeSettings.json`.
155158

156159
# How To Build With A Native Tools Command Prompt
157160

158-
These instructions assume you're targeting `x64-windows`; you can change this constant below to target other
159-
architectures.
160-
161161
1. Install Visual Studio 2019 16.8 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.17 or later, and [Ninja][] 1.8.2 or later.
165-
2. Open an "x64 Native Tools Command Prompt for VS 2019".
165+
2. Open a command prompt.
166166
3. Change directories to a location where you'd like a clone of this STL repository.
167-
4. Invoke `git clone https://github.com/microsoft/STL`
168-
5. Invoke `cd STL`
169-
6. Invoke `git submodule update --init vcpkg`
170-
7. Invoke `.\vcpkg\bootstrap-vcpkg.bat`
171-
8. Invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows` to install the boost-math dependency.
172-
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`
173-
10. Invoke `ninja -C {wherever you want binaries}` to build the project. For example, `ninja -C out\build\x64`
167+
4. `git clone https://github.com/microsoft/STL`
168+
5. `cd STL`
169+
6. `git submodule update --init vcpkg`
170+
7. `.\vcpkg\bootstrap-vcpkg.bat`
171+
8. `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows`
172+
173+
To build the x86 target:
174+
175+
1. Open an "x86 Native Tools Command Prompt for VS 2019".
176+
2. Change directories to the previously cloned `STL` directory.
177+
3. `cmake -G Ninja -S . -B out\build\x86`
178+
4. `ninja -C out\build\x86`
179+
180+
To build the x64 target:
181+
182+
1. Open an "x64 Native Tools Command Prompt for VS 2019".
183+
2. Change directories to the previously cloned `STL` directory.
184+
3. `cmake -G Ninja -S . -B out\build\x64`
185+
4. `ninja -C out\build\x64`
174186

175187
# How To Consume
176188

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

198210
```
199-
C:\Users\bion\Desktop>set INCLUDE=C:\Dev\STL\out\build\x64\out\inc;%INCLUDE%
211+
C:\Users\username\Desktop>set INCLUDE=C:\Dev\STL\out\build\x64\out\inc;%INCLUDE%
200212
201-
C:\Users\bion\Desktop>set LIB=C:\Dev\STL\out\build\x64\out\lib\amd64;%LIB%
213+
C:\Users\username\Desktop>set LIB=C:\Dev\STL\out\build\x64\out\lib\amd64;%LIB%
202214
203-
C:\Users\bion\Desktop>set PATH=C:\Dev\STL\out\build\x64\out\bin\amd64;%PATH%
215+
C:\Users\username\Desktop>set PATH=C:\Dev\STL\out\build\x64\out\bin\amd64;%PATH%
204216
205-
C:\Users\bion\Desktop>type example.cpp
217+
C:\Users\username\Desktop>type example.cpp
206218
#include <iostream>
207219
208220
int main() {
209221
std::cout << "Hello STL OSS world!\n";
210222
}
211223
212-
C:\Users\bion\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp
224+
C:\Users\username\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp
213225
example.cpp
214226
215-
C:\Users\bion\Desktop>.\example.exe
227+
C:\Users\username\Desktop>.\example.exe
216228
Hello STL OSS world!
217229
218-
C:\Users\bion\Desktop>dumpbin /IMPORTS .\example.exe | findstr msvcp
230+
C:\Users\username\Desktop>dumpbin /IMPORTS .\example.exe | findstr msvcp
219231
msvcp140d_oss.dll
220232
```
221233

@@ -244,29 +256,20 @@ under a category in libcxx, or running a single test in `std` and `tr1`.
244256

245257
## Examples
246258

247-
```
248-
:: This command will run all of the testsuites with verbose output.
249-
250-
C:\STL\out\build\x64>ctest -V
251-
252-
:: This command will also run all of the testsuites.
253-
254-
C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test ..\..\..\tests\std ..\..\..\tests\tr1
255-
256-
:: This command will run all of the std testsuite.
257-
258-
C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std
259-
260-
:: If you want to run a subset of a testsuite you need to point it to the right place in the sources. The following
261-
:: will run the single test found under VSO_0000000_any_calling_conventions.
262-
263-
C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std\tests\VSO_0000000_any_calling_conventions
264-
265-
:: You can invoke stl-lit with any arbitrary subdirectory of a testsuite. In libcxx this allows you to have finer
266-
:: control over what category of tests you would like to run. The following will run all the libcxx map tests.
267-
268-
C:\STL\out\build\x64>python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test\std\containers\associative\map
269-
```
259+
These examples assume that your current directory is `C:\Dev\STL\out\build\x64`.
260+
261+
* This command will run all of the testsuites with verbose output.
262+
+ `ctest -V`
263+
* This command will also run all of the testsuites.
264+
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test ..\..\..\tests\std ..\..\..\tests\tr1`
265+
* This command will run all of the std testsuite.
266+
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std`
267+
* If you want to run a subset of a testsuite, you need to point it to the right place in the sources. The following
268+
will run the single test found under VSO_0000000_any_calling_conventions.
269+
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std\tests\VSO_0000000_any_calling_conventions`
270+
* You can invoke `stl-lit` with any arbitrary subdirectory of a testsuite. In libcxx this allows you to have finer
271+
control over what category of tests you would like to run. The following will run all the libcxx map tests.
272+
+ `python tests\utils\stl-lit\stl-lit.py ..\..\..\llvm-project\libcxx\test\std\containers\associative\map`
270273

271274
## Interpreting The Results Of Tests
272275

@@ -395,6 +398,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
395398
[Code of Conduct FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
396399
[Compiler Explorer]: https://godbolt.org
397400
[Developer Community]: https://developercommunity.visualstudio.com/spaces/62/index.html
401+
[Discord server]: https://discord.gg/XWanNww
398402
[How To Build With A Native Tools Command Prompt]: #how-to-build-with-a-native-tools-command-prompt
399403
[How To Build With The Visual Studio IDE]: #how-to-build-with-the-visual-studio-ide
400404
[LICENSE.txt]: LICENSE.txt
@@ -408,6 +412,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
408412
[Pipelines]: https://dev.azure.com/vclibs/STL/_build/latest?definitionId=2&branchName=master
409413
[Python]: https://www.python.org/downloads/windows/
410414
[Roadmap]: https://github.com/microsoft/STL/wiki/Roadmap
415+
[Status Chart]: https://microsoft.github.io/STL/
411416
[Wandbox]: https://wandbox.org
412417
[bug tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3Abug
413418
[cxx20 tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3Acxx20

azure-devops/provision-image.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ $Sku = 'Enterprise'
9999
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/16/pre/vs_enterprise.exe'
100100
$PythonUrl = 'https://www.python.org/ftp/python/3.8.5/python-3.8.5-amd64.exe'
101101

102-
$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe'
102+
$CudaUrl = `
103+
'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe'
103104
$CudaFeatures = 'nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 ' + `
104105
'nvdisasm_10.1 nvprof_10.1 visual_profiler_10.1 visual_studio_integration_10.1 cublas_10.1 cublas_dev_10.1 ' + `
105106
'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 ' + `

stl/inc/valarray

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,8 @@ public:
15031503
}
15041504

15051505
size_t _Off(_Sizarray& _Indexarr) const {
1506-
size_t _Idx, _Ans = _Start;
1506+
size_t _Idx;
1507+
size_t _Ans = _Start;
15071508
const size_t _Size = _Indexarr.size();
15081509
for (_Idx = 0; _Idx < _Size; ++_Idx) {
15091510
_Ans += _Indexarr[_Idx] * _Stride[_Idx]; // compute offset

stl/inc/xlocmon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ private:
422422
_Ppunct_fac = _STD addressof(_STD use_facet<_Mypunct0>(_Iosbase.getloc())); // local
423423
}
424424

425-
bool _Bad = false, _Neg = false;
425+
bool _Bad = false;
426+
bool _Neg = false;
426427
string_type _Sign;
427428
const money_base::pattern _Pattern = _Ppunct_fac->neg_format();
428429
string _Val;

stl/inc/xlocnum

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,31 +1297,35 @@ protected:
12971297
#pragma warning(disable : 4774) // format string expected in argument N is not a string literal (/Wall)
12981298
virtual _OutIt __CLR_OR_THIS_CALL do_put(
12991299
_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long _Val) const { // put formatted long to _Dest
1300-
char _Buf[2 * _MAX_INT_DIG], _Fmt[6];
1300+
char _Buf[2 * _MAX_INT_DIG];
1301+
char _Fmt[6];
13011302

13021303
return _Iput(_Dest, _Iosbase, _Fill, _Buf,
13031304
static_cast<size_t>(_CSTD sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "ld", _Iosbase.flags()), _Val)));
13041305
}
13051306

13061307
virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill,
13071308
unsigned long _Val) const { // put formatted unsigned long to _Dest
1308-
char _Buf[2 * _MAX_INT_DIG], _Fmt[6];
1309+
char _Buf[2 * _MAX_INT_DIG];
1310+
char _Fmt[6];
13091311

13101312
return _Iput(_Dest, _Iosbase, _Fill, _Buf,
13111313
static_cast<size_t>(_CSTD sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "lu", _Iosbase.flags()), _Val)));
13121314
}
13131315

13141316
virtual _OutIt __CLR_OR_THIS_CALL do_put(
13151317
_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long long _Val) const { // put formatted long long to _Dest
1316-
char _Buf[2 * _MAX_INT_DIG], _Fmt[8];
1318+
char _Buf[2 * _MAX_INT_DIG];
1319+
char _Fmt[8];
13171320

13181321
return _Iput(_Dest, _Iosbase, _Fill, _Buf,
13191322
static_cast<size_t>(_CSTD sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "Ld", _Iosbase.flags()), _Val)));
13201323
}
13211324

13221325
virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill,
13231326
unsigned long long _Val) const { // put formatted unsigned long long to _Dest
1324-
char _Buf[2 * _MAX_INT_DIG], _Fmt[8];
1327+
char _Buf[2 * _MAX_INT_DIG];
1328+
char _Fmt[8];
13251329

13261330
return _Iput(_Dest, _Iosbase, _Fill, _Buf,
13271331
static_cast<size_t>(_CSTD sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "Lu", _Iosbase.flags()), _Val)));

stl/inc/xloctime

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ protected:
539539
private:
540540
ios_base::iostate __CLRCALL_OR_CDECL _Getint(_InIt& _First, _InIt& _Last, int _Lo, int _Hi, int& _Val,
541541
const _Ctype& _Ctype_fac) const { // get integer in range [_Lo, _Hi] from [_First, _Last)
542-
char _Ac[_MAX_INT_DIG], *_Ep;
542+
char _Ac[_MAX_INT_DIG];
543+
char* _Ep;
543544
char* _Ptr = _Ac;
544545
char _Ch;
545546

stl/src/xxstod.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
#define D16TO7 FLIT(268435456.0) // 16^7
1010
#define D10TO9 FLIT(1e9) // 10^9
1111

12-
#if FBITS <= 24
12+
#if FBITS == 24
1313
#define NLONG 1 // 7 * NLONG == max hexadecimal digits
14-
15-
#elif FBITS <= 64
14+
#elif FBITS == 53
1615
#define NLONG 3
17-
18-
#else // NLONG
19-
#define NLONG 5
20-
#endif // NLONG
16+
#else // FBITS
17+
#error Unexpected value for FBITS
18+
#endif // FBITS
2119

2220
// FTYPE _Stodx(const CTYPE *s, CTYPE **endptr, long pten, int *perr)
2321
{ // convert string to FTYPE, with checking
@@ -36,7 +34,8 @@
3634
if ((code &= ~FL_NEG) == FL_DEC) { // parse decimal format
3735
const int nlo = CNAME(Stoflt)(s0, s, endptr, lo, NLONG);
3836
_Analysis_assume_(nlo <= NLONG);
39-
FTYPE xpx[ACSIZE], xpf[ACSIZE];
37+
FTYPE xpx[ACSIZE];
38+
FTYPE xpf[ACSIZE];
4039
int i;
4140

4241
FNAME(Xp_setw)(xpf, ACSIZE, D10TO9);
@@ -58,7 +57,8 @@
5857
} else if (code == FL_HEX) { // parse hexadecimal format
5958
const int nlo = CNAME(Stoxflt)(s0, s, endptr, lo, NLONG);
6059
_Analysis_assume_(nlo <= NLONG);
61-
FTYPE xpx[ACSIZE], xpf[ACSIZE];
60+
FTYPE xpx[ACSIZE];
61+
FTYPE xpf[ACSIZE];
6262
int i;
6363

6464
FNAME(Xp_setw)(xpf, ACSIZE, D16TO7);

stl/src/xxxprec.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,15 @@ FTYPE* FNAME(Xp_mulh)(FTYPE* p, int n, FTYPE x0) { // multiply by a half-precisi
282282

283283
FTYPE* FNAME(Xp_setn)(FTYPE* p, int n, long x) { // load a long integer
284284

285-
#if 27 <= FBITS
285+
#if FBITS == 53
286286
FNAME(Xp_setw)(p, n, static_cast<FTYPE>(x));
287-
#else // 27 <= FBITS
287+
#elif FBITS == 24
288288
FNAME(Xp_setw)(p, n, static_cast<FTYPE>(x / 10000));
289289
FNAME(Xp_mulh)(p, n, static_cast<FTYPE>(10000));
290290
FNAME(Xp_addh)(p, n, static_cast<FTYPE>(x % 10000));
291-
#endif // 27 <= FBITS
291+
#else // FBITS
292+
#error Unexpected value for FBITS
293+
#endif // FBITS
292294

293295
return p;
294296
}

tools/validate/validate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ void scan_file(const filesystem::path& filepath, const TabPolicy tab_policy, vec
167167
static constexpr array checked_extensions{
168168
// line length should be capped in files with these extensions:
169169
L""sv,
170+
L".cmd"sv,
170171
L".cpp"sv,
171172
L".h"sv,
172173
L".hpp"sv,
174+
L".md"sv,
175+
L".ps1"sv,
176+
L".py"sv,
173177
L".yml"sv,
174178
};
175179
static_assert(is_sorted(checked_extensions.begin(), checked_extensions.end()));

0 commit comments

Comments
 (0)