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
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"
space. GCC 15 now has the same warning but it's enabled by default on
-std=c++23. */
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif
/** @relatesalso Magnum::Math::Deg
@brief Double-precision degree value literal
@ -192,8 +193,8 @@ Example usage:
@m_keywords{_degf degf}
*/
constexpr Deg<Float> operator"" _degf(long double value) { return Deg<Float>(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17
#pragma clang diagnostic pop
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic pop
#endif
}}
@ -267,10 +268,11 @@ namespace Literals {
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"
space. GCC 15 now has the same warning but it's enabled by default on
-std=c++23. */
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif
/** @relatesalso Magnum::Math::Rad
@brief Double-precision radian value literal
@ -289,8 +291,8 @@ See @link operator""_degf() @endlink for more information.
@m_keywords{_radf radf}
*/
constexpr Rad<Float> operator"" _radf(long double value) { return Rad<Float>(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17
#pragma clang diagnostic pop
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic pop
#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
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"
space. GCC 15 now has the same warning but it's enabled by default on
-std=c++23. */
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif
/** @relatesalso Magnum::Math::Color3
@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...>())};
}
#endif
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17
#pragma clang diagnostic pop
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic pop
#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
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"
space. GCC 15 now has the same warning but it's enabled by default on
-std=c++23. */
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif
/** @relatesalso Magnum::Math::Half
@brief Half-float literal
@ -203,8 +204,8 @@ namespace Literals {
See @ref Half for more information.
*/
inline Half operator"" _h(long double value) { return Half(Float(value)); }
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17
#pragma clang diagnostic pop
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic pop
#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
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"
space. GCC 15 now has the same warning but it's enabled by default on
-std=c++23. */
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-literal-operator"
#endif
/** @relatesalso Magnum::Math::Nanoseconds
@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) {
return Nanoseconds<Long>{Long(value*1000000000.0l)};
}
#if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17
#pragma clang diagnostic pop
#if (defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17) || (defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ >= 15)
#pragma GCC diagnostic pop
#endif
}}

Loading…
Cancel
Save