Apply Q_CONSTINIT where beneficial
Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
44a1782a9b
commit
711105058a
@ -442,7 +442,7 @@ QJniObject QAndroidServiceConnection::handle() const
|
||||
*/
|
||||
|
||||
|
||||
static QBasicAtomicInteger<uint> nextUniqueActivityRequestCode = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInteger<uint> nextUniqueActivityRequestCode = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
// Get a unique activity request code.
|
||||
static int uniqueActivityRequestCode()
|
||||
@ -1016,11 +1016,11 @@ QtAndroidPrivate::PermissionResult resultFromAndroid(jint value)
|
||||
using PendingPermissionRequestsHash
|
||||
= QHash<int, QSharedPointer<QPromise<QtAndroidPrivate::PermissionResult>>>;
|
||||
Q_GLOBAL_STATIC(PendingPermissionRequestsHash, g_pendingPermissionRequests);
|
||||
static QBasicMutex g_pendingPermissionRequestsMutex;
|
||||
Q_CONSTINIT static QBasicMutex g_pendingPermissionRequestsMutex;
|
||||
|
||||
static int nextRequestCode()
|
||||
{
|
||||
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return counter.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ static const char qtNativeClassName[] = "org/qtproject/qt/android/QtNative";
|
||||
typedef std::pair<std::function<QVariant()>, QSharedPointer<QPromise<QVariant>>> RunnablePair;
|
||||
typedef std::deque<RunnablePair> PendingRunnables;
|
||||
Q_GLOBAL_STATIC(PendingRunnables, g_pendingRunnables);
|
||||
static QBasicMutex g_pendingRunnablesMutex;
|
||||
Q_CONSTINIT static QBasicMutex g_pendingRunnablesMutex;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
|
@ -954,7 +954,7 @@ struct PcreJitStackFree
|
||||
pcre2_jit_stack_free_16(stack);
|
||||
}
|
||||
};
|
||||
static thread_local std::unique_ptr<pcre2_jit_stack_16, PcreJitStackFree> jitStacks;
|
||||
Q_CONSTINIT static thread_local std::unique_ptr<pcre2_jit_stack_16, PcreJitStackFree> jitStacks;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -31,7 +31,7 @@ void qt_create_tls()
|
||||
{
|
||||
if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
|
||||
return;
|
||||
static QBasicMutex mutex;
|
||||
Q_CONSTINIT static QBasicMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
|
||||
return;
|
||||
@ -101,7 +101,7 @@ void QAdoptedThread::init()
|
||||
|
||||
static QList<HANDLE> qt_adopted_thread_handles;
|
||||
static QList<QThread *> qt_adopted_qthreads;
|
||||
static QBasicMutex qt_adopted_thread_watcher_mutex;
|
||||
Q_CONSTINIT static QBasicMutex qt_adopted_thread_watcher_mutex;
|
||||
static DWORD qt_adopted_thread_watcher_id = 0;
|
||||
static HANDLE qt_adopted_thread_wakeup = 0;
|
||||
|
||||
|
@ -50,7 +50,7 @@ QT_IMPL_METATYPE_EXTERN(QDBusSlotCache)
|
||||
// used with dbus_server_allocate_data_slot
|
||||
static dbus_int32_t server_slot = -1;
|
||||
|
||||
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
|
||||
Q_CONSTINIT static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
|
||||
#define qDBusDebug if (::isDebugging.loadRelaxed() == 0); else qDebug
|
||||
|
||||
static inline QDebug operator<<(QDebug dbg, const QThread *th)
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
void QDBusMetaTypeId::init()
|
||||
{
|
||||
static QBasicAtomicInt initialized = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
Q_CONSTINIT static QBasicAtomicInt initialized = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
|
||||
// reentrancy is not a problem since everything else is locked on their own
|
||||
// set the guard variable at the end
|
||||
|
@ -67,7 +67,7 @@ using namespace Qt::StringLiterals;
|
||||
|
||||
static int nextSerialNumCounter()
|
||||
{
|
||||
static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return 1 + serial.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ static QImage rotated270(const QImage &src);
|
||||
|
||||
static int next_qimage_serial_number()
|
||||
{
|
||||
static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return 1 + serial.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ QT_BEGIN_NAMESPACE
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
Q_CONSTINIT static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
|
||||
{
|
||||
fetchedRoot.storeRelaxed(false);
|
||||
|
@ -42,7 +42,7 @@ static QOpenGLContext *global_share_context = nullptr;
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker;
|
||||
QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
|
||||
Q_CONSTINIT QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
|
@ -26,12 +26,12 @@ using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices")
|
||||
|
||||
QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
|
||||
Q_CONSTINIT QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
|
||||
bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;
|
||||
bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;
|
||||
QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed;
|
||||
QMutex QWindowSystemInterfacePrivate::flushEventMutex;
|
||||
QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
|
||||
Q_CONSTINIT QMutex QWindowSystemInterfacePrivate::flushEventMutex;
|
||||
Q_CONSTINIT QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
|
||||
QWindowSystemEventHandler *QWindowSystemInterfacePrivate::eventHandler;
|
||||
QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePrivate::windowSystemEventQueue;
|
||||
|
||||
|
@ -20,7 +20,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_CONSTINIT QBasicMutex QColorSpacePrivate::s_lutWriteLock;
|
||||
|
||||
static QAtomicPointer<QColorSpacePrivate> s_predefinedColorspacePrivates[QColorSpace::ProPhotoRgb] = {};
|
||||
Q_CONSTINIT static QAtomicPointer<QColorSpacePrivate> s_predefinedColorspacePrivates[QColorSpace::ProPhotoRgb] = {};
|
||||
static void cleanupPredefinedColorspaces()
|
||||
{
|
||||
for (QAtomicPointer<QColorSpacePrivate> &ptr : s_predefinedColorspacePrivates) {
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
QString userDescription;
|
||||
QByteArray iccProfile;
|
||||
|
||||
static QBasicMutex s_lutWriteLock;
|
||||
Q_CONSTINIT static QBasicMutex s_lutWriteLock;
|
||||
struct LUT {
|
||||
LUT() = default;
|
||||
~LUT() = default;
|
||||
|
@ -364,7 +364,7 @@ QChar QAppleKeyMapper::toCocoaKey(Qt::Key key)
|
||||
if (key == Qt::Key_Backspace)
|
||||
return QChar(NSBackspaceCharacter);
|
||||
|
||||
static QHash<Qt::Key, char16_t> reverseCocoaKeys;
|
||||
Q_CONSTINIT static QHash<Qt::Key, char16_t> reverseCocoaKeys;
|
||||
if (reverseCocoaKeys.isEmpty()) {
|
||||
reverseCocoaKeys.reserve(cocoaKeys.size());
|
||||
for (auto it = cocoaKeys.begin(); it != cocoaKeys.end(); ++it)
|
||||
|
@ -7638,7 +7638,7 @@ int QRhi::ubufAlignment() const
|
||||
return d->ubufAlignment();
|
||||
}
|
||||
|
||||
static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
QRhiGlobalObjectIdGenerator::Type QRhiGlobalObjectIdGenerator::newId()
|
||||
{
|
||||
|
@ -2828,7 +2828,7 @@ void QFontCache::cleanup()
|
||||
cache->setLocalData(nullptr);
|
||||
}
|
||||
|
||||
static QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
QFontCache::QFontCache()
|
||||
: QObject(), total_cost(0), max_cost(min_cost),
|
||||
|
@ -1712,7 +1712,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
|
||||
Q_CONSTINIT const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
|
||||
|
||||
inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
|
||||
{
|
||||
@ -2507,7 +2507,7 @@ void QTextLine::draw_internal(QPainter *p, const QPointF &origPos,
|
||||
return;
|
||||
}
|
||||
|
||||
static QRectF maxFixedRect(-QFIXED_MAX / 2, -QFIXED_MAX / 2, QFIXED_MAX, QFIXED_MAX);
|
||||
Q_CONSTINIT static QRectF maxFixedRect(-QFIXED_MAX / 2, -QFIXED_MAX / 2, QFIXED_MAX, QFIXED_MAX);
|
||||
const bool xlateToFixedRange = !maxFixedRect.contains(origPos);
|
||||
QPointF pos;
|
||||
if (Q_LIKELY(!xlateToFixedRange))
|
||||
|
@ -37,7 +37,7 @@ quint32 QAstcHandler::astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const
|
||||
static const quint32 glFormatRGBABase = 0x93B0; // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
|
||||
static const quint32 glFormatSRGBBase = 0x93D0; // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
|
||||
|
||||
static QSize dims[14] = {
|
||||
Q_CONSTINIT static QSize dims[14] = {
|
||||
{ 4, 4 }, // GL_COMPRESSED_xxx_ASTC_4x4_KHR
|
||||
{ 5, 4 }, // GL_COMPRESSED_xxx_ASTC_5x4_KHR
|
||||
{ 5, 5 }, // GL_COMPRESSED_xxx_ASTC_5x5_KHR
|
||||
|
@ -10,7 +10,7 @@ QT_BEGIN_NAMESPACE
|
||||
Q_LOGGING_CATEGORY(lcGuiVk, "qt.vulkan")
|
||||
|
||||
static QVulkanInstance *s_vulkanInstance;
|
||||
static QVulkanDefaultInstance::Flags s_vulkanInstanceFlags;
|
||||
Q_CONSTINIT static QVulkanDefaultInstance::Flags s_vulkanInstanceFlags;
|
||||
|
||||
QVulkanDefaultInstance::Flags QVulkanDefaultInstance::flags()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
static QBasicAtomicInt valid;
|
||||
};
|
||||
Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData)
|
||||
QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
class QNetworkAccessBackendPrivate : public QObjectPrivate
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ bool QHostInfoResult::event(QEvent *event)
|
||||
|
||||
static int nextId()
|
||||
{
|
||||
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return 1 + counter.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
static int next_qopengltextureglyphcache_serial_number()
|
||||
{
|
||||
static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return 1 + serial.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
QFbWindow::QFbWindow(QWindow *window)
|
||||
: QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState)
|
||||
|
@ -69,7 +69,7 @@ static sem_t m_exitSemaphore, m_terminateSemaphore;
|
||||
|
||||
QHash<int, AndroidSurfaceClient *> m_surfaces;
|
||||
|
||||
static QBasicMutex m_surfacesMutex;
|
||||
Q_CONSTINIT static QBasicMutex m_surfacesMutex;
|
||||
|
||||
|
||||
static QAndroidPlatformIntegration *m_androidPlatformIntegration = nullptr;
|
||||
@ -88,7 +88,7 @@ static const char m_qtTag[] = "Qt";
|
||||
static const char m_classErrorMsg[] = "Can't find class \"%s\"";
|
||||
static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
|
||||
|
||||
static QBasicAtomicInt startQtAndroidPluginCalled = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt startQtAndroidPluginCalled = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
namespace QtAndroid
|
||||
{
|
||||
|
@ -24,12 +24,12 @@ namespace QtAndroidMenu
|
||||
{
|
||||
static QList<QAndroidPlatformMenu *> pendingContextMenus;
|
||||
static QAndroidPlatformMenu *visibleMenu = nullptr;
|
||||
static QRecursiveMutex visibleMenuMutex;
|
||||
Q_CONSTINIT static QRecursiveMutex visibleMenuMutex;
|
||||
|
||||
static QSet<QAndroidPlatformMenuBar *> menuBars;
|
||||
static QAndroidPlatformMenuBar *visibleMenuBar = nullptr;
|
||||
static QWindow *activeTopLevelWindow = nullptr;
|
||||
static QRecursiveMutex menuBarMutex;
|
||||
Q_CONSTINIT static QRecursiveMutex menuBarMutex;
|
||||
|
||||
static jmethodID openContextMenuMethodID = 0;
|
||||
|
||||
|
@ -161,7 +161,7 @@ private:
|
||||
};
|
||||
|
||||
QCache<QString, QSharedPointer<FolderIterator>> FolderIterator::m_assetsCache(std::max(50, qEnvironmentVariableIntValue("QT_ANDROID_MAX_ASSETS_CACHE_SIZE")));
|
||||
QMutex FolderIterator::m_assetsCacheMutex;
|
||||
Q_CONSTINIT QMutex FolderIterator::m_assetsCacheMutex;
|
||||
|
||||
class AndroidAbstractFileEngineIterator: public QAbstractFileEngineIterator
|
||||
{
|
||||
@ -379,7 +379,7 @@ private:
|
||||
};
|
||||
|
||||
QCache<QString, QSharedPointer<AssetItem>> AndroidAbstractFileEngine::m_assetsInfoCache(std::max(200, qEnvironmentVariableIntValue("QT_ANDROID_MAX_FILEINFO_ASSETS_CACHE_SIZE")));
|
||||
QMutex AndroidAbstractFileEngine::m_assetsInfoCacheMutex;
|
||||
Q_CONSTINIT QMutex AndroidAbstractFileEngine::m_assetsInfoCacheMutex;
|
||||
|
||||
AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler()
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ bool QAndroidEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags
|
||||
|
||||
QAndroidEventDispatcherStopper *QAndroidEventDispatcherStopper::instance()
|
||||
{
|
||||
static QAndroidEventDispatcherStopper androidEventDispatcherStopper;
|
||||
Q_CONSTINIT static QAndroidEventDispatcherStopper androidEventDispatcherStopper;
|
||||
return &androidEventDispatcherStopper;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QSize QAndroidPlatformIntegration::m_defaultScreenSize = QSize(320, 455);
|
||||
QRect QAndroidPlatformIntegration::m_defaultAvailableGeometry = QRect(0, 0, 320, 455);
|
||||
QSize QAndroidPlatformIntegration::m_defaultPhysicalSize = QSize(50, 71);
|
||||
Q_CONSTINIT QSize QAndroidPlatformIntegration::m_defaultScreenSize = QSize(320, 455);
|
||||
Q_CONSTINIT QRect QAndroidPlatformIntegration::m_defaultAvailableGeometry = QRect(0, 0, 320, 455);
|
||||
Q_CONSTINIT QSize QAndroidPlatformIntegration::m_defaultPhysicalSize = QSize(50, 71);
|
||||
|
||||
Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOrientation;
|
||||
Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
|
||||
: QPlatformWindow(window)
|
||||
|
@ -417,7 +417,7 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
|
||||
// NSOpenGLContext is not re-entrant. Even when using separate contexts per thread,
|
||||
// view, and window, calls into the API will still deadlock. For more information
|
||||
// see https://openradar.appspot.com/37064579
|
||||
static QMutex s_reentrancyMutex;
|
||||
Q_CONSTINIT static QMutex s_reentrancyMutex;
|
||||
|
||||
void QCocoaGLContext::update()
|
||||
{
|
||||
|
@ -12,10 +12,10 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;
|
||||
QHash<quint64, QPointingDevice*> QCocoaTouch::_touchDevices;
|
||||
QPointF QCocoaTouch::_screenReferencePos;
|
||||
QPointF QCocoaTouch::_trackpadReferencePos;
|
||||
Q_CONSTINIT QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;
|
||||
Q_CONSTINIT QHash<quint64, QPointingDevice*> QCocoaTouch::_touchDevices;
|
||||
Q_CONSTINIT QPointF QCocoaTouch::_screenReferencePos;
|
||||
Q_CONSTINIT QPointF QCocoaTouch::_trackpadReferencePos;
|
||||
int QCocoaTouch::_idAssignmentCount = 0;
|
||||
int QCocoaTouch::_touchCount = 0;
|
||||
bool QCocoaTouch::_updateInternalStateOnly = true;
|
||||
|
@ -93,7 +93,7 @@ EGLNativeWindowType QEglFSEmulatorIntegration::createNativeWindow(QPlatformWindo
|
||||
// Let the emulator know which screen the window surface is attached to
|
||||
setDisplay(screen->id());
|
||||
}
|
||||
static QBasicAtomicInt uniqueWindowId = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt uniqueWindowId = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
return EGLNativeWindowType(qintptr(1 + uniqueWindowId.fetchAndAddRelaxed(1)));
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ private:
|
||||
QEglFSX11Integration *m_integration;
|
||||
};
|
||||
|
||||
static QBasicAtomicInt running;
|
||||
Q_CONSTINIT static QBasicAtomicInt running;
|
||||
|
||||
void EventReader::run()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ class QIOSFileEngineFactory : public QAbstractFileEngineHandler
|
||||
public:
|
||||
QAbstractFileEngine* create(const QString &fileName) const
|
||||
{
|
||||
static QLatin1StringView assetsScheme("assets-library:");
|
||||
Q_CONSTINIT static QLatin1StringView assetsScheme("assets-library:");
|
||||
|
||||
#ifndef Q_OS_TVOS
|
||||
if (fileName.toLower().startsWith(assetsScheme))
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
bool m_frameMarginsRequested;
|
||||
WId m_winId;
|
||||
|
||||
static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash;
|
||||
Q_CONSTINIT static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -123,7 +123,7 @@ Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
|
||||
return result;
|
||||
}
|
||||
|
||||
static QPoint lastMouseMovePos;
|
||||
Q_CONSTINIT static QPoint lastMouseMovePos;
|
||||
|
||||
namespace {
|
||||
struct MouseEvent {
|
||||
|
@ -774,7 +774,7 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window,
|
||||
// X11 and macOS.
|
||||
bool discardEvent = false;
|
||||
if (msg.message == WM_MOUSEMOVE) {
|
||||
static QPoint lastMouseMovePos;
|
||||
Q_CONSTINIT static QPoint lastMouseMovePos;
|
||||
if (msg.wParam == 0 && (m_windowUnderPointer.isNull() || globalPos == lastMouseMovePos))
|
||||
discardEvent = true;
|
||||
lastMouseMovePos = globalPos;
|
||||
|
@ -980,7 +980,7 @@ QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon
|
||||
QComHelper comHelper;
|
||||
|
||||
static QCache<QString, FakePointer<int> > dirIconEntryCache(1000);
|
||||
static QMutex mx;
|
||||
Q_CONSTINIT static QMutex mx;
|
||||
static int defaultFolderIIcon = -1;
|
||||
const bool useDefaultFolderIcon = options() & QPlatformTheme::DontUseCustomDirectoryIcons;
|
||||
|
||||
|
@ -835,7 +835,7 @@ static QString qCreateParamString(const QList<QVariant> &boundValues, const QSql
|
||||
|
||||
QString qMakePreparedStmtId()
|
||||
{
|
||||
static QBasicAtomicInt qPreparedStmtCount = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
Q_CONSTINIT static QBasicAtomicInt qPreparedStmtCount = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
QString id = QStringLiteral("qpsqlpstmt_") + QString::number(qPreparedStmtCount.fetchAndAddRelaxed(1) + 1, 16);
|
||||
return id;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ HRGN XPThemeData::mask(QWidget *widget)
|
||||
HWND QWindowsXPStylePrivate::m_vistaTreeViewHelper = nullptr;
|
||||
HTHEME QWindowsXPStylePrivate::m_themes[NThemes];
|
||||
bool QWindowsXPStylePrivate::use_xp = false;
|
||||
QBasicAtomicInt QWindowsXPStylePrivate::ref = Q_BASIC_ATOMIC_INITIALIZER(-1); // -1 based refcounting
|
||||
Q_CONSTINIT QBasicAtomicInt QWindowsXPStylePrivate::ref = Q_BASIC_ATOMIC_INITIALIZER(-1); // -1 based refcounting
|
||||
|
||||
static void qt_add_rect(HRGN &winRegion, QRect r)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ QJUnitTestLogger::~QJUnitTestLogger()
|
||||
|
||||
// We track test timing per test case, so we
|
||||
// need to maintain our own elapsed timer.
|
||||
static QElapsedTimer elapsedTestcaseTime;
|
||||
Q_CONSTINIT static QElapsedTimer elapsedTestcaseTime;
|
||||
static qreal elapsedTestCaseSeconds()
|
||||
{
|
||||
return elapsedTestcaseTime.nsecsElapsed() / 1e9;
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
|
||||
inline static QTestEventLoop &instance()
|
||||
{
|
||||
static QPointer<QTestEventLoop> testLoop;
|
||||
Q_CONSTINIT static QPointer<QTestEventLoop> testLoop;
|
||||
if (testLoop.isNull())
|
||||
testLoop = new QTestEventLoop(QCoreApplication::instance());
|
||||
return *static_cast<QTestEventLoop *>(testLoop);
|
||||
|
@ -67,8 +67,8 @@ static void saveCoverageTool(const char * appname, bool testfailed, bool install
|
||||
#endif
|
||||
}
|
||||
|
||||
static QElapsedTimer elapsedFunctionTime;
|
||||
static QElapsedTimer elapsedTotalTime;
|
||||
Q_CONSTINIT static QElapsedTimer elapsedFunctionTime;
|
||||
Q_CONSTINIT static QElapsedTimer elapsedTotalTime;
|
||||
|
||||
#define FOREACH_TEST_LOGGER for (const auto &logger : qAsConst(*QTest::loggers()))
|
||||
|
||||
|
@ -363,7 +363,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
|
||||
{
|
||||
Q_UNUSED(watched);
|
||||
|
||||
static QElapsedTimer monotonicTimer;
|
||||
Q_CONSTINIT static QElapsedTimer monotonicTimer;
|
||||
if (!monotonicTimer.isValid())
|
||||
monotonicTimer.start();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user