Skip to content

Commit

Permalink
Merge pull request #1177 from microsoft/master
Browse files Browse the repository at this point in the history
feature/format: Merge VS 2019 16.8 Preview 1 toolset update
  • Loading branch information
StephanTLavavej authored Aug 10, 2020
2 parents 8fcc25f + 1913566 commit 7f4bbce
Show file tree
Hide file tree
Showing 239 changed files with 10,959 additions and 2,510 deletions.
60 changes: 20 additions & 40 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,54 +1,40 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# https://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormatStyleOptions.html
# https://releases.llvm.org/10.0.0/tools/clang/docs/ClangFormatStyleOptions.html

---
# Language: Cpp

BasedOnStyle: LLVM

# AccessModifierOffset: -2
AccessModifierOffset: -4

# AlignAfterOpenBracket: Align
AlignAfterOpenBracket: DontAlign

# AlignConsecutiveMacros: false
AlignConsecutiveMacros: true

# AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: true

# AlignConsecutiveDeclarations: false

# AlignEscapedNewlines: Right
AlignEscapedNewlines: Left

# AlignOperands: true

# AlignTrailingComments: true
AlignTrailingComments: false

# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
# AllowAllParametersOfDeclarationOnNextLine: true
# AllowShortBlocksOnASingleLine: false
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false

# AllowShortFunctionsOnASingleLine: All
AllowShortFunctionsOnASingleLine: Empty

# AllowShortLambdasOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: Never
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false

# AlwaysBreakTemplateDeclarations: MultiLine
AlwaysBreakTemplateDeclarations: Yes

# BinPackArguments: true
# BinPackParameters: true
# BraceWrapping:
Expand All @@ -68,10 +54,8 @@ AlwaysBreakTemplateDeclarations: Yes
# SplitEmptyFunction: true
# SplitEmptyRecord: true
# SplitEmptyNamespace: true

# BreakBeforeBinaryOperators: None
BreakBeforeBinaryOperators: NonAssignment

# BreakBeforeBraces: Attach
# BreakBeforeInheritanceComma: false
# BreakInheritanceList: BeforeColon
Expand All @@ -80,16 +64,16 @@ BreakBeforeBinaryOperators: NonAssignment
# BreakConstructorInitializers: BeforeColon
# BreakAfterJavaFieldAnnotations: false
# BreakStringLiterals: true

# ColumnLimit: 80
ColumnLimit: 120

# CommentPragmas: '^ IWYU pragma:'
# CompactNamespaces: false
# ConstructorInitializerAllOnOneLineOrOnePerLine: false
# ConstructorInitializerIndentWidth: 4
# ContinuationIndentWidth: 4
# Cpp11BracedListStyle: true
# DeriveLineEnding: true
DeriveLineEnding: false
# DerivePointerAlignment: false
# DisableFormat: false
# ExperimentalAutoDetectBinPacking: false
Expand All @@ -98,55 +82,52 @@ ColumnLimit: 120
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH

# IncludeBlocks: Preserve
IncludeBlocks: Regroup

# IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# SortPriority: 0
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
# Priority: 3
# SortPriority: 0
# - Regex: '.*'
# Priority: 1
# SortPriority: 0
IncludeCategories:
- Regex: '^<yvals(_core)?\.h>$'
Priority: 1
- Regex: '^<(Windows|userenv)\.h>$'
Priority: 3
SortPriority: 3
- Regex: '^<WinIoCtl\.h>$'
Priority: 4
Priority: 3
SortPriority: 4
- Regex: '^<__.*\.hpp>$'
Priority: 2
- Regex: '\.hpp[>"]$'
Priority: 5
- Regex: '.*'
Priority: 2

# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentCaseLabels: false
# IndentGotoLabels: true
# IndentPPDirectives: None

# IndentWidth: 2
IndentWidth: 4

# IndentWrappedFunctionNames: false
IndentWrappedFunctionNames: true

# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLinesAtTheStartOfBlocks: true

# NOTE: MacroBlockBegin/MacroBlockEnd don't work with _CATCH_ALL.
# MacroBlockBegin: ''
# MacroBlockEnd: ''

# MaxEmptyLinesToKeep: 1
MaxEmptyLinesToKeep: 2

# NamespaceIndentation: None
NamespaceIndentation: All

# ObjCBinPackProtocolList: Auto
# ObjCBlockIndentWidth: 2
# ObjCSpaceAfterProperty: false
Expand All @@ -159,17 +140,13 @@ NamespaceIndentation: All
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60

# PointerAlignment: Right
PointerAlignment: Left

# ReflowComments: true
# SortIncludes: true
# SortUsingDeclarations: true

# SpaceAfterCStyleCast: false
SpaceAfterCStyleCast: true

# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
Expand All @@ -178,20 +155,22 @@ SpaceAfterCStyleCast: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: false
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# Standard: Cpp11

# NOTE: _STD_BEGIN, _STD_END, etc. aren't macros for complete statements, but telling clang-format that they are
# produces the behavior that we want (with no block indentation).
# SpaceBeforeSquareBrackets: false
# Standard: Latest
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
# NOTE: _STD_BEGIN, _STD_END, etc. aren't macros for complete statements, but telling
# clang-format that they are produces the behavior that we want (with no block indentation).
StatementMacros:
- _STD_BEGIN
- _STD_END
Expand All @@ -201,7 +180,8 @@ StatementMacros:
- _END_EXTERN_C
- _EXTERN_C_UNLESS_PURE
- _END_EXTERN_C_UNLESS_PURE

# TabWidth: 8
# UseCRLF: false
UseCRLF: true
# UseTab: Never
...
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.16)
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()

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

find_package(Boost REQUIRED)

set(VCLIBS_MIN_BOOST_VERSION 1.70.0)
set(VCLIBS_MIN_BOOST_VERSION 1.73.0)
if("${Boost_VERSION}" VERSION_LESS "${VCLIBS_MIN_BOOST_VERSION}")
message(FATAL_ERROR "Detected Boost version is too old (older than ${VCLIBS_MIN_BOOST_VERSION}).")
endif()
Expand All @@ -32,27 +36,27 @@ if("${VCLIBS_TARGET_ARCHITECTURE}" MATCHES "^[xX]86$")
set(VCLIBS_X86_OR_X64 "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=_WIN32_WINNT_WINXP _STL_WIN32_WINNT=_WIN32_WINNT_WINXP
add_compile_definitions(_X86_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501
_WIN32_WINNT=0x0602 NTDDI_VERSION=NTDDI_WIN8)
add_compile_options(/arch:IA32)
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^[xX]64$")
set(VCLIBS_TARGET_ARCHITECTURE "x64")
set(VCLIBS_I386_OR_AMD64 "amd64")
set(VCLIBS_X86_OR_X64 "x64")
add_compile_definitions(_AMD64_ _VCRT_WIN32_WINNT=_WIN32_WINNT_WINXP _STL_WIN32_WINNT=_WIN32_WINNT_WINXP
add_compile_definitions(_AMD64_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501
_WIN32_WINNT=0x0602 NTDDI_VERSION=NTDDI_WIN8)
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^[aA][rR][mM][vV]7$")
set(VCLIBS_TARGET_ARCHITECTURE "arm")
set(VCLIBS_I386_OR_AMD64 "arm")
set(VCLIBS_X86_OR_X64 "arm")
add_compile_definitions(_ARM_ _VCRT_WIN32_WINNT=_WIN32_WINNT_WIN8 _STL_WIN32_WINNT=_WIN32_WINNT_WIN8
add_compile_definitions(_ARM_ _VCRT_WIN32_WINNT=0x0602 _STL_WIN32_WINNT=0x0602
_WIN32_WINNT=0x0602 NTDDI_VERSION=NTDDI_WIN8)
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " Synchronization.lib")
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^[aA][rR][mM]64$")
set(VCLIBS_TARGET_ARCHITECTURE "arm64")
set(VCLIBS_I386_OR_AMD64 "arm64")
set(VCLIBS_X86_OR_X64 "arm64")
add_compile_definitions(_ARM64_ _VCRT_WIN32_WINNT=_WIN32_WINNT_WIN10 _STL_WIN32_WINNT=_WIN32_WINNT_WIN10
add_compile_definitions(_ARM64_ _VCRT_WIN32_WINNT=0x0A00 _STL_WIN32_WINNT=0x0A00
_WIN32_WINNT=0x0A00 NTDDI_VERSION=NTDDI_WIN10)
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " Synchronization.lib")
else()
Expand Down
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ 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.7 Preview 3 or later.
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`
Expand All @@ -159,19 +159,19 @@ acquire this dependency.
These instructions assume you're targeting `x64-windows`; you can change this constant below to target other
architectures.

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

# How To Consume

Expand Down Expand Up @@ -225,8 +225,10 @@ C:\Users\bion\Desktop>dumpbin /IMPORTS .\example.exe | findstr msvcp
1. Follow either [How To Build With A Native Tools Command Prompt][] or [How To Build With The Visual Studio IDE][].
2. Invoke `git submodule update --init llvm-project` at the root of the STL source tree.
3. Acquire [Python][] 3.8 or newer and have it on the `PATH` (or run it directly using its absolute or relative path).
4. Have LLVM's `bin` directory on the `PATH`. Simply using [LLVM's installer][] and choosing to add LLVM to your `PATH`
during installation is the easiest way to get LLVM's `bin` directory on your `PATH`.
4. Have LLVM's `bin` directory on the `PATH` (so `clang-cl.exe` is available).
* We recommend selecting "C++ Clang tools for Windows" in the VS Installer. This will automatically add LLVM to the
`PATH` of the x86 and x64 Native Tools Command Prompts, and will ensure that you're using a supported version.
* Otherwise, use [LLVM's installer][] and choose to add LLVM to your `PATH` during installation.
5. Follow the instructions below.

## Running All The Tests
Expand Down
18 changes: 10 additions & 8 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ system. See https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/ov
for more information.
This script assumes you have installed Azure tools into PowerShell by following the instructions
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps
or are running from Azure Cloud Shell.
#>

Expand Down Expand Up @@ -211,20 +211,20 @@ $denyEverythingElse = New-AzNetworkSecurityRuleConfig `
-DestinationAddressPrefix * `
-DestinationPortRange *

$NetworkSecurityGroupName = $ResourceGroupName + 'NetworkSecurity'
$NetworkSecurityGroupName = $ResourceGroupName + '-NetworkSecurity'
$NetworkSecurityGroup = New-AzNetworkSecurityGroup `
-Name $NetworkSecurityGroupName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-SecurityRules @($allowHttp, $allowDns, $denyEverythingElse)

$SubnetName = $ResourceGroupName + 'Subnet'
$SubnetName = $ResourceGroupName + '-Subnet'
$Subnet = New-AzVirtualNetworkSubnetConfig `
-Name $SubnetName `
-AddressPrefix "10.0.0.0/16" `
-NetworkSecurityGroup $NetworkSecurityGroup

$VirtualNetworkName = $ResourceGroupName + 'Network'
$VirtualNetworkName = $ResourceGroupName + '-Network'
$VirtualNetwork = New-AzVirtualNetwork `
-Name $VirtualNetworkName `
-ResourceGroupName $ResourceGroupName `
Expand All @@ -237,7 +237,7 @@ Write-Progress `
-Activity 'Creating prototype VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

$NicName = $ResourceGroupName + 'NIC'
$NicName = $ResourceGroupName + '-NIC'
$Nic = New-AzNetworkInterface `
-Name $NicName `
-ResourceGroupName $ResourceGroupName `
Expand Down Expand Up @@ -272,13 +272,15 @@ Write-Progress `
-Status 'Running provisioning script provision-image.ps1 in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

Invoke-AzVMRunCommand `
$ProvisionImageResult = Invoke-AzVMRunCommand `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\provision-image.ps1" `
-Parameter @{AdminUserPassword = $AdminPW }

Write-Host "provision-image.ps1 output: $($ProvisionImageResult.value.Message)"

####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
Expand Down Expand Up @@ -343,9 +345,9 @@ Write-Progress `
-Status 'Creating scale set' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

$VmssIpConfigName = $ResourceGroupName + 'VmssIpConfig'
$VmssIpConfigName = $ResourceGroupName + '-VmssIpConfig'
$VmssIpConfig = New-AzVmssIpConfig -SubnetId $Nic.IpConfigurations[0].Subnet.Id -Primary -Name $VmssIpConfigName
$VmssName = $ResourceGroupName + 'Vmss'
$VmssName = $ResourceGroupName + '-Vmss'
$Vmss = New-AzVmssConfig `
-Location $Location `
-SkuCapacity 0 `
Expand Down
2 changes: 2 additions & 0 deletions azure-devops/enforce-clang-format.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
:: Copyright (c) Microsoft Corporation.
:: SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
call "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
"%1" "clang-format.exe -style=file -i" ^
stl/inc ^
stl/src ^
Expand Down
Loading

0 comments on commit 7f4bbce

Please sign in to comment.