diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-31 17:19:06 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-03-26 17:15:02 +0100 |
commit | 80b6bcc385863a38d499685af9b8e857e46cbdba (patch) | |
tree | 252b745a2b8dd617224f49cf89139cd5baef317c /src/corelib/animation | |
parent | edb64351cd0896d27af15d54d5fa868c7567eced (diff) |
Short live Q_CONSTINIT!
It expands to the first available of
- constinit (C++20)
- [[clang::require_constant_initialization]] (Clang)
- __constinit (GCC >= 10)
Use it around the code (on and near static QBasicAtomic; this patch
makes no attempt to find all statics in qtbase).
[ChangeLog][QtCore][QtGlobal] Added macro Q_CONSTINIT.
Fixes: QTBUG-100484
Change-Id: I11e0363a7acb3464476859d12ec7f94319d82be7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/animation')
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 2 | ||||
-rw-r--r-- | src/corelib/animation/qvariantanimation.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index e375305f9f..87151161ac 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -289,7 +289,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, QPropertyAnimation *animToStop = nullptr; { - static QBasicMutex mutex; + Q_CONSTINIT static QBasicMutex mutex; auto locker = qt_unique_lock(mutex); typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 026db981ea..ca13506aa5 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -404,7 +404,7 @@ QBindable<QEasingCurve> QVariantAnimation::bindableEasingCurve() typedef QList<QVariantAnimation::Interpolator> QInterpolatorVector; Q_GLOBAL_STATIC(QInterpolatorVector, registeredInterpolators) -static QBasicMutex registeredInterpolatorsMutex; +Q_CONSTINIT static QBasicMutex registeredInterpolatorsMutex; /*! \fn template <typename T> void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) |