Marc Mutz 75e10a0656 qcompareheleprs.h: protect CompareThreeWayTester from -Wdeprecated
The namespace contains traits to check for presence and noexceptness
of compareThreeWay() overloads. One of those overloads, the (raw) ptr
one, is deprecated, and therefore throws a warning when one of these
traits hits it. But this is beside the point, because it's not
actionable by the user.

Fix by wrapping the whole namespace in QT_WARNING_DISABLE_DEPRECATED.

This fixes one of the two remaining -Wdeprecated warnings in
tst_qcompare (which the test tries its best to defend against, by
using QT_WARNING_DISABLE_DEPRECATED around the lines, too, but it
didn't help in this case), namely this one:

  qcomparehelpers.h: In instantiation of ‘constexpr bool QtOrderingPrivate::CompareThreeWayTester::compareThreeWayNoexcept() [with LT = int*; RT = int*; typename std::enable_if<hasCompareThreeWay_v<LT, RT>, bool>::type <anonymous> = true]’:
  qcompare.h:689:91:   required from ‘auto qCompareThreeWay(const LT&, const RT&) [with LT = int*; RT = int*; typename std::enable_if<disjunction_v<QtOrderingPrivate::CompareThreeWayTester::HasCompareThreeWay<LT, RT, void>, QtOrderingPrivate::CompareThreeWayTester::HasCompareThreeWay<RT, LT, void> >, bool>::type <anonymous> = true]’
  tst_qcompare.cpp:847:5:   required from here
  qcomparehelpers.h:1229:34: warning: ‘constexpr Qt::strong_ordering Qt::compareThreeWay(const LeftType*, const RightType*) [with LeftType = int; RightType = int; typename std::enable_if<disjunction_v<std::is_same<T, U>, std::is_base_of<Container, T>, std::is_base_of<U, T> >, bool>::type <anonymous> = true]’ is deprecated: Wrap the pointers into Qt::totally_ordered_wrapper and use the respective overload instead. [-Wdeprecated-declarations]
   1229 | { return noexcept(compareThreeWay(std::declval<LT>(), std::declval<RT>())); }
        |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  qcomparehelpers.h:999:31: note: declared here
    999 | constexpr Qt::strong_ordering compareThreeWay(const LeftType *lhs, const RightType *rhs) noexcept
        |                               ^~~~~~~~~~~~~~~

The last warning actually pertains to the body of qCompareThreeWay()
calling Qt::compareThreeWay() on pointers. Even though we try to
suppress that one, too, for testing purposes, it's not clear how it
can be fixed without hiding it for all users of qCompareThreeWay(), so
this is left for another day.

Amends 3d231e27a8c38f8e840e161e76be3a153d6b0aa9.

Pick-to: 6.9 6.8
Change-Id: Id434629435ea8ea89d03e46096866283ab792b54
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-03-26 16:43:22 +01:00
2025-03-24 19:01:57 +02:00
2024-11-05 14:36:16 +01:00
2024-11-05 14:36:16 +01:00
2024-12-13 14:54:23 +00:00
2025-03-24 23:19:04 +01:00
2024-06-25 11:44:00 +02:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%