qt5base-lts/tests/auto/corelib/global
Marc Mutz 78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
..
q_func_info Remove the qmake project files 2021-01-07 15:32:28 +01:00
qcompare Remove the qmake project files 2021-01-07 15:32:28 +01:00
qflags Restore C++20-deprecated mixed-enum bitwise operators 2022-03-15 11:36:09 +01:00
qfloat16 Fix tst_qfloat16 run time error for INTEGRITY (tested on sa8115) 2022-01-30 00:02:38 +00:00
qgetputenv Remove the qmake project files 2021-01-07 15:32:28 +01:00
qglobal Remove checks for features available in C++17 2021-10-02 17:54:39 +02:00
qglobalstatic tst_qglobalstatic is halted on INTEGRITY device 2021-12-20 10:14:38 +02:00
qhooks Remove the qmake project files 2021-01-07 15:32:28 +01:00
qkeycombination Remove the qmake project files 2021-01-07 15:32:28 +01:00
qlogging tst_qlogging (tst_qmessagehandler): use one line for output and expected 2022-02-20 23:32:26 -08:00
qnativeinterface Do not include qloggingcategory.h in public headers 2021-11-16 17:26:04 +00:00
qnumeric Exclude denormal test cases if system doesn't support it 2022-02-15 00:48:23 +02:00
qoperatingsystemversion Teach QOperatingSystemVersion to handle new OS entries in patch releases 2021-11-12 18:06:44 +01:00
qrandomgenerator Fix various -Wdeprecated-enum-float-conversions around the code 2021-07-27 14:58:41 +02:00
qtendian Suppress gcc warning -Wmemset-elt-size on test code 2021-06-14 15:57:16 +02:00
qwinregistry Remove the qmake project files 2021-01-07 15:32:28 +01:00
CMakeLists.txt Compile autotests for Integrity 2021-09-20 17:29:04 +03:00