From f8aff1bc0a31bb01cdbca4614badbc893d631062 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 22 Jan 2025 23:23:15 -0700 Subject: [PATCH] Don't bother marking lambdas as `static` The compiler already ensures that these are only constructed once so it's not meaningful to also add static here to potentially optimize. --- examples/raw_input/RawInput.cpp | 2 +- src/SFML/Graphics/GLExtensions.cpp | 2 +- src/SFML/Window/GlContext.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/raw_input/RawInput.cpp b/examples/raw_input/RawInput.cpp index 8a7c6f2cb..34e5f9bfc 100644 --- a/examples/raw_input/RawInput.cpp +++ b/examples/raw_input/RawInput.cpp @@ -42,7 +42,7 @@ int main() break; } - static const auto vec2ToString = [](const sf::Vector2i vec2) + const auto vec2ToString = [](const sf::Vector2i vec2) { return '(' + std::to_string(vec2.x) + ", " + std::to_string(vec2.y) + ')'; }; if (const auto* const mouseMoved = event->getIf()) diff --git a/src/SFML/Graphics/GLExtensions.cpp b/src/SFML/Graphics/GLExtensions.cpp index b8e4c77b9..3b8a7aefe 100644 --- a/src/SFML/Graphics/GLExtensions.cpp +++ b/src/SFML/Graphics/GLExtensions.cpp @@ -55,7 +55,7 @@ namespace //////////////////////////////////////////////////////////// void extensionSanityCheck() { - static const auto check = [](int& flag, auto... entryPoints) + const auto check = [](int& flag, auto... entryPoints) { // If a required entry point is missing, flag the whole extension as unavailable if (!(entryPoints && ...)) diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 7a9c5cddd..f8e86bc59 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -919,7 +919,7 @@ void GlContext::initialize(const ContextSettings& requestedSettings) // Desktop OpenGL: The beginning of the returned string is "major.minor" // Helper to parse OpenGL version strings - static const auto parseVersionString = + const auto parseVersionString = [](const char* versionString, const char* prefix, unsigned int& major, unsigned int& minor) { const std::size_t prefixLength = std::strlen(prefix);