From a8d2aeedf21a92f9137421c3f5c4149970e7e4ee Mon Sep 17 00:00:00 2001 From: sosssego Date: Fri, 11 Nov 2022 11:01:12 +0000 Subject: [PATCH] [CPP][Analyzers]Turn on warning 4127 (#21516) Fix an occurrence on a if changing it to if constexpr --- Cpp.Build.props | 2 +- src/common/updating/updating.cpp | 4 ++-- src/runner/unhandled_exception_handler.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cpp.Build.props b/Cpp.Build.props index f4f9f4b647..978c95b2b6 100644 --- a/Cpp.Build.props +++ b/Cpp.Build.props @@ -42,7 +42,7 @@ pch.h Level4 - 26800;28251;4127;4189;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings) + 26800;28251;4189;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings) true TurnOffAllWarnings false diff --git a/src/common/updating/updating.cpp b/src/common/updating/updating.cpp index 8798209b4d..405bdc2cc9 100644 --- a/src/common/updating/updating.cpp +++ b/src/common/updating/updating.cpp @@ -13,7 +13,7 @@ namespace // Strings in this namespace should not be localized { const wchar_t LATEST_RELEASE_ENDPOINT[] = L"https://api.github.com/repos/microsoft/PowerToys/releases/latest"; const wchar_t ALL_RELEASES_ENDPOINT[] = L"https://api.github.com/repos/microsoft/PowerToys/releases"; - + const wchar_t LOCAL_BUILD_ERROR[] = L"Local build cannot be updated"; const wchar_t NETWORK_ERROR[] = L"Network error"; @@ -70,7 +70,7 @@ namespace updating std::future> get_github_version_info_async(const bool prerelease) { // If the current version starts with 0.0.*, it means we're on a local build from a farm and shouldn't check for updates. - if (VERSION_MAJOR == 0 && VERSION_MINOR == 0) + if constexpr (VERSION_MAJOR == 0 && VERSION_MINOR == 0) { co_return nonstd::make_unexpected(LOCAL_BUILD_ERROR); } diff --git a/src/runner/unhandled_exception_handler.cpp b/src/runner/unhandled_exception_handler.cpp index 9c03664794..373d33ea36 100644 --- a/src/runner/unhandled_exception_handler.cpp +++ b/src/runner/unhandled_exception_handler.cpp @@ -167,7 +167,7 @@ LONG WINAPI unhandled_exception_handler(PEXCEPTION_POINTERS info) return EXCEPTION_CONTINUE_SEARCH; } -extern "C" void AbortHandler(int signal_number) +extern "C" void AbortHandler(int /*signal_number*/) { init_symbols(); std::wstring ex_description = L"SIGABRT was raised.";