diff --git a/CppRuleSet.ruleset b/CppRuleSet.ruleset
index 1a59aeeeb3..ad63dc5a1a 100644
--- a/CppRuleSet.ruleset
+++ b/CppRuleSet.ruleset
@@ -84,7 +84,7 @@
-
+
diff --git a/src/common/notifications/notifications.cpp b/src/common/notifications/notifications.cpp
index 7f03af0633..f6d5dbb11b 100644
--- a/src/common/notifications/notifications.cpp
+++ b/src/common/notifications/notifications.cpp
@@ -206,7 +206,7 @@ void notifications::show_toast(std::wstring message, std::wstring title, toast_p
show_toast_with_activations(std::move(message), std::move(title), {}, {}, std::move(params));
}
-inline void xml_escape(std::wstring data)
+constexpr inline void xml_escape(std::wstring data)
{
std::wstring buffer;
buffer.reserve(data.size());
diff --git a/src/common/utils/exec.h b/src/common/utils/exec.h
index feeda08b89..3c6094e98d 100644
--- a/src/common/utils/exec.h
+++ b/src/common/utils/exec.h
@@ -4,8 +4,9 @@
#include
// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast
+// Disable 26497 for winrt - This function function-name could be marked constexpr if compile-time evaluation is desired.
#pragma warning(push)
-#pragma warning(disable: 26471)
+#pragma warning(disable : 26471 26497)
#include
#pragma warning(pop)
diff --git a/src/modules/ShortcutGuide/ShortcutGuide/shortcut_guide.cpp b/src/modules/ShortcutGuide/ShortcutGuide/shortcut_guide.cpp
index 8cff1c4e47..e150cf0c08 100644
--- a/src/modules/ShortcutGuide/ShortcutGuide/shortcut_guide.cpp
+++ b/src/modules/ShortcutGuide/ShortcutGuide/shortcut_guide.cpp
@@ -115,12 +115,12 @@ namespace
return true;
}
- bool isWin(int key)
+ constexpr bool isWin(int key)
{
return key == VK_LWIN || key == VK_RWIN;
}
- bool isKeyDown(LowlevelKeyboardEvent event)
+ constexpr bool isKeyDown(LowlevelKeyboardEvent event)
{
return event.wParam == WM_KEYDOWN || event.wParam == WM_SYSKEYDOWN;
}
diff --git a/src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp b/src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp
index 9f8281804b..4926c287d3 100644
--- a/src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp
+++ b/src/modules/fancyzones/FancyZonesLib/MonitorUtils.cpp
@@ -207,7 +207,7 @@ namespace MonitorUtils
return { .id = str.substr(0, dividerPos), .instanceId = str.substr(dividerPos + 1) };
}
- inline bool not_digit(wchar_t ch)
+ constexpr inline bool not_digit(wchar_t ch)
{
return '0' <= ch && ch <= '9';
}
diff --git a/src/modules/fancyzones/FancyZonesLib/util.cpp b/src/modules/fancyzones/FancyZonesLib/util.cpp
index 151e5d9220..4b4ccc40cb 100644
--- a/src/modules/fancyzones/FancyZonesLib/util.cpp
+++ b/src/modules/fancyzones/FancyZonesLib/util.cpp
@@ -248,32 +248,6 @@ namespace FancyZonesUtils
return closestIdx;
}
- RECT PrepareRectForCycling(RECT windowRect, RECT workAreaRect, DWORD vkCode) noexcept
- {
- LONG deltaX = 0, deltaY = 0;
- switch (vkCode)
- {
- case VK_UP:
- deltaY = workAreaRect.bottom - workAreaRect.top;
- break;
- case VK_DOWN:
- deltaY = workAreaRect.top - workAreaRect.bottom;
- break;
- case VK_LEFT:
- deltaX = workAreaRect.right - workAreaRect.left;
- break;
- case VK_RIGHT:
- deltaX = workAreaRect.left - workAreaRect.right;
- }
-
- windowRect.left += deltaX;
- windowRect.right += deltaX;
- windowRect.top += deltaY;
- windowRect.bottom += deltaY;
-
- return windowRect;
- }
-
void SwallowKey(const WORD key) noexcept
{
INPUT inputKey[1] = {};
diff --git a/src/modules/fancyzones/FancyZonesLib/util.h b/src/modules/fancyzones/FancyZonesLib/util.h
index 8a6e28a313..41d1a9b4d8 100644
--- a/src/modules/fancyzones/FancyZonesLib/util.h
+++ b/src/modules/fancyzones/FancyZonesLib/util.h
@@ -93,7 +93,7 @@ namespace FancyZonesUtils
}
}
- inline BYTE OpacitySettingToAlpha(int opacity)
+ constexpr inline BYTE OpacitySettingToAlpha(int opacity)
{
return static_cast(opacity * 2.55);
}
@@ -168,6 +168,32 @@ namespace FancyZonesUtils
return result;
}
+ constexpr RECT PrepareRectForCycling(RECT windowRect, RECT workAreaRect, DWORD vkCode) noexcept
+ {
+ LONG deltaX = 0, deltaY = 0;
+ switch (vkCode)
+ {
+ case VK_UP:
+ deltaY = workAreaRect.bottom - workAreaRect.top;
+ break;
+ case VK_DOWN:
+ deltaY = workAreaRect.top - workAreaRect.bottom;
+ break;
+ case VK_LEFT:
+ deltaX = workAreaRect.right - workAreaRect.left;
+ break;
+ case VK_RIGHT:
+ deltaX = workAreaRect.left - workAreaRect.right;
+ }
+
+ windowRect.left += deltaX;
+ windowRect.right += deltaX;
+ windowRect.top += deltaY;
+ windowRect.bottom += deltaY;
+
+ return windowRect;
+ }
+
UINT GetDpiForMonitor(HMONITOR monitor) noexcept;
void OrderMonitors(std::vector>& monitorInfo);
@@ -175,7 +201,6 @@ namespace FancyZonesUtils
std::optional GuidFromString(const std::wstring& str) noexcept;
std::optional GuidToString(const GUID& guid) noexcept;
- RECT PrepareRectForCycling(RECT windowRect, RECT workAreaRect, DWORD vkCode) noexcept;
size_t ChooseNextZoneByPosition(DWORD vkCode, RECT windowRect, const std::vector& zoneRects) noexcept;
void SwallowKey(const WORD key) noexcept;
diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp
index fad1aa4a26..44e109ee19 100644
--- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp
+++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp
@@ -421,8 +421,12 @@ void KeyDropDownControl::AddShortcutToControl(Shortcut shortcut, StackPanel tabl
}
}
+// Disable 26497 this function should be evaluated at compile time
+#pragma warning(push)
+#pragma warning(disable : 26497)
// Get number of selected keys. Do not count -1 and 0 values as they stand for Not selected and None
int KeyDropDownControl::GetNumberOfSelectedKeys(std::vector keyCodes)
{
return (int)std::count_if(keyCodes.begin(), keyCodes.end(), [](int32_t a) { return a != -1 && a != 0; });
-}
\ No newline at end of file
+}
+#pragma warning(pop)
\ No newline at end of file
diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/XamlBridge.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/XamlBridge.cpp
index c7ec4a9816..637161b527 100644
--- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/XamlBridge.cpp
+++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/XamlBridge.cpp
@@ -165,7 +165,7 @@ int XamlBridge::MessageLoop()
static const WPARAM invalidKey = (WPARAM)-1;
-WPARAM GetKeyFromReason(winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason reason)
+constexpr WPARAM GetKeyFromReason(winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason reason)
{
auto key = invalidKey;
if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Last || reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::First)
diff --git a/src/modules/keyboardmanager/common/Shortcut.cpp b/src/modules/keyboardmanager/common/Shortcut.cpp
index c06cdb531a..331cf10365 100644
--- a/src/modules/keyboardmanager/common/Shortcut.cpp
+++ b/src/modules/keyboardmanager/common/Shortcut.cpp
@@ -592,13 +592,13 @@ bool Shortcut::CheckModifiersKeyboardState(KeyboardManagerInput::InputInterface&
}
// Helper method for checking if a key is in a range for cleaner code
-bool in_range(DWORD key, DWORD a, DWORD b)
+constexpr bool in_range(DWORD key, DWORD a, DWORD b)
{
return (key >= a && key <= b);
}
// Helper method for checking if a key is equal to a value for cleaner code
-bool equals(DWORD key, DWORD a)
+constexpr bool equals(DWORD key, DWORD a)
{
return (key == a);
}
diff --git a/src/modules/videoconference/VideoConferenceShared/Logging.h b/src/modules/videoconference/VideoConferenceShared/Logging.h
index 633656f695..e585759229 100644
--- a/src/modules/videoconference/VideoConferenceShared/Logging.h
+++ b/src/modules/videoconference/VideoConferenceShared/Logging.h
@@ -41,12 +41,12 @@ std::string toMediaTypeString(GUID subtype);
#define LOG(str) LogToFile(str, false);
#endif
-inline bool failed(HRESULT hr)
+constexpr inline bool failed(HRESULT hr)
{
return hr != S_OK;
}
-inline bool failed(bool val)
+constexpr inline bool failed(bool val)
{
return val == false;
}
diff --git a/tools/WebcamReportTool/DirectShowUtils.h b/tools/WebcamReportTool/DirectShowUtils.h
index 71a091648d..bb7b632fba 100644
--- a/tools/WebcamReportTool/DirectShowUtils.h
+++ b/tools/WebcamReportTool/DirectShowUtils.h
@@ -6,8 +6,9 @@
#include
// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast
+// Disable 26497 for winrt - This function function-name could be marked constexpr if compile-time evaluation is desired.
#pragma warning(push)
-#pragma warning(disable: 26471)
+#pragma warning(disable : 26471 26497)
#include
#pragma warning(push)
diff --git a/tools/WebcamReportTool/main.cpp b/tools/WebcamReportTool/main.cpp
index 3a7501ce23..233b046c8c 100644
--- a/tools/WebcamReportTool/main.cpp
+++ b/tools/WebcamReportTool/main.cpp
@@ -6,8 +6,9 @@
#include
// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast
+// Disable 26497 for winrt - This function function-name could be marked constexpr if compile-time evaluation is desired.
#pragma warning(push)
-#pragma warning(disable: 26471)
+#pragma warning(disable : 26471 26497)
#include
#pragma warning(push)