qt5base-lts/tests/auto
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
..
bic/data Add BC files for 6.2.0 2022-01-07 13:31:38 +00:00
cmake Do not use PUBLIC linking with plugins and tests 2022-02-28 23:08:20 +01:00
concurrent Fix memory leak in QtConcurrent::run when called with a NULL QThreadPool 2022-01-24 22:40:35 +01:00
corelib Restore C++20-deprecated mixed-enum bitwise operators 2022-03-15 11:36:09 +01:00
dbus tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
gui QColor: deprecate isValidColor, setNamedColor, string-ish ctors 2022-03-15 10:36:09 +00:00
guiapplauncher
network Support global data tags in blacklisting identification of test-cases 2022-03-14 20:16:35 +01:00
opengl
other Android: unblacklist tst_toolsupport::offsets 2022-03-04 02:37:11 +01:00
printsupport QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
shared Remove false Q_UNREACHABLE from shaping code 2021-02-03 09:44:44 +01:00
sql Deprecate {QString, QByteArray}::count() 2022-03-12 01:05:45 +01:00
testlib CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test 2022-02-11 21:54:44 +01:00
tools Deprecate {QString, QByteArray}::count() 2022-03-12 01:05:45 +01:00
widgets Fix losing QOpenGLWidget paints when a child widget is invisible 2022-03-14 17:48:52 +01:00
xml Activate tst_qdom for Android 2022-02-22 17:22:58 +01:00
CMakeLists.txt Don't build tests/auto/tools when cross-compiling 2021-10-07 08:03:40 +02:00
network-settings.h Fix check for IPV6 support without certain features 2022-02-28 22:08:21 +00:00