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 fff6562f8c074d75bda8b80f844dc63c6f2e64d5 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 e1f45ad8187947e243c8247c5cbac2d884d68d55 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>
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%