[Analyzers][CPP] Turn on rule 26497 (#23119)

* Turn on warning 26497
This function function-name could be marked constexpr if compile-time evaluation is desired.

* C++20 has constexpr swap

* as constexpr is not only for compile time,
make all functions that can be constexpr constexpr

* constexpr functions are implicity inline
This commit is contained in:
sosssego
2023-02-08 10:59:34 +00:00
committed by GitHub
parent 53f0b00328
commit 956eb98125
13 changed files with 48 additions and 42 deletions

View File

@@ -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);
}