From 914ae374fffecf58630510c59b669e51beafd268 Mon Sep 17 00:00:00 2001 From: kimci86 Date: Sun, 17 Apr 2022 11:10:06 +0200 Subject: [PATCH] Silence clang warnings about Scancode enumeration --- include/SFML/Window/Keyboard.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/SFML/Window/Keyboard.hpp b/include/SFML/Window/Keyboard.hpp index cc5755b4b..657fb9f1e 100644 --- a/include/SFML/Window/Keyboard.hpp +++ b/include/SFML/Window/Keyboard.hpp @@ -178,6 +178,16 @@ public: //////////////////////////////////////////////////////////// struct Scan { + // TODO: replace with enum class in SFML 3. + // Clang warns us rightfully that Scancode names shadow Key names. + // A safer solution would be to use a C++11 scoped enumeration (enum class), + // but it is not possible in SFML 2 which uses C++03. + // For now, we just ignore those warnings. + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wshadow" + #endif + enum Scancode { Unknown = -1, //!< Represents any scancode not present in this enum @@ -336,6 +346,10 @@ public: ScancodeCount //!< Keep last -- the total number of scancodes }; + + #if defined(__clang__) + #pragma clang diagnostic pop + #endif }; typedef Scan::Scancode Scancode;