qt6-bb10/tests/auto/corelib/global
Ivan Solovev 65ef677131 Rework comparison helper macros to get rid of conditional noexcept
The conditional noexcept in comparison operators is known to cause
problems in various cases.
For example, we had a problem in QBAV, where gcc and clang tried to
expand conditional noexcept before the class was complete, and, as a
result, discarded some of the QBAV constructors (see
fff6562f8c for a more detailed
explanation).
Other problem is related to the GHS compiler which tries to compile
the noexcept specification and provides a hard error instead of
SFINAE'ing out in case of failure
(see e1f45ad818 or
0ac0b412c754e53d167716f207be9d76a7fe16be as examples).

This patch reworks the macros to get rid of the conditional noexcept.
Instead, it demands that all operators are noexcept by default, and
adds another set of helper macros that can be used if it's not
possible to make the relational operators noexcept.
The new macros end with the _NON_NOEXCEPT suffix.

The patch also adds static_assert() to the generated operators to
verify that the proper macros are used. However, some platforms
(e.g. QNX and Integrity) fail to handle conditional noexcept on
lambdas, and so we have to use yet another macro to generate the
checks only on platforms that handle them properly.

This patch also applies the new approach to qtbase, adding noexcept
where possible, and falling back to the _NON_NOEXCEPT macros
otherwise.

As a drive-by: fix the macro implementation to use
QtOrderingPrivate::reversed() instead of manually reimplementing it.

I decided to pick the patch to 6.8, because it allows to fix some
questionable APIs (see QBAV story above).

Change-Id: I72f56778acb469f18b578b3418c0c41b4f6d62e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d292648d0bbac50388dae035dc34782accb3807f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:19 +00:00
..
q20 Add copyright and licensing to build system files missing it 2024-05-21 17:23:21 +02:00
q_func_info Change license for tests files 2024-02-04 09:56:42 +01:00
qcompare Rework comparison helper macros to get rid of conditional noexcept 2024-07-16 11:32:19 +00:00
qcomparehelpers Rework comparison helper macros to get rid of conditional noexcept 2024-07-16 11:32:19 +00:00
qflags Change license for tests files 2024-02-04 09:56:42 +01:00
qfloat16 tst_qfloat16: don't cause UB in converting from float to ints 2024-05-30 17:23:35 -03:00
qgetputenv Change license for tests files 2024-02-04 09:56:42 +01:00
qglobal Long live Q_DECLARE_SHARED_NS! 2024-07-08 11:29:50 +00:00
qglobalstatic Change license for tests files 2024-02-04 09:56:42 +01:00
qhooks Change license for tests files 2024-02-04 09:56:42 +01:00
qkeycombination QKeyCombination: use new comparison helper macros 2024-04-17 20:30:37 +02:00
qlibraryinfo qt.conf: add private "merge_qt_conf" option 2024-05-28 20:19:14 +02:00
qlogging ptests: Fix qlogging to use relative folder 2024-05-03 11:58:54 +03:00
qnativeinterface Change license for tests files 2024-02-04 09:56:42 +01:00
qnumeric Fix truncation warnings in tst_qnumeric 2024-03-16 15:41:03 +01:00
qoperatingsystemversion Fix build of tst_qoperatingsystemversion.cpp with C++20 2024-03-19 21:09:38 +01:00
qrandomgenerator Change license for tests files 2024-02-04 09:56:42 +01:00
qtendian Change license for tests files 2024-02-04 09:56:42 +01:00
qxp Add copyright and licensing to build system files missing it 2024-05-21 17:23:21 +02:00
CMakeLists.txt tst_QCompareHelpers: port to QTEST_THROW_ON_FAIL 2024-06-17 23:17:50 +00:00