From bd403dc8e71ff0e377f2c887c4c7f2032e3718d9 Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Tue, 5 Jul 2022 23:06:05 +0200 Subject: [PATCH] Switch to VS17 and C++20 (#13368) C++20 goodies include: * 3-way comparison operator `<=>` and `operator==() = default` * designated initializers * constraints and concepts * abbreviated function templates (`void foo(auto bar)`) * pack-expansions in lambda init-captures * heterogeneous lookups in `unordered_set` / `unordered_map` * `consteval` / `constinit` * `starts_with` / `ends_with` for `string` / `string_view` * `midpoint`, `lerp` * `` * `` * `` * `` * `` * `` --- .github/actions/spelling/allow/allow.txt | 8 ++++---- .github/actions/spelling/patterns/patterns.txt | 9 +-------- build/pipelines/release.yml | 10 +++------- .../pipelines/templates/build-console-audit-job.yml | 3 +-- build/pipelines/templates/build-console-ci.yml | 4 ++-- build/pipelines/templates/build-console-fuzzing.yml | 9 ++++----- build/pipelines/templates/build-console-pgo.yml | 6 +++--- build/pipelines/templates/build-console-steps.yml | 1 - build/pipelines/templates/test-console-ci.yml | 4 ++-- src/cascadia/WinRTUtils/inc/Utils.h | 3 +++ src/common.build.pre.props | 13 ++++++++----- src/project.inc | 1 + src/renderer/dx/DxFontRenderData.cpp | 2 +- 13 files changed, 33 insertions(+), 40 deletions(-) diff --git a/.github/actions/spelling/allow/allow.txt b/.github/actions/spelling/allow/allow.txt index 60d577116a..c262988d53 100644 --- a/.github/actions/spelling/allow/allow.txt +++ b/.github/actions/spelling/allow/allow.txt @@ -1,15 +1,16 @@ admins +allcolors apc Apc -bsd breadcrumb breadcrumbs +bsd calt -CMMI ccmp changelog clickable clig +CMMI copyable cybersecurity dalet @@ -59,7 +60,6 @@ maxed mkmk mnt mru -noreply nje noreply ogonek @@ -86,6 +86,7 @@ timestamped TLDR tokenizes tonos +toolset tshe uiatextrange UIs @@ -97,4 +98,3 @@ We'd wildcards yeru zhe -allcolors diff --git a/.github/actions/spelling/patterns/patterns.txt b/.github/actions/spelling/patterns/patterns.txt index 2fc6e0b708..421b031f08 100644 --- a/.github/actions/spelling/patterns/patterns.txt +++ b/.github/actions/spelling/patterns/patterns.txt @@ -1,11 +1,4 @@ -https://(?:(?:[-a-zA-Z0-9?&=]*\.|)microsoft\.com)/[-a-zA-Z0-9?&=_#\/.]* -https://aka\.ms/[-a-zA-Z0-9?&=\/_]* -https://www\.itscj\.ipsj\.or\.jp/iso-ir/[-0-9]+\.pdf -https://www\.vt100\.net/docs/[-a-zA-Z0-9#_\/.]* -https://www.w3.org/[-a-zA-Z0-9?&=\/_#]* -https://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]* -https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.+]* -https://www.xfree86.org/[-a-zA-Z0-9?&=\/_#]* +https?://\S+ [Pp]ublicKeyToken="?[0-9a-fA-F]{16}"? (?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]| FilePicker(HWND pare DWORD flags{}; THROW_IF_FAILED(fileDialog->GetOptions(&flags)); THROW_IF_FAILED(fileDialog->SetOptions(flags | FOS_FORCEFILESYSTEM | FOS_NOCHANGEDIR | FOS_DONTADDTORECENT)); // filesystem objects only; no recent places + + // BODGY: The MSVC 14.31.31103 toolset seems to misdiagnose this line. +#pragma warning(suppress : 26481) // Don't use pointer arithmetic. Use span instead (bounds.1). customize(fileDialog.get()); const auto hr{ fileDialog->Show(parentHwnd) }; diff --git a/src/common.build.pre.props b/src/common.build.pre.props index 80ed4fd94e..bfc7178f48 100644 --- a/src/common.build.pre.props +++ b/src/common.build.pre.props @@ -98,16 +98,20 @@ true - 4103;4201;4312;4467;5105;%(DisableSpecificWarnings) + 4201;4312;4467;5105;26445;26813;%(DisableSpecificWarnings) _WINDOWS;EXTERNAL_BUILD;%(PreprocessorDefinitions) true precomp.h @@ -118,8 +122,7 @@ false true true - stdcpp17 - stdcpp20 + stdcpp20 stdc17 %(AdditionalOptions) /utf-8 /Zc:externConstexpr /Zc:lambda /Zc:throwingNew Guard diff --git a/src/project.inc b/src/project.inc index 605e71e59d..49212aa293 100644 --- a/src/project.inc +++ b/src/project.inc @@ -30,6 +30,7 @@ USE_NATIVE_EH = 1 # Compiler Settings # ------------------------------------- +USE_STD_CPP20 = 1 MSC_WARNING_LEVEL = /W4 /WX USER_C_FLAGS = $(USER_C_FLAGS) /fp:fast /utf-8 diff --git a/src/renderer/dx/DxFontRenderData.cpp b/src/renderer/dx/DxFontRenderData.cpp index c5e1ddcfbe..3f334dbedf 100644 --- a/src/renderer/dx/DxFontRenderData.cpp +++ b/src/renderer/dx/DxFontRenderData.cpp @@ -506,7 +506,7 @@ void DxFontRenderData::_SetFeatures(const std::unordered_map