From bcf61d4de8486965c29685bdf76d759333164f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 25 Nov 2024 13:52:30 +0100 Subject: [PATCH] Math: add more -Wdeprecated-literal-operator suppressions. The declarations of all operators already have it, but the direct operator usage not. --- src/Magnum/Math/Color.cpp | 72 ++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/src/Magnum/Math/Color.cpp b/src/Magnum/Math/Color.cpp index 7610a06c0..95434b478 100644 --- a/src/Magnum/Math/Color.cpp +++ b/src/Magnum/Math/Color.cpp @@ -173,9 +173,23 @@ Containers::Pair> Twe return {TweakableState::Error, {}}; } + /* According to https://wg21.link/CWG2521, space between "" and literal + name is deprecated because _Uppercase or __double names could be treated + as reserved depending on whether the space was present or not, and + whitespace is not load-bearing in any other contexts. Clang 17+ adds an + off-by-default warning for this; GCC 4.8 however *requires* the space + there, so until GCC 4.8 support is dropped, we suppress this warning + instead of removing the space. */ + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" + #endif return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator "" _srgb(result) : - Magnum::Math::Literals::operator "" _rgb(result)}; + isSrgb ? Magnum::Math::Literals::operator"" _srgb(result) : + Magnum::Math::Literals::operator"" _rgb(result)}; + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic pop + #endif } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -205,9 +219,23 @@ Containers::Pair> Twe return {TweakableState::Error, {}}; } + /* According to https://wg21.link/CWG2521, space between "" and literal + name is deprecated because _Uppercase or __double names could be treated + as reserved depending on whether the space was present or not, and + whitespace is not load-bearing in any other contexts. Clang 17+ adds an + off-by-default warning for this; GCC 4.8 however *requires* the space + there, so until GCC 4.8 support is dropped, we suppress this warning + instead of removing the space. */ + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" + #endif return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator "" _srgba(result) : - Magnum::Math::Literals::operator "" _rgba(result)}; + isSrgb ? Magnum::Math::Literals::operator"" _srgba(result) : + Magnum::Math::Literals::operator"" _rgba(result)}; + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic pop + #endif } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -237,9 +265,23 @@ Containers::Pair> TweakableP return {TweakableState::Error, {}}; } + /* According to https://wg21.link/CWG2521, space between "" and literal + name is deprecated because _Uppercase or __double names could be treated + as reserved depending on whether the space was present or not, and + whitespace is not load-bearing in any other contexts. Clang 17+ adds an + off-by-default warning for this; GCC 4.8 however *requires* the space + there, so until GCC 4.8 support is dropped, we suppress this warning + instead of removing the space. */ + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" + #endif return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator "" _srgbf(result) : - Magnum::Math::Literals::operator "" _rgbf(result)}; + isSrgb ? Magnum::Math::Literals::operator"" _srgbf(result) : + Magnum::Math::Literals::operator"" _rgbf(result)}; + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic pop + #endif } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -269,9 +311,23 @@ Containers::Pair> TweakableP return {TweakableState::Error, {}}; } + /* According to https://wg21.link/CWG2521, space between "" and literal + name is deprecated because _Uppercase or __double names could be treated + as reserved depending on whether the space was present or not, and + whitespace is not load-bearing in any other contexts. Clang 17+ adds an + off-by-default warning for this; GCC 4.8 however *requires* the space + there, so until GCC 4.8 support is dropped, we suppress this warning + instead of removing the space. */ + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" + #endif return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator "" _srgbaf(result) : - Magnum::Math::Literals::operator "" _rgbaf(result)}; + isSrgb ? Magnum::Math::Literals::operator"" _srgbaf(result) : + Magnum::Math::Literals::operator"" _rgbaf(result)}; + #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 + #pragma clang diagnostic pop + #endif } }}