diff options
-rw-r--r-- | src/corelib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/corelib/thread/qatomic_bootstrap.h | 69 | ||||
-rw-r--r-- | src/corelib/thread/qatomic_cxx11.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qbasicatomic.h | 14 |
4 files changed, 2 insertions, 84 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 49d84251ad..fa9757559a 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -226,7 +226,6 @@ qt_internal_add_module(Core text/qutf8stringview.h text/qvsnprintf.cpp thread/qatomic.h - thread/qatomic_bootstrap.h thread/qatomic_cxx11.h thread/qbasicatomic.h thread/qgenericatomic.h diff --git a/src/corelib/thread/qatomic_bootstrap.h b/src/corelib/thread/qatomic_bootstrap.h deleted file mode 100644 index 313fe9ed32..0000000000 --- a/src/corelib/thread/qatomic_bootstrap.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// Copyright (C) 2011 Thiago Macieira <thiago@kde.org> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef QATOMIC_BOOTSTRAP_H -#define QATOMIC_BOOTSTRAP_H - -#include <QtCore/qgenericatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT8_IS_SUPPORTED -template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; }; -#define Q_ATOMIC_INT16_IS_SUPPORTED -template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; }; -#define Q_ATOMIC_INT32_IS_SUPPORTED -#define Q_ATOMIC_INT64_IS_SUPPORTED -template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; }; - -template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> > -{ - typedef T Type; - - static bool ref(T &_q_value) noexcept - { - return ++_q_value != 0; - } - static bool deref(T &_q_value) noexcept - { - return --_q_value != 0; - } - - static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept - { - if (currentValue) - *currentValue = _q_value; - if (_q_value == expectedValue) { - _q_value = newValue; - return true; - } - return false; - } - - static T fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept - { - T tmp = _q_value; - _q_value = newValue; - return tmp; - } - - template <typename AdditiveType> static - T fetchAndAddRelaxed(T &_q_value, AdditiveType valueToAdd) noexcept - { - T returnValue = _q_value; - _q_value += valueToAdd; - return returnValue; - } -}; - -QT_END_NAMESPACE - -#endif // QATOMIC_BOOTSTRAP_H diff --git a/src/corelib/thread/qatomic_cxx11.h b/src/corelib/thread/qatomic_cxx11.h index cf794d3f3b..4f55a53ae3 100644 --- a/src/corelib/thread/qatomic_cxx11.h +++ b/src/corelib/thread/qatomic_cxx11.h @@ -149,7 +149,7 @@ template <> inline bool QAtomicTraits<2>::isLockFree() { return false; } #endif -#if QT_CONFIG(std_atomic64) +#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(std_atomic64) template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; }; # define Q_ATOMIC_INT64_IS_SUPPORTED # if ATOMIC_LLONG_LOCK_FREE == 2 diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 714ffc55af..6a33a1fb26 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -7,19 +7,7 @@ #ifndef QBASICATOMIC_H #define QBASICATOMIC_H -#if defined(QT_BOOTSTRAPPED) -# include <QtCore/qatomic_bootstrap.h> - -// If C++11 atomics are supported, use them! -// Note that constexpr support is sometimes disabled in QNX or INTEGRITY builds, -// but their libraries have <atomic>. -#elif defined(Q_COMPILER_ATOMICS) -# include <QtCore/qatomic_cxx11.h> - -// No fallback -#else -# error "Qt requires C++11 support" -#endif +#include <QtCore/qatomic_cxx11.h> QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4522) |