Commit Graph

55304 Commits

Author SHA1 Message Date
Edward Welbourne
3acaf3160d Convert some if/else-if/else chains into switch()es
Some of the else if lines exceeded 100 characters, so should have been
split; and some lines already were split. So each whole chain should
have had braces on its bodies. Instead make it a switch, as this makes
it more evident what's going on in any case.  Furthermore, as each
branch did the same thing with dbType-specific strings, change to just
setting QLatin1String variables, so that the rest of the code needn't
be duplicated in each branch; it can simply be done once after the
switch, using the string's .arg() to embed fragments. In the process
break up the SQL query strings more gracefully, purge spaces just
inside C++ parentheses.

Change-Id: Ie26166e098ad74720bb6d7c4d9fe47718c33a13c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
35ec6283dc Convert some QVERIFY2() with useless messages to QVERIFY()
Telling us the condition tested should have been true is what
QVERIFY() does anyway, so don't go to the whole trouble of saying the
same thing - and wrapping it in in a QString() merely in order to then
qPrintable() it back out again, pointlessly converting a C-string to
unicode and back again.

At the same time, skip one other qPrintable(QString("...")) without
.arg() formatting; and change the check it's the message for to use
QL1S::arg() instead of QString::arg().

Change-Id: Ie71a79da8017916d301a38b69fc422e55a5a3649
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
3253037329 Suppress, and thus verify we do get, two warnings in tst_QSqlQuery
Expected warnings are clutter for anyone reding the output, so
suppress them when they're correct behavior.

Change-Id: Idf47ba4fab8069237067d9b20afef3041e0c2f8c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
9030ffdffb Use qScopeGuard() to take care of post-test tidy-up
Doing the tidy-up after the last check has the problem that it gets
skipped if any check fails, as the premature return skips the tidy-up.
In the process, added the missing tidy-up to prematureExec().

Repackage the code for one tidy-up as a named lambda so that the
duplicate can share it with the scope guard. Made some existing scope
guards const, while I was about it, so that the one that isn't -
because it gets dismiss()ed - stand out.

Change-Id: I96d6834d5d7675f15018169a7093b0211db6f8a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Joerg Bornemann
9a0cfaf78d Remove QT_FEATURE_sharedmemory from qconfig-bootstrapped.h
This amends commit 75082c9f20.

Change-Id: Idd1f9a8cd86c1d265d20917594fbeea26f1f8bf2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-10 17:52:27 +01:00
Mårten Nordheim
24249c0b67 QStringConverter: Add missing include on Windows
It's relied on implicitly, which is no longer valid in dev.
And may accidentally be broken in other branches.

Pick-to: 6.3 6.2
Change-Id: I2272b6914e883e20d0989a1762eb1a5c1aef4e0e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-10 16:52:26 +00:00
Fabian Kosmale
5f987317a7 Split namespace macros from qglobal.h into their own header
Task-number: QTBUG-99313
Change-Id: I7fb0a82de68ebcc75d86612b4b3f79dc0099db1f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 17:40:55 +01:00
Christian Heimlich
920c1e9d56 Add c++20 alias for c++2a in qmake default mkspecs features
Implemented as an alias to keep c++2a working and remain consistent with
the way this was handled for the c++20 switch in cmake and the c++17
switch in qmake.

Pick-to: 6.2 6.3
Change-Id: I9a5f6d6b3a3adec748cf7207ceaa6da98d053cdb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-10 15:30:48 +00:00
Andreas Buhr
00f1bd00d0 Set Roboto as the default font on Android
Roboto is the default font on Android. So far, Helvetica
was used, which is usually unavailable on Android.

Task-number: QTBUG-87405
Change-Id: I53332403a43f6a005ce73ece68b8dddc41b4b58c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-10 15:43:00 +01:00
Alexey Edelev
723a4e2b89 Add missing include of QtPublicCMakeHelpers
Amends 2201934efa

Pick-to: 6.2 6.3
Task-number: QTBUG-99491
Change-Id: I449f0705f1e41fd4609008ae6a7f4107cd0a4ca6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-02-10 15:43:00 +01:00
Andreas Buhr
9e082faf30 Activate tst_QTimeLine on Android
Fixes: QTBUG-88137
Change-Id: I2b66eefd7733198664eaeecf9507daabb3a04e81
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-10 15:14:57 +01:00
Allan Sandfeld Jensen
8d714c0c69 Fix compiling with C++20 on macOS
This code triggers warnings about mixing enums of different
types, which breaks compiling with warnings-are-errors.

'bitwise operation between different enumeration types is deprecated'

Pick-to: 6.3 6.2
Change-Id: Ib6c19f02f7c7593c9e22da5e648ea1f2f2ae757b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 12:54:36 +00:00
Kevin Funk
f57fd83f7d Fix -Wsuggest-override warnings from Clang 11+
Before this patch, Clang versions greater than 11.0.0 emitted
-Wsuggest-override warnings whenever the Q_OBJECT macro was used.

Excerpt from compiling GammaRay against Qt 6, using Clang 13.0.0:

```
.../qtbase/src/corelib/io/qfile.h:96:5: warning: 'qt_metacall' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
    Q_OBJECT
    ^
.../qt5/qtbase/src/corelib/kernel/qtmetamacros.h:166:17: note: expanded from macro 'Q_OBJECT'
    virtual int qt_metacall(QMetaObject::Call, int, void **); \
                ^
.../qt5/qtbase/src/corelib/io/qfiledevice.h:54:5: note: overridden virtual function is here
    Q_OBJECT
    ^
.../qt5/qtbase/src/corelib/kernel/qtmetamacros.h:166:17: note: expanded from macro 'Q_OBJECT'
    virtual int qt_metacall(QMetaObject::Call, int, void **); \
                ^
```

This was also discussed on the QtCreator mailing list:
  https://www.mail-archive.com/qt-creator@qt-project.org/msg08500.html

Pick-to: 6.2 6.3
Change-Id: I149782472ce8a2e30ed8062ada460c39926f1613
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-10 12:38:19 +00:00
Thiago Macieira
dcdb8884e7 QFreeList: replace a Q_ASSERT(false) with Q_UNREACHABLE()
Q_ASSERT goes away in release builds, Q_UNREACHABLE() does not.

This also solves the GCC 12 warning about out-of-bounds access in
QAbstractEventDispatcherPrivate::allocateTimerId():

In member function ‘_PTp* std::__atomic_base<_PTp*>::load(std::memory_order) const [with _PTp = QFreeListElement<void>]’,
    inlined from ‘_Tp* std::atomic<_Tp*>::load(std::memory_order) const [with _Tp = QFreeListElement<void>]’ at atomic:579:25,
    inlined from ‘static T QAtomicOps<X>::loadAcquire(const std::atomic<T>&) [with T = QFreeListElement<void>*; X = QFreeListElement<void>*]’ at thread/qatomic_cxx11.h:249:29,
    inlined from ‘X* QBasicAtomicPointer<X>::loadAcquire() const [with X = QFreeListElement<void>]’ at thread/qbasicatomic.h:233:64,
    inlined from ‘int QFreeList<T, ConstantsType>::next() [with T = void; ConstantsType = QtTimerIdFreeListConstants]’ at qfreelist_p.h:245:34,
    inlined from ‘static int QAbstractEventDispatcherPrivate::allocateTimerId()’ at kernel/qabstracteventdispatcher.cpp:99:24:
bits/atomic_base.h:820:31: warning: ‘long unsigned int __atomic_load_8(const volatile void*, int)’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  820 |         return __atomic_load_n(&_M_p, int(__m));
      |                ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from qglobalstatic.h:1,
                 from qglobal.h:1395:
qglobalstatic.h: In static member function ‘static int QAbstractEventDispatcherPrivate::allocateTimerId()’:
qglobalstatic.h:127:23: note: at offset -8 into destination object ‘holder’ of size 56
  127 |         static Holder holder;
      |                       ^~~~~~

Pick-to: 5.15 6.2 6.3
Change-Id: I74249c52dc02478ba93cfffd16d232b275d5d216
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 11:10:15 +00:00
Sivan Nanthiran
cb9ef46c77 Change comparison data type to fix int overflow
Since the value returned by CGDisplaySerialNumber is uint32_t,
comparing it with a long data type can cause overflow when the
value is greater than or equal to 2^31. And since this is a serial
number, in some machine this value can be greater than 2^31.
In those machines, QScreen::name will be empty due to the failed
check here.

Pick-to: 6.3 6.2 5.15
Change-Id: Ia037ba9e7a6d8025cc4b41c1b428eba38455330d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-10 11:10:14 +00:00
Janne Juntunen
9a7e55dcbe tst_qrhi: use OpenGL instead of raster pipeline on webOS
Raster pipeline is not supported on webOS OSE: trying to use it causes
an exit(1).

Fixes: QTBUG-100654
Pick-to: 6.3
Change-Id: I00325fc1330a2d0d4abfdee054343ecfac767309
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-02-10 12:03:36 +02:00
Marc Mutz
65b62d2d5c QPageSize: pack StandardPageSize struct
On most platforms, the old struct had a padding hole before the FP
members, as well as after the character array.

By packing the integer members into bit fields, we compress five ints
incl. the padding hole (24 bytes) into 64 bits w/o padding (8
bytes). The size of the struct shrinks from 80 to 64 bytes, saving
almost 2KiB in TEXT size. Four bytes of tail padding remain, and are
available to grow the character array in the future.

More compactification could be had by changing the FP members (either
by turning them into floats and/or by making them a union over {mm,
in}, because one can be calculated from the other), but these are for
another patch, because they change return values.

Pick-to: 6.3 6.2
Change-Id: I0e7f354a0341e94e9a9401a7d3b4529a8ff20a3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-10 10:03:37 +01:00
Thiago Macieira
6586b030d1 Fix GCC12 warning about using a pointer after realloc()
qmalloc.cpp:92:18: warning: pointer may be used after ?void* realloc(void*, size_t)? [-Wuse-after-free]
   92 |         qptrdiff oldoffset = static_cast<char *>(oldptr) - static_cast<char *>(actualptr);
      |                  ^~~~~~~~~

Pick-to: 6.2 6.3
Change-Id: I74249c52dc02478ba93cfffd16d230165b6f030f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-09 20:13:34 -08:00
ChunLin Wang
52a83658c3 Don't replace IntersectClip with ReplaceClip on a QPicture
QPainter should not try to be smart and optimize IntersectClip with ReplaceClip when working on a QPicture paint device. Doing so will change the end result as the actually state when replayed might be different from the one it was recorded in.
QPainter will no longer try to replace IntersectClip with ReplaceClip if the paint engine is a QPicture.Consistent with QPainter::setClipRect and QPainter::setClipRegion.

Fixes: QTBUG-100420
Pick-to: 6.2 6.3
Change-Id: I1e0ebbc2d6e1ffd98b9f3f537e83893579606a4b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-02-10 12:08:05 +08:00
Zhang Hao
bb67b6ff26 Always update pressedPosition when drag was enabled
Since e02293a76d and
2e0c29a4bb was committed,
If a item width more than others,the selectionRect.x() always consist
of currentStartSelection item's rect.center().x(),this will cause
selectionRect size is not right.

Because the code of 2e0c29a4bb is to fix
the new bug introduced by e02293a76d,
we need to use a better way to solve QTBUG-78797.

When itemview enable drag,we need always update pressedPosition because
pressedPosition was used to determine the drag distance, otherwise keep
previous logic.

Fixes: QTBUG-78797
Fixes: QTBUG-81542
Fixes: QTBUG-99512
Pick-to: 6.2 6.3
Change-Id: Ibc5020e35b0eb319e4b5546bdba39ff527c209a6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-02-10 03:37:18 +00:00
Fabian Kosmale
ae7799a924 qtextstream.h: streamline includes
[ChangeLog][Potentially Source-Incompatible Changes] The qtextstream
header no longer includes <QString>, <QStringEncoder> and
<QStringDecoder>. Code which relied on the implicit inclusion of those
classes might now need to include the headers explicitly.

Task-number: QTBUG-97601
Change-Id: Ifb8c8452026195a772c0588dbbbc53fb51cac548
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-10 04:34:13 +01:00
Alexey Edelev
2201934efa Use 'copy' but not 'copy_if_different' on Windows platforms
Use custom script to copy big Android artifacts on Windows platforms.
The script uses 'copy' but not 'copy_if_different' when source file
size is bigger than 2GB. 'cmake -E copy_if_different' only compares
first 2GB of files because of cmake issue, so this step only
workaround the problem.

Pick-to: 6.2 6.3
Task-number: QTBUG-99491
Change-Id: Id076734700e334dfc3330da412462c2b53829b33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-10 02:31:05 +01:00
Pino Toscano
06e7b5168e Hurd: enable XOPEN largefile APIs
Hurd supports largefile, so enable it also in Qt.

Change-Id: I8384ca2cb5c6250376916b6a890e1a873c0a0e96
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-10 01:41:23 +01:00
Assam Boudjelthia
5deb4e7d25 Android: document how to handle code that loads QML from strings
If an app is loading QML from a string at runtime from C++, the
dependencies/imports might not be bundled into the app package,
and then the app might fail at runtime. A fix is to have a QML
file with needed imports to properly deploy those impots' libs.

Fixes: QTBUG-100394
Pick-to: 6.2 6.3
Change-Id: I10136dc2dd1ac1f4ffe00bcf2cfd6c98e050ef28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-02-10 01:45:10 +02:00
Marc Mutz
d60af047fe QUrl: use qOffsetStringArray for idn_whitelist
Removes 61 relocations from QtCore:

before:

  $ ~/bin/relinfo.pl libQt6Core.so.6.4.0
  libQt6Core.so.6.4.0: 6364 relocations, 5407 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users

after:

  $ ~/bin/relinfo.pl libQt6Core.so.6.4.0
  libQt6Core.so.6.4.0: 6303 relocations, 5346 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users

Pick-to: 6.3
Task-number: QTBUG-100536
Change-Id: I29be3416eaacf7b2049d1e3eec15600d7e7c37c0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-09 21:26:20 +00:00
Mårten Nordheim
4fe79a23cd QAbstractSocketPrivate: Initialize members in-class
Change-Id: I267b5037801f226379a154731be9ef81cccb828e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-09 22:26:20 +01:00
Mårten Nordheim
50c8ec9fa4 QAbstractSocket: Don't pretend pause and resume is a stack
It only stores one layer of state, and pausing twice in a row will just
overwrite the previous state. This doesn't happen often but can happen,
especially on Windows if a certificate needs to be looked up in the system
certificate stores (socket gets paused) and then a recoverable error
occurs in QNAM (socket gets paused again).

Fixes: QTBUG-100362
Fixes: QTBUG-63196
Fixes: QTBUG-98476
Pick-to: 6.3 6.2 5.15
Change-Id: Ie524c48e11b6fa8010b78cc1bf3931efe2ce3351
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-09 22:26:20 +01:00
Allan Sandfeld Jensen
f3d89adf6d Remove redundant semi-colons
Triggers warnings in clang

Pick-to: 6.3 6.2
Change-Id: I324a3c253eed9ed31a7475040da77d5c1bcdb394
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-09 21:26:19 +00:00
Allan Sandfeld Jensen
5a90ca19e6 Remove redundant semi-colons
Clang warns us against them.

Pick-to: 6.3 6.2
Change-Id: I9af45e9254f6a1adb3e8d78983f458b0302b0d57
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-09 21:26:19 +00:00
Ivan Solovev
7c00ad4e9a Android: Re-focus focused accessibility node after orientation change
Before this patch the accessibility focus on a selected element could
be drawn incorrectly after the screen orientation has changed.
The reason for that is that wrong X and Y offsets were used for it.
The offsets are used to take the sizes of different panels (like
buttons and notifications bar) into account.
Normally they are updated only when getNodeForView() is called and the
whole accessibility info is reconstructed.
However, when the screen orientation changes, we get some
getNodeForVirtualViewId(selectedId) calls before the whole accessibility
tree is recreated. This is when redrawing happens, and as I understand,
this is an internal Android event, so we can't do much about it.

The most straightforward fix for the problem would be to query the
offsets also in each getNodeForVirtualViewId() call. However, offset
calculation seems to be quite heavy operation, and
getNodeForVirtualViewId can be called very often (esp. if we have a lot
of UI elements). As a result, this fix can't be implemented.

In this patch I came up with the second approach - once getNodeForView()
is called, and it detects that the offsets have changed, we force
re-focus of the currently selected element. This allows us to retain the
offsets-caching mechanism.

Fixes: QTBUG-93402
Pick-to: 6.3 6.2 5.15
Change-Id: Ic420afe1fe5e80fbdf91b2b2651f2daa71c6e44d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-09 21:46:25 +01:00
Marc Mutz
0a24e2e984 QSettings: use QtMiscUtils hex tools instead of rolling your own
Removes a static string literal. QtMiscUtils allows the compiler to
possibly avoid the array, or share with other TUs

Pick-to: 6.3
Change-Id: I449800f113620a53d2f4b11fe027ebcb710f7b86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 21:46:25 +01:00
Marc Mutz
e65a14f82f QTzTimeZonePrivate: make ZoneNameReader constinit'able
It's used as a thread_local static, so it better be.

What prevented it was the unused inheritance from QObject and the
missing constexpr ctor of the StatIdent() data member.

Fixed both.

Pick-to: 6.3
Change-Id: I312ed6dc8bf7193cdaa7dc708bf19b018e56ec8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-09 21:46:25 +01:00
Marc Mutz
38d2f60f9a QPropertyBindingSourceLocation: make (source_location) ctor constexpr
The typical argument, source_location::current(), is consteval, so it
cannot actually be used outside constexpr contexts. Having a
non-consteval, non-constexpr ctor to accept the return value is
conceptually wrong, as a constexpr-only result is forced though a
non-constexpr function. It may even trigger MSVC's consteval bug:

  https://developercommunity.visualstudio.com/t/Cannot-use-std::source_location-in-C-m/1436152

because the work-around given, wrapping in a lambda, means wrapping
the result in a constexpr context, and that may just be the root cause
of the issue.

Pick-to: 6.3 6.2
Change-Id: I49534cf86f32e16b13d7e169cd5cb0c8fc374d69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-09 21:46:24 +01:00
Marc Mutz
e128ed2c5d Convert string tables in QShaderDescription to use string literals [2/2]
Avoid allocating all these strings on load. Part 2: JSON keys.

Pick-to: 6.3 6.2
Change-Id: I1724a58d700509c3af90ad1b87cb1bccae1075b8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-02-09 20:46:24 +00:00
Marc Mutz
bfd21b888b QPageSize: remove 119 relocations
Also saves ~1.4KiB in combined TEXT and DATA size on optimized Linux
GCC 11 C++20 AMD64 builds.

Pick-to: 6.3 6.2
Change-Id: I53922ccd191e412a13e3e23f2e26fdb3bf43af33
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-09 21:46:24 +01:00
Marc Mutz
d04d571d3a QEventDispatcher/GLib: avoid three relocations
This string table is small, so instead of using qOffsetStringArray(),
just don't make it static. The compiler will do it's thing, then,
without introducing relocations.

Proof:

  $ ~/bin/relinfo.pl libQt6Core.so.6.4.0
  libQt6Core.so.6.4.0: 6303 relocations, 5346 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users

vs.

  $ ~/bin/relinfo.pl libQt6Core.so.6.4.0
  libQt6Core.so.6.4.0: 6300 relocations, 5343 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users

Task-number: QTBUG-100536
Pick-to: 6.3 6.2
Change-Id: I7f5c3c127867c9baebfb270ef3e257dd818f821a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 21:46:24 +01:00
Edward Welbourne
69e445721c Get rid of empty optional methods in tst_QSqlQuery
No need for a virtual do-nothing destructor in a class that isn't
inherited from. Defining an empty init merely makes QTest go to the
trouble of calling it, which it could just as well skip.

Change-Id: Ifd44c473c05fdeaaa7923d2ccdd0a13c8921b6bd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-02-09 21:46:24 +01:00
Edward Welbourne
0828014b44 Fix an inaccurate comment and update a test case
The offset fields for tst_QTimeZone::specificTransition() had a
comment claiming they are in minutes; they are in fact in seconds, so
fix that. At the same time, Moscow hasn't had a time-zone change since
2017, so the end-date for one of the test intervals can be nudged a
little closer to the present without harm.

Change-Id: I66822cb758f7e00d6added801466a6745be3e31a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-09 20:46:24 +00:00
Alexey Edelev
15bcf03f3e Mention that the QT_ANDROID_ABIS property only affects executable targets
Pick-to: 6.3
Task-number: QTBUG-100208
Change-Id: I3ca0a2b74f87557772fd7ac34f280ec1b2344dd1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-02-09 21:46:24 +01:00
Thiago Macieira
29fceed2ff QProcess/Unix: ensure we don't accidentally execute something from CWD
Unless "." (or the empty string) is in $PATH, we're not supposed to find
executables in the current directory. This is how the Unix shells behave
and we match their behavior. It's also the behavior Qt had prior to 5.9
(commit 28666d167a). On Windows, searching
the current directory is the norm, so we keep that behavior.

This commit does not add an explicit check for an empty return from
QStandardPaths::findExecutable(). Instead, we allow that empty string to
go all the way to execve(2), which will fail with ENOENT. We could catch
it early, before fork(2), but why add code for the error case?

See https://kde.org/info/security/advisory-20220131-1.txt

[ChangeLog][Important Behavior Changes] When passed a simple program
name with no slashes, QProcess on Unix systems will now only search the
current directory if "." is one of the entries in the PATH environment
variable. This bug fix restores the behavior QProcess had before Qt 5.9.
If launching an executable in the directory set by setWorkingDirectory()
or inherited from the parent is intended, pass a program name starting
with "./". For more information and best practices about finding an
executable, see QProcess' documentation.

Pick-to: 5.15 6.2 6.3
Change-Id: I54f205f6b7314351b078fffd16cf7013c97ee9fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 11:26:32 -08:00
Marc Mutz
ec03db7bb3 Fix C++20 ambiguous relational operators between QJsonValue{,Ref}
In C++20, any given relational operator is also considered in its
reversed form, so e.g.

   given op==(X, Y)
   and X x, Y y, then y == x will compile, by using the reversed op(X, Y)

This, unfortunately, makes some existing asymmetric operator overload
sets ambiguous, and instead of applying tie-breaker rules, at least
Clang is warning about these.

For us, this means we need to make our overload set non-ambiguous. The
QJsonValue{,Ref} classes failed this, because they only provide the
following member-operators:

- QJsonValue::op==(const QJsonValue&) const
- QJsonValueRef::op==(const QJsonValue &) const

For member functions, there are no implicit conversions on the LHS. So
in C++17, we have a nice dichotomous overload set:

- LHS is QJsonValue -> use QJsonValue::op==(QJsonValue)
- LHS is QJsonValueRef -> use QJsonValueRef::op==(QJsonValue)

In both of these, it the RHS is a QJsonValueRef, it's implicitly
converted to QJsonValue for the call.

Enter C++20, and the reversed signatures are suddenly available, too,
which is a problem for QJsonValueRef <> QJsonValueRef, which could be
resolved, as in C++17, using

  lhs.QJVR::op==(QJV(rhs))

or it could now be

  rhs.QJVR::op==(QJV(lhs)); // reversed

Says Clang 10:

  tst_qtjson.cpp:990:5: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'QJsonValueRef' and 'QJsonValueRef') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
    CHECK(r0, a0, r1);
    ^     ~~      ~~
  qjsonvalue.h:189:17: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
    inline bool operator==(const QJsonValue &other) const { return toValue() == other; }
                ^

A similar argument makes op!= ambiguous.

Says Clang 10:

  tst_qtjson.cpp:988:5: error: use of overloaded operator '!=' is ambiguous (with operand types 'QJsonValueRef' and 'QJsonValueRef')
    CHECK(r0, r0, r1);
    ^     ~~  ~~
  qjsonvalue.h:190:17: note: candidate function
    inline bool operator!=(const QJsonValue &other) const { return toValue() != other; }
                ^
  qjsonvalue.h:189:17: note: candidate function
    inline bool operator==(const QJsonValue &other) const { return toValue() == other; }
                ^
  qjsonvalue.h:189:17: note: candidate function (with reversed parameter order)

To fix, provide the missing operators as free inline functions (so Qt
6.2 and 5.15 don't get new symbols added) so there's always exactly
one best match.

This is a fix for 6.2 and 5.15. At the time of writing, 6.3 isn't
released, yet, so there, we could QT_REMOVED_SINCE the pre-existing
member operators in favor of hidden friends (as per QTBUG-87973).

Use C++17'isms to prevent an automatic merge to 5.15, which requires

   contains(QT_CONFIG,c++2a):CONFIG += c++2a

added to tst_qtjson.pro.

[ChangeLog][QtCore][QJsonValue] Fixed relational operators to not
cause warnings/ambiguities when compiling in C++20.

Pick-to: 6.3 6.2 5.15
Change-Id: Ic70f3cad9987c87f7346d426c29cc2079d85ad13
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-02-09 20:26:31 +01:00
Sona Kurazyan
c0ede98727 Export QFutureCallOutInterface to allow external use
2dea20e4b0 de-inlined the dtor to avoid
duplicating its vtable in multiple translation units, but the class is
used externally, so we need to export it now.

Pick-to: 6.3
Fixes: QTBUG-100569
Change-Id: I7cf2abdfdeb59bced0631838fe329ba94ab8c73a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-09 20:26:31 +01:00
Joerg Bornemann
d03385df9d Remove QXml* from bootstrap lib
Those classes are not used by any bootstrapped tool.

Also remove the QT_BOOTSTRAPPED code paths.

Change-Id: Ic5a9b153a578fedcba37cd81a62ccf0182a2d34f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-09 19:49:37 +01:00
Joerg Bornemann
4fb5923432 Remove QLine, QPoint, QRect, and QSize from bootstrap lib
Those classes are not used by any bootstrapped tool.

Change-Id: I82fc32e16d044b91ab3a79109ab98a3010df2e2d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 19:49:37 +01:00
Thiago Macieira
ea89d0a36c qglobal: add a way to selectively export in Qt 6 XOR Qt 7
Because at least one compiler *cough*MSVC*cough* is unable to dllexport
a method that is in a dllexport'ed class.

Change-Id: I54f205f6b7314351b078fffd16d06b4e6ef0c086
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-09 10:49:37 -08:00
Thiago Macieira
0e84d04b90 qglobal: Move the export macros further up in the file
Before the #ifdef __cplusplus and namespace start. We don't need to
export anything from C (and I hope that remains the case), but at least
this removes the need for QT_{BEGIN,END}_INCLUDE_NAMESPACE. Which also
weren't needed.

Pick-to: 6.2 6.3
Change-Id: I54f205f6b7314351b078fffd16d0bc84c57cb2ec
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-09 18:49:37 +00:00
Joerg Bornemann
b9cd52bef3 Remove QDom from bootstrap lib
It's not used by any bootstrapped tool.

Change-Id: Id6751e80bb34642aeaea1c2bb4f24b480280623d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 19:49:36 +01:00
Joerg Bornemann
c22b30f594 Remove QSystemSemaphore from bootstrap lib
This class is used by androidtestrunner, which is not bootstrapped.

Change-Id: Ie75b4dd039f773a8ccb58f243bf9f74a5121c3f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 19:49:36 +01:00
Tor Arne Vestbø
985f0e9ca5 macOS: Don't print stack trace via lldb on test failure if SIP prevents it
If the CSR_ALLOW_UNRESTRICTED_FS bit of System Integrity Protection (SIP)
is enabled lldb will fail to print a valid stack trace when launched from
the crashed process, and might also resulting in hanging or crashing the
parent process (Terminal e.g.):

  https://github.com/llvm/llvm-project/issues/53254

We detect this situation and avoid printing a stack trace if so.

Pick-to: 6.3 6.2
Change-Id: Iad8cab5fcdc545d810ca4d4e985aefc0988d0234
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-09 18:19:57 +01:00
Tor Arne Vestbø
13fa00519d doc: Update GenericDataLocation location on iOS
Now matches implementation.

Fixes: QTBUG-100364
Pick-to: 6.2 6.3 5.15
Change-Id: I1274b8b485f1a02a79b7abebc2289613958f9a76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 18:19:57 +01:00