Go to file
Giuseppe D'Angelo 6a93ec2435 QAtomic: remove the copy ctor and assignment operator
These special member functions have no purpose.

We never *documented* their semantics. Any code using them is
unconditionally wrong (which semantics was it assuming?), so we can
accept the SIC (type A). If a user needs such a copy, they would have to
reason on the intended semantics (relaxed? acquire/release?) and be
explicit in their code. Especially for assignment, they would need
understand the consequences of the memory ordering that apply on _each_
atomic object involved and not on the assignment operation as a whole
(there are no such semantics).

Testing this change on qtbase has already found bugs.

From a purely technical point of view: we don't guarantee lock-free
atomics nor we require them from the underlying platform. An atomic is
therefore allowed to be implemented as a mutex protecting a value, and
mutexes are not copiable. std::atomic follows the exactly same pattern
(not copiable nor copy-assignable) for exactly the same reasons, and Qt
atomics are implemented on top of std:: ones.

[ChangeLog][QtCore] The copy constructor and assignment operators of
Qt atomic classes (QAtomicInteger, QAtomicPointer) have been removed.
Their usage in user code should be considered a programming error, as no
memory ordering semantics were ever documented for these operations (and
therefore relying on any specific semantic would be relying on
undocumented, unportable behavior). This matches the API of the
std::atomic class in C++. Note that you can still use explicit
load/store operations to transfer a value across two Qt atomic objects,
and therefore use the memory ordering specified for the load/store
operations.

Change-Id: Iab653bad761afb8b3e3b6a967ece7b28713aa944
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:47:47 +02:00
.github/workflows Repair github action workflow 2021-11-10 18:57:33 +01:00
bin Add simple project generation based on existing source files 2023-02-08 12:59:19 +01:00
cmake Suppress "duplicate libraries" warning for Xcode 15 2023-10-24 22:10:43 +02:00
coin Keep the testrun quiet for ASAN testruns 2023-10-19 19:09:01 +02:00
config.tests Remove the mandatory x86-64 features from its feature list 2023-05-31 14:55:37 -07:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Rename the JSON Save Game Example to Saving a Game to File 2023-10-20 11:19:48 +02:00
examples standarddialogs: Don't assume QMessageBox::exec() returns clicked role 2023-10-24 22:30:03 +02:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec CMake: Add a config.redo script similar to qt5's config.status 2023-09-20 21:20:13 +02:00
LICENSES Clarify license of SHA-1 algorithm 2023-04-26 16:36:18 +02:00
mkspecs QMake: Make 'entrypoint' and 'qt' CONFIG values order-independent 2023-09-29 17:22:28 +02:00
qmake clang-cl: remove unneeded workaround 2023-10-08 12:57:49 +08:00
src QAtomic: remove the copy ctor and assignment operator 2023-10-25 04:47:47 +02:00
tests QAtomic: remove the copy ctor and assignment operator 2023-10-25 04:47:47 +02:00
util sanitizer-testrunner.py: be verbose about FAILs being ignored 2023-10-18 18:20:14 +02:00
.cmake.conf CMake: Require CMake 3.21 when building/using Qt on Apple platforms 2023-06-28 22:09:20 +02:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore Add CMakeUserPresets.json to .gitignore 2023-06-23 12:13:08 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt CMake: Fix find_package(Qt6*Tools) in non-qtbase tests 2023-08-23 16:21:58 +02:00
config_help.txt Add coverage and coverage-gcov features 2023-09-22 15:54:30 +02:00
configure CMake: Add a config.redo script similar to qt5's config.status 2023-09-20 21:20:13 +02:00
configure.bat CMake: Add a config.redo script similar to qt5's config.status 2023-09-20 21:20:13 +02:00
configure.cmake Add coverage and coverage-gcov features 2023-09-22 15:54:30 +02:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
qt_cmdline.cmake Add coverage and coverage-gcov features 2023-09-22 15:54:30 +02:00