Commit Graph

98 Commits

Author SHA1 Message Date
Alexey Edelev
e38eef345e Replace the specific gcov compile and link options with generic --coverage
Follow up commit fixing review comments.

Amends 42d2944191

Task-number: QTBUG-86223
Change-Id: Ia1353fd9855d6811e58ae8b706e932f01fdeec28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-02 19:49:34 +01:00
Amir Masoud Abdol
66b7cb2a88 Suppress "duplicate libraries" warning for Xcode 15
A bug in Xcode 15 adds duplicate flags to the linker. In addition, the
`-warn_duplicate_libraries` is now enabled by default which may result
in several 'duplicate libraries warning', and build failure if
`-Wl,-fatal_warnings` is passed. By adding the newly introduced
flag, `-no_warn_duplicate_libraries`, to the linker we can suppress the
warnings, and possible fatal error caused by this bug.

Change-Id: I65e06ea039a6e98b02ed1f9112c622ecc6a142b5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-24 22:10:43 +02:00
Yuhang Zhao
b6e7aad064 MSVC: remove clang-cl parameters
clang-cl share many parameters with MSVC, but it makes the CMake code
complex. We temporarily remove the clang-cl compat code paths from the
MSVC code and they will be brought back in a central place in a separate patch.

Change-Id: I28b93c04d65e9a5133d61c7fbbdc5c83cc8cc37e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-08 04:58:50 +00:00
Alexey Edelev
42d2944191 Add coverage and coverage-gcov features
Features enable code coverage collecting using the gcov tool. The
resulting reports can then be post-processed by lcov or similar tools.

[ChangeLog][CMake][Coverage] Added the coverage configuration argument.
The only supported coverage tool at the moment is gcov. The argument
requires Qt is built in Debug otherwise setting the argument leads to
the configuration error. Typical usage:
  <...>/configure -developer-build -coverage gcov

Task-number: QTBUG-86223
Change-Id: I39b2061f544997a7c4fe6f4d135c0ab447f15a17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-22 15:54:30 +02:00
Marc Mutz
11d6932560 Mark all of Qt as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses in this and some other modules is still
extremely high, too high for anyone to tackle in a short amount of
time. Even if they're not concentrated in just a few TUs, we need to
make progress on a global QT_NO_FOREACH default, so grab the nettle
and stick to our strategy:

Mark the whole of Qt with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. For TUs that are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too).

In tst_qglobal.cpp and tst_qcollections.cpp change the comment on the
#undef QT_NO_FOREACH to indicate that these actually test the macro.

Task-number: QTBUG-115839
Change-Id: Iecc444eb7d43d7e4d037f6e155abe0e14a00a5d6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-19 05:19:42 +00:00
Alexey Edelev
ecda814b91 Allow disabling QT_USE_QSTRINGBUILDER definition for module targets
Currently QT_USE_QSTRINGBUILDER is added for all Qt module targets by
default, and it's not possible to remove this definition.
Replace this definition with the generator expression that is
propagated by the PlatformModuleInternal target.

Change-Id: I1c606e16809dc720e2eb72191e1670dfc48f1b48
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-09 15:53:08 +02:00
Alexey Edelev
d14f15f380 Allow disabling QT_USE_QSTRINGBUILDER definition for tool targets
Currently QT_USE_QSTRINGBUILDER is added for all Qt tool targets by
default, and it's not possible to remove this definition.
Replace this definition with the generator expression that is
propagated by the PlatformToolInternal target.

Change-Id: Iac3bd3ea76e7b439cf7957146b4b6dd20ecdbe3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-09 15:53:07 +02:00
Alexey Edelev
a9e548963e Use QT_USE_QSTRINGBUILDER by default for all internal plugin targets
Change-Id: I24839d260dc6e3624bcedcdfe799871b239191f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-08 09:47:33 +02:00
Alexey Edelev
28c9625d00 Fix CMP0099 impact - disallow propagating internal linker options
CMP0099 changes the way of LINK_ONLY genex works. With CMP0099 set to
OLD LINK_ONLY genex only links the exact library binary/archive without
propagating other interface options from the target. This feature was
exploited by PlatformXInternal targets to avoid propagating of their
linker options. Nowadays when CMP0099 is forced to NEW by Qt scripts,
including user-facing, we cannot rely on LINK_ONLY genex.

Introduce _qt_is_internal_target property that is set for all Qt
executables and explicitly limits the propagation of the linker
options from PlatformXInternal targets.

Pick-to: 6.5 6.6
Fixes: QTBUG-113641
Change-Id: I3a0ecddb65886e435073feb24c1b47035130ba70
Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-16 20:58:02 +02:00
Alexey Edelev
4e74fa8119 Fix typo in qt_internal_add_global_definition
Fix the argument prefix that is used in the cmake_parse_arguments call.

Pick-to: 6.5 6.6
Change-Id: Ie02bdf7d2769ce084b0d173c1e8152ca6fc4fe53
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-14 16:18:55 +02:00
Amir Masoud Abdol
585dd9d8d5 Add NOMINMAX to PlatformCommonInternal
By not explicitly disabling min/max macros of `windows.h`, we may see
some unintended substitutions. This is especially important now that we
are moving toward enabling Unity Build, and some of the constructs for
manually dealing with this issue, eg., `#ifdef max`, `#undef max`, might
not make it to the pool, and as a result we get build failure.

Pick-to: 6.5
Change-Id: Ie3c31aebe00300126a2ac3a6044876ab92d5d99c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-31 16:37:22 +02:00
Christophe Marin
b53bf18280 CMake: Fix a typo in QtModuleHelpers.cmake
Rename is_staitc_lib_during_static_qt_build to
is_static_lib_during_static_qt_build.

Pick-to: 6.5 6.2
Change-Id: Iec0f4d5d025e07a857a086e960eaf7b6fa2638a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-02 12:26:26 +02:00
Tor Arne Vestbø
c91ae574ed Disable objc_msgSend stubs in static libs to maintain Xcode < 14 compat
Xcode 14's Clang will emit objc_msgSend stubs by default, which ld from
earlier Xcode versions will fail to understand. Disable these stubs
explicitly for static libs, for as long as we support Xcode < 14.

 See https://github.com/llvm/llvm-project/issues/56034

Pick-to: 6.5
Fixes: QTBUG-112820
Change-Id: Id762873d61b9d147bf3eb6292297e7b80b7393e1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-13 19:37:55 +02:00
Amir Masoud Abdol
f5aa8317d0 Add -Wno-error=stringop-overread to warnings_are_errors_flags
Besides `stringop-overflow`, the `stringop-overread` is also buggy, and
it has some false positives. If not silenced, this will break the
unity build as several warnings are being emitted in qmetaobject.cpp,
etc.

Pick-to: 6.5
Change-Id: I708c81057c01d8d8fc9694c394c89602a2f6867b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-07 16:06:22 +02:00
Marc Mutz
0ba063f436 Enable QT_NO_AS_CONST globally
All current modules are free of qAsConst, make sure new ones will be,
too.

Change-Id: Iae3c67bca86eddf62ae664b00ff39a9b513d7290
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-05 15:09:49 +01:00
Marc Mutz
e1b76ee928 Remove the last in-tree user of qExchange() and mark all of Qt free of it
We've ported all qExchange() to std::exchange by now, across all
modules, but the one in QScopedValueRollback was left behind, because
it requires C++20's version of std::exchange (constexpr).

Since q20::exchange was not approved, replace the qExchange() here
with two moves and add a comment to port to std::exchange() once we
can depend on C++20.

Then add QT_NO_QEXCHANGE to avoid new uses from creeping in.

Change-Id: I488e252433e78fb2766639dbe77a22a55196cfd1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-14 19:07:19 +01:00
Giuseppe D'Angelo
365904085e QFile: make constructors taking a path explicit
This is a level A SIC, as it breaks

  QFile f = "/some/path";

In general, it's not a good idea to have this implicit conversion. A
QFile is not a representation of a path, so the conversion should be
explicit.

I am going to keep the current semantics (implicit conversion) up to and
including Qt 6.8 (LTS). Starting from 6.9, the constructor will be
unconditionally explicit. This is deliberate, and done in order to make
users fix their code while staying in Qt 6, rather than encountering
this issue (and countless many more) if and when they upgrade from Qt 6
to Qt 7. In the meanwhile, users can opt-in to the new semantics by
defining a macro.

[ChangeLog][QtCore][QFile] The QFile constructors that take a path are
going to become unconditionally `explicit` in Qt 6.9. Code like `QFile f
= "/path";` will need to be ported to equivalent one (e.g. `QFile
f{"/path/"}`). This has been done in order to prevent a category of
mistakes when passing strings or paths to functions that actually take a
QFile. Users can opt-in to this change even before Qt 6.9 by defining
the QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH macro before including any
Qt header.

Change-Id: I065a09b9ce5d24c352664df0d48776545f6a0d8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-29 23:22:25 +02:00
Volker Hilsheimer
f5de333192 MSVC: Disable conformance check that breaks with default WinSDK
The default Windows SDK installed for VC++ 2022 is 10.0.19041, and still
has the issue described here, breaking builds if -Zcpreprocessor is set:

https://developercommunity.visualstudio.com/t/stdc17-generates-warning-compiling-windowsh/1249671

The issue might be fixed in SDK version 2104 (10.0.20348.0), but until
that is the default SDK when installing the compiler, turn that
conformance check off again.

Partially reverts commit 8cb832090a

Change-Id: Ib22f8d196b978274ce31be727826b902e79aaa99
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-10-19 17:02:36 +02:00
Yuhang Zhao
ade68c9949 MSVC: Disable buggy conformance check
/Zc:lambda seems buggy. Although in my experiments it works well
for 99% Qt repos, it seems some tests will trigger the bug and it
also blocks some new commits. So disable it for now, it's not stable
enough.

Now that this check is disabled, the workaround for tst_qstringapisymmetry
is also not needed anymore, so remove the workaround as well.

Partially reverts commit 8cb832090a

Change-Id: Icf0ecbbaa6262522470e5f5dea05705985ab18f1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-18 19:31:25 +08:00
Yuhang Zhao
8cb832090a MSVC: Enable all possible conformance checks
For the full list, please refer to [1].

Needed to change the qstringapisymmetry unit test:
In theory we don't need the array to be static and it did compile
without any problems so far, indeed. However, with this patch applied,
MSVC complains that the lambda function below can't access the array.
I don't understand why, because we use [&] in the lambda and it should
capture all the variables in theory, but in reality it failed to
capture this variable in the end. And making the variable static
solves this issue. Maybe it's a MSVC bug.

Already tested locally. Most Qt repos build without any issues,
only very few repos are not tested, as my local environment
can't build them.

[1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-170

Change-Id: I658427aa171ee1ae26610d0c68640b2f50789f15
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-15 13:34:20 +00:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
976539b4af CMake: Create aliases for Internal targets using common function
Previously we did not create Qt6:: namespaced aliases.
This is needed as a workaround preparation for getting the package name
of a module target from one of it's properties.

Before it would fail in qtinterfaceframework because
ifvehiclefunctions-simulation-server uses PUBLIC_LIBRARIES
in its qt_internal_add_app call, and because _add_app does not handle
such an option, some weirdness in qtbase's _add_app -> _add_executable
-> _extend_executable -> _register_target_dependencies ended up trying
to register PlatformAppInternal as package dependency.
That issue will be handled in separate changes.

Pick-to: 6.4
Task-number: QTBUG-104998
Change-Id: Ifd03528c95b08cb6837a6aaa26cbf97c0cbabbb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-25 19:52:34 +02:00
Yuhang Zhao
ce9799e4c4 MSVC: Fix the CET parameters
To enable CET for MSVC, only passing "/CETCOMPAT" to
the linker should be sufficient.

Enabling generation of EH Continuation (EHCONT) metadata
is additional protection and should not be necessary.
It also requires all the dependencies to be re-compiled
with EHCONT enabled, otherwise the linker will refuse
to link the obj files. However, this is rather hard
to achieve if your application depends on many 3rd-party
libraries, so to let people enable CET more freely,
we don't enable EHCONT guard by default.

Pick-to: 6.4
Change-Id: Iba08a5ec56c474d291991fb751a0de764719bd85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-20 19:16:00 +08:00
Tor Arne Vestbø
e27a0d5a0f Disable bitcode for iOS
It's deprecated as of Xcode 14, and generates a warning message if a
project explicitly enables bitcode. The App Store no longer accepts
bitcode submissions from Xcode 14.

Pick-to: 6.2 6.3 6.4 5.15
Change-Id: Ib1f9d5114ca4d8b1845ecc7a9de0473ee015db33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-07 17:02:37 +02:00
Yuhang Zhao
6af63c8256 CMake: Update description of the Intel CET feature
Use a more detailed description instead.

Also adds the missing part of the GCC parameter.

Amends commit qtbase/42287255d38bf493b5731396b99bc9cd7b1baba4

References:
https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Instrumentation-Options.html#Instrumentation-Options

Change-Id: I94a22ac7dfa80644e92fe01021f7868dfa02dd69
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-06 00:31:47 +08:00
Thiago Macieira
500c116ced CMake: disable the attempt to force SIMD on iOS simulator builds
This will stop working with the next commit, which merges all basic x86
SIMD intrinsics into one configure test. As a result, linking almost
anything graphical on iOS (which is almost everything) causes the linker
to fail with undefined references to SIMD-optimized versions that didn't
get compiled.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c288f4104a6ccc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-27 20:28:41 -07:00
Kai Köhne
04cc705947 CMake: Fix typos
Found by codespell

Pick-to: 6.4
Change-Id: I4907e423b6b345acf82f2d7e0ed62479719d694e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-13 15:37:36 +02:00
Ville Voutilainen
5431b40ee8 Avoid some new clang 14 warnings on Android NDK 24 build
Task-number: QTBUG-99663
Change-Id: I1aa408ba468342e2fac2323ae91ff650b871c563
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-27 17:28:37 +03:00
Yuhang Zhao
42287255d3 Build system: Allow user to enable Intel CET
MSVC:
https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-eh-continuation-metadata?view=msvc-170
https://docs.microsoft.com/en-us/cpp/build/reference/cetcompat?view=msvc-170

GCC:
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Instrumentation-Options.html

Clang:
Don't know where's the documentation but should use
the same parameter with GCC.

Change-Id: I654618e45743a5ad1394c930932b9d0044572725
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-06 13:06:24 +08:00
Kai Köhne
dfe6601974 Bootstrap: Make compiler warnings fatal
Prevent compiler warnings from creeping into the bootstrap library.

Pick-to: 6.3
Change-Id: I8054416564c91fee256cad616911dd4ad231d0df
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-02 11:03:44 +01:00
Alexey Edelev
fd3341a74e Add qt_internal_undefine_global_definition function
qt_internal_undefine_global_definition disables an internal global
definition that is defined by the qt_internal_add_global_definition
function for a specific target.

Remove the ability to set the custom "undefine" flag for the
definitions since it's hard to control it using the introduced
function.

Pick-to: 6.2 6.3
Task-number: QTBUG-100334
Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-02 16:45:37 +01:00
Alexey Edelev
1d28fd7a9c Restore missing Qt definitions
Restore the 'QT_NO_JAVA_STYLE_ITERATORS' and
'QT_NO_NARROWING_CONVERSIONS_IN_CONNECT' definitions for Qt
targets.

Add the function that adds global definitions for Qt targets according
to the provided scope and the target property-based switch to disable
the definition for a specific target.

Pick-to: 6.2 6.3
Task-number: QTBUG-100295
Change-Id: I28697e81f9aabc45c48d79aae1e5caea141e04e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-31 17:40:43 +01:00
Alexandru Croitor
d6066d53fa CMake: Fix detection of linker availability
Previously we passed flags like -ld-fuse=lld only to compile
calls, but not to the link call of a compile test project.

Make sure to pass it to the link call instead by using
check_cxx_source_compiles + CMAKE_REQUIRED_LINK_OPTIONS
instead of
check_cxx_compiler_flag.

Note the flag that is passed is still via passed via the
compiler launcher and not directly to the linker.

Remove duplicate flag handling code.

Pick-to: 6.2 6.3
Change-Id: I1bf90573904a9df83240b6debfee3cc9e425c6bb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-18 14:28:57 +01:00
Marc Mutz
208cfad9ad Clang: don't error out on -Wdeprecated-enum-enum-conversion
Same treatment as is given to GCC further below.

Pick-to: 6.3 6.2
Change-Id: I3762c39a0b5d9add365ecf828b80d3ba432578c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-18 04:07:14 +01:00
Alexey Edelev
28da24a1a6 Enable -bigobj by default for Qt
Add '-bigobj' for MSVC and '-Wa,-mbig-obj' for MINGW to the
PlatformCommonInternal compiler options.

Pick-to: 6.3
Change-Id: I706b83d189a116a3ab6f93d59593e237e66b0e2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-07 15:21:18 +01:00
Yuhang Zhao
d2a0202cda MSVC: Optimize global data to reduce binary size
Package global data in COMDAT sections for optimization.
According to the docs, this can significantly reduce the
size of the resulting binary executable.

I've tested build Qt with /Gw locally with and without
LTCG, the result shows /Gw can reduce the binary size
indeed, but not "significantly". The result also reveals
that exes can benefit much more from /Gw than dlls.
The result can be seen from the QTBUG-98894 bug report.

Microsoft Docs:
https://docs.microsoft.com/en-us/cpp/build/reference/gw-optimize-global-data?view=msvc-170

Task-number: QTBUG-98894
Change-Id: Ibce34c98e791e519d669a5fe39c0027d1459c382
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-12-15 13:02:39 +08:00
Kai Köhne
6c10546a4b Enable warnings-are-errors for Visual Studio 2022
Change-Id: Id0b143f668f69481f6037f94aedbfd2e87331497
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-11-30 16:32:10 +01:00
Yuhang Zhao
405adf3348 Win32: Enable large address aware explicitly
Large address aware is enabled by default in 64-bit
compilers, but not 32-bit compilers. But Qt users
may build 32-bit Qt themself, in this case large
address aware is disabled in fact, and it may cause
some issues. So we pass /LARGEADDRESSAWARE to the
linker unconditionally to make sure large address
aware is enabled for both 32-bit and 64-bit builds.

Microsoft Docs:
https://docs.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses?view=msvc-170

Change-Id: Idb2603d9ba0ba9ef4477ce1c3174b7c7e8ba76f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-11-26 16:42:53 +08:00
Giuseppe D'Angelo
b6cbd9c43a QList: deprecate iterator<->pointer implicit conversions (2/3)
The constructor from a raw pointer should be
1) constexpr,
2) explicit, and
3) *private*.

We can do 1) without too much trouble.

2) is a (easy to fix) SIC in case of implicit conversions accidentally
relied upon from somewhere.

3) cannot be "easily" fixed by user code (they have to refactor), and
also, it's a BIC on Windows which encodes class members' access in
symbols. Someone may have been exporting some QList subclass, in turn
exporting the iterator classes, and therefore that someone now has the
constructors' symbols with a given access.

So, don't do 2+3 _just yet_ for user code, but set a deadline: Qt 6.5 is
the last that will support this. On Qt 6.6, we switch. All of this on
non-Windows, againt to avoid an ABI break. One can opt-in at any time
via a suitable define.

Given we have this define, use it to guard the other way around as well:
conversions from an iterator to a raw pointer should never be explicit
(there's std::to_address for this).

[ChangeLog][QtCore][QList] Converting a QList's iterator from and to a
raw pointer is deprecated, and will get removed in Qt 6.6. User code can
prepare for the change by defining QT_STRICT_QLIST_ITERATORS.

Change-Id: I0f34bfa3ac055c02af5a3ca159180304660dfc11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-16 13:48:27 +02:00
Thiago Macieira
cb0ea39895 CMake: remove support for building Qt with the old Intel compiler
This hasn't worked for some time. It's not in our CI and I don't think
it was working at all. When I tried to build it, I ran into several
problems with C++17 and an Internal Compiler Error I did not have any
interest in working around.

After discussing with the Intel compiler team, it was decided that
fixing those issues in the old compiler is not going to happen. Instead,
their recommendation is to adopt the new LLVM-based compiler, which
the last commit added support for.

This commit does not remove qmake support for the old ICC. It's possible
someone is using qmake with a non-Qt6 project and ICC.

Change-Id: Icb2516126f674e7b8bb3fffd16ad6350ddbd49e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 12:49:49 -07:00
Thiago Macieira
63d80c7c4b CMake: add support for Intel's LLVM-based compiler
This includes a few cleanups to our .cmake files where it was easier to
combine existing sections of Clang / AppleClang that no longer needed to
be distinct.

icpx could be replaced with a shell script:
 exec `basename $0`/clang++ --intel "$@"

tst_qnumeric is not passing
FAIL!  : tst_QNumeric::classifyF() Compared values are not the same
   Actual   (qFpClassify(tiny / two)): 2
   Expected (FP_SUBNORMAL)           : 3
   Loc: [/home/tjmaciei/src/qt/qt6-icx/qtbase/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp(344)]
FAIL!  : tst_QNumeric::classifyD() Compared values are not the same
   Actual   (qFpClassify(tiny / two)): 2
   Expected (FP_SUBNORMAL)           : 3
   Loc: [/home/tjmaciei/src/qt/qt6-icx/qtbase/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp(344)]
FAIL!  : tst_QNumeric::floatDistance(denormal) Compared values are not the same
   Actual   (qFloatDistance(from, stop)): 0
   Expected (expectedDistance)          : 4194304
   Loc: [/home/tjmaciei/src/qt/qt6-icx/qtbase/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp(408)]
FAIL!  : tst_QNumeric::doubleDistance(denormal) Compared values are not the same
   Actual   (qFloatDistance(from, stop)): 0
   Expected (expectedDistance)          : 2251799813685248
   Loc: [/home/tjmaciei/src/qt/qt6-icx/qtbase/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp(408)]
P

Change-Id: Icb2516126f674e7b8bb3fffd16ad59431e8c3379
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 12:49:49 -07:00
Giuseppe D'Angelo
49cf0b9459 Re-enable QT_NO_NARROWING_CONVERSIONS_IN_CONNECT for Qt
This define used to be set for the entirety of the Qt build but
was lost during the qmake->CMake transition. Re-enable it.

Change-Id: Idc4cb6ada485158559485b60f62f76439550b255
Pick-to: 6.2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-13 04:09:21 +02:00
Lorn Potter
0e100a4d89 wasm: add simd support
Emscripten only supports
SSE1, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and 128-bit AVX instruction
sets at this time.
https://emscripten.org/docs/porting/simd.html

Browsers might need to enable simd support in the advanced
configurations
about: config or chrome:flags

Enable by configuring Qt with -sse2

Pick-to: 6.2
Fixes: QTBUG-63924
Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-05 11:30:06 +10:00
Joerg Bornemann
6e48d654d7 Don't force lld for Android when clang is used
This reverts commit 64c111e10f.

The claim of the commit message, that we cannot use the gold linker,
does not seem to be true (anymore?).  This is underlined by the fact
that CMake *forces* the gold linker for Android, whenever LTCG is
enabled (see Modules/Compiler/Clang.cmake as of CMake 3.21.1).

Change-Id: I90edac8555be4abdd44cd367228aeffb0d66b895
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-20 17:19:20 +02:00
Alexandru Croitor
3595613a0a CMake: Don't propagate -fapplication-extension to user projects
Both the compiler and linker -fapplication-extension flag should only
be applied when building Qt's libraries (not executables).

It's up to the user project whether their code will be restricted with
application-extension-only APIs.

In qmake that can be achieved by adding to the qmake project
  CONFIG += app_extension_api_only

In CMake it can be achieved by either adding the compiler and link flags
in the project directly (using target_X_options) or by setting the
appropriate setting in the Xcode project when using the Xcode
generator.

Amends e189126f1a

Pick-to: 6.2
Task-number: QTBUG-95199
Change-Id: Ie7a764d460a89c7650391abff0fcc5abfcabef64
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-16 09:52:24 +02:00
Alexandru Croitor
616c32be04 CMake: Fix bitcode linker flags not to be added on iOS
We shouldn't force add the bitcode linker flags to user projects.
And we don't link anything when building Qt for iOS itself, we only
archive object files into static libraries.

The final decision whether bitcode should be used is up to the Xcode
project. That is controlled by Xcode's ENABLE_BITCODE option.

Bitcode compile flags are still added when building Qt itself.

Amends a046833176

Pick-to: 6.1 6.2
Task-number: QTBUG-95199
Change-Id: I04c77f659b82269bb8010ea262b2e51f36e9def3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-16 09:52:21 +02:00
Andreas Buhr
3818046204 fix warning in cborparser with gcc 11.1
Pick-to: 6.2
Change-Id: Ie8270f2b156b194dedd115a97b93f7f800af055e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-07 22:07:13 +02:00
Kai Köhne
d0676874d6 MSVC: Enable warnings-are-errors for latest Visual Studio 2019
Also remove handling of older versions, because we only support
Visual Studio 2019 currently

Pick-to: 6.2
Change-Id: If66a46d970047fe25582e323df74e0a904ee92da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
648e9696d3 Disable -Werror=stringop-overflow on GCC >= 10
There's a number of upstream bugs that cause false positives;
do not make them errors.

Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 00:23:55 +02:00