Browse Source

Containers: suppress literal operator warnings on GCC 15 with -std=c++23.

Same thing as with Clang 17+ (see the comment for why), but in this case
the warning seems to be enabled by default, which is rather annoying.
pull/660/merge
Vladimír Vondruš 11 months ago
parent
commit
da40122233
  1. 26
      src/Magnum/Math/Angle.h
  2. 13
      src/Magnum/Math/Color.h
  3. 13
      src/Magnum/Math/Half.h
  4. 13
      src/Magnum/Math/Time.h

26
src/Magnum/Math/Angle.h

@ -164,10 +164,11 @@ namespace Literals {
load-bearing in any other contexts. Clang 17+ adds an off-by-default warning 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 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 support is dropped, we suppress this warning instead of removing the
space. */ space. GCC 15 now has the same warning but it's enabled by default on
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 -std=c++23. */
#pragma clang diagnostic push #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif #endif
/** @relatesalso Magnum::Math::Deg /** @relatesalso Magnum::Math::Deg
@brief Double-precision degree value literal @brief Double-precision degree value literal
@ -192,8 +193,8 @@ Example usage:
@m_keywords{_degf degf} @m_keywords{_degf degf}
*/ */
constexpr Deg<Float> operator"" _degf(long double value) { return Deg<Float>(Float(value)); } constexpr Deg<Float> operator"" _degf(long double value) { return Deg<Float>(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic pop #pragma GCC diagnostic pop
#endif #endif
}} }}
@ -267,10 +268,11 @@ namespace Literals {
load-bearing in any other contexts. Clang 17+ adds an off-by-default warning 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 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 support is dropped, we suppress this warning instead of removing the
space. */ space. GCC 15 now has the same warning but it's enabled by default on
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 -std=c++23. */
#pragma clang diagnostic push #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif #endif
/** @relatesalso Magnum::Math::Rad /** @relatesalso Magnum::Math::Rad
@brief Double-precision radian value literal @brief Double-precision radian value literal
@ -289,8 +291,8 @@ See @link operator""_degf() @endlink for more information.
@m_keywords{_radf radf} @m_keywords{_radf radf}
*/ */
constexpr Rad<Float> operator"" _radf(long double value) { return Rad<Float>(Float(value)); } constexpr Rad<Float> operator"" _radf(long double value) { return Rad<Float>(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic pop #pragma GCC diagnostic pop
#endif #endif
}} }}

13
src/Magnum/Math/Color.h

@ -1502,10 +1502,11 @@ namespace Literals {
load-bearing in any other contexts. Clang 17+ adds an off-by-default warning 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 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 support is dropped, we suppress this warning instead of removing the
space. */ space. GCC 15 now has the same warning but it's enabled by default on
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 -std=c++23. */
#pragma clang diagnostic push #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif #endif
/** @relatesalso Magnum::Math::Color3 /** @relatesalso Magnum::Math::Color3
@brief 8bit-per-channel linear RGB literal @brief 8bit-per-channel linear RGB literal
@ -1867,8 +1868,8 @@ operator"" _srgbah() {
return Color4<Half>{Color4<Float>::fromSrgbAlpha(Implementation::color4Literal<Vector4<UnsignedByte>, 1, sizeof...(chars), chars...>())}; return Color4<Half>{Color4<Float>::fromSrgbAlpha(Implementation::color4Literal<Vector4<UnsignedByte>, 1, sizeof...(chars), chars...>())};
} }
#endif #endif
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic pop #pragma GCC diagnostic pop
#endif #endif
}} }}

13
src/Magnum/Math/Half.h

@ -192,10 +192,11 @@ namespace Literals {
load-bearing in any other contexts. Clang 17+ adds an off-by-default warning 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 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 support is dropped, we suppress this warning instead of removing the
space. */ space. GCC 15 now has the same warning but it's enabled by default on
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 -std=c++23. */
#pragma clang diagnostic push #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif #endif
/** @relatesalso Magnum::Math::Half /** @relatesalso Magnum::Math::Half
@brief Half-float literal @brief Half-float literal
@ -203,8 +204,8 @@ namespace Literals {
See @ref Half for more information. See @ref Half for more information.
*/ */
inline Half operator"" _h(long double value) { return Half(Float(value)); } inline Half operator"" _h(long double value) { return Half(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic pop #pragma GCC diagnostic pop
#endif #endif
}} }}

13
src/Magnum/Math/Time.h

@ -297,10 +297,11 @@ namespace Literals {
load-bearing in any other contexts. Clang 17+ adds an off-by-default warning 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 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 support is dropped, we suppress this warning instead of removing the
space. */ space. GCC 15 now has the same warning but it's enabled by default on
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 -std=c++23. */
#pragma clang diagnostic push #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif #endif
/** @relatesalso Magnum::Math::Nanoseconds /** @relatesalso Magnum::Math::Nanoseconds
@brief Nanosecond value literal @brief Nanosecond value literal
@ -388,8 +389,8 @@ precision on a range of roughly ±2 hours. For example:
constexpr Nanoseconds<Long> operator"" _sec(long double value) { constexpr Nanoseconds<Long> operator"" _sec(long double value) {
return Nanoseconds<Long>{Long(value*1000000000.0l)}; return Nanoseconds<Long>{Long(value*1000000000.0l)};
} }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 #if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma clang diagnostic pop #pragma GCC diagnostic pop
#endif #endif
}} }}

Loading…
Cancel
Save