summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qatomic.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-09-20 15:37:09 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2022-09-28 01:23:31 +0200
commit77646f668da94ebc7afa683527181c5e3ba3c8b0 (patch)
treee74c39091a58342dbb0083cbe8ee855a295b45cf /src/corelib/thread/qatomic.h
parentc5b816393d1ea88f047ae05568786d54b5bd5f56 (diff)
Q(Basic)Atomic: remove QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
The define has always been set, so we can simplify all the code that checked for it. Change-Id: I9133ba95dbd6e1da465ade1d1306310bd3fb9a45 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/thread/qatomic.h')
-rw-r--r--src/corelib/thread/qatomic.h32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index b11e3f1bdf..e0e9ca947c 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -14,29 +14,16 @@ QT_BEGIN_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wextra")
-#ifdef Q_CLANG_QDOC
-# undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
-#endif
-
// High-level atomic integer operations
template <typename T>
class QAtomicInteger : public QBasicAtomicInteger<T>
{
public:
// Non-atomic API
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
constexpr QAtomicInteger(T value = 0) noexcept : QBasicAtomicInteger<T>(value) {}
-#else
- inline QAtomicInteger(T value = 0) noexcept
- {
- this->_q_value = value;
- }
-#endif
inline QAtomicInteger(const QAtomicInteger &other) noexcept
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
: QBasicAtomicInteger<T>()
-#endif
{
this->storeRelease(other.loadAcquire());
}
@@ -129,10 +116,7 @@ public:
// Non-atomic API
// We could use QT_COMPILER_INHERITING_CONSTRUCTORS, but we need only one;
// the implicit definition for all the others is fine.
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
- constexpr
-#endif
- QAtomicInt(int value = 0) noexcept : QAtomicInteger<int>(value) {}
+ constexpr QAtomicInt(int value = 0) noexcept : QAtomicInteger<int>(value) {}
};
// High-level atomic pointer operations
@@ -140,18 +124,10 @@ template <typename T>
class QAtomicPointer : public QBasicAtomicPointer<T>
{
public:
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
constexpr QAtomicPointer(T *value = nullptr) noexcept : QBasicAtomicPointer<T>(value) {}
-#else
- inline QAtomicPointer(T *value = nullptr) noexcept
- {
- this->storeRelaxed(value);
- }
-#endif
+
inline QAtomicPointer(const QAtomicPointer<T> &other) noexcept
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
: QBasicAtomicPointer<T>()
-#endif
{
this->storeRelease(other.loadAcquire());
}
@@ -196,10 +172,6 @@ public:
QT_WARNING_POP
-#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
-# undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
-#endif
-
/*!
This is a helper for the assignment operators of implicitly
shared classes. Your assignment operator should look like this: