diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-04-21 15:03:48 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-04-22 15:27:43 +0200 |
commit | 396190686c4d1162953badf90f9aab9992bd1e76 (patch) | |
tree | 9f731524b706fdee3fc15036d91844756f518a23 | |
parent | 48561178e2488e6fe7763c2229d66072810afcb3 (diff) | |
download | qtbase-396190686c4d1162953badf90f9aab9992bd1e76.tar.gz |
Exploit the new macro varargs form of Q_GLOBAL_STATIC
Convert various uses of Q_GLOBAL_STATIC_WITH_ARGS() to the less
verbose form the recent reworking makes possible.
Change-Id: I57820660b5d00d39bf54b5a08cb921ebaec57c7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/io/qabstractfileengine.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qloggingcategory.cpp | 6 | ||||
-rw-r--r-- | src/corelib/io/qstorageinfo.cpp | 5 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qjnihelpers.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qlocale.cpp | 4 | ||||
-rw-r--r-- | src/corelib/time/qtimezoneprivate_tz.cpp | 4 |
7 files changed, 16 insertions, 17 deletions
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index d4dbfff25c..3bb13b9dae 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -107,7 +107,7 @@ Q_CONSTINIT static QBasicAtomicInt qt_file_engine_handlers_in_use = Q_BASIC_ATOM All application-wide handlers are stored in this list. The mutex must be acquired to ensure thread safety. */ -Q_GLOBAL_STATIC_WITH_ARGS(QReadWriteLock, fileEngineHandlerMutex, (QReadWriteLock::Recursive)) +Q_GLOBAL_STATIC(QReadWriteLock, fileEngineHandlerMutex, QReadWriteLock::Recursive) Q_CONSTINIT static bool qt_abstractfileenginehandlerlist_shutDown = false; class QAbstractFileEngineHandlerList : public QList<QAbstractFileEngineHandler *> { diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 9d08a2cdac..2c8da7f9aa 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -43,9 +43,7 @@ QT_BEGIN_NAMESPACE const char qtDefaultCategoryName[] = "default"; - -Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, - (qtDefaultCategoryName)) +Q_GLOBAL_STATIC(QLoggingCategory, qtDefaultCategory, qtDefaultCategoryName) #ifndef Q_ATOMIC_INT8_IS_SUPPORTED static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp index 41abce8d84..925a6da1f0 100644 --- a/src/corelib/io/qstorageinfo.cpp +++ b/src/corelib/io/qstorageinfo.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com> +** Copyright (C) 2022 The Qt Company Ltd. +** Copyright (C) 2015 Ivan Komissarov <ABBAPOH@gmail.com> ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -399,7 +400,7 @@ QList<QStorageInfo> QStorageInfo::mountedVolumes() return QStorageInfoPrivate::mountedVolumes(); } -Q_GLOBAL_STATIC_WITH_ARGS(QStorageInfo, getRoot, (QStorageInfoPrivate::root())) +Q_GLOBAL_STATIC(QStorageInfo, getRoot, QStorageInfoPrivate::root()) /*! Returns a QStorageInfo object that represents the system root volume. diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index e224f649ae..c1c1a761de 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> ** Contact: https://www.qt.io/licensing/ ** @@ -769,7 +769,7 @@ void QAbstractItemModelPrivate::invalidatePersistentIndex(const QModelIndex &ind } using DefaultRoleNames = QHash<int, QByteArray>; -Q_GLOBAL_STATIC_WITH_ARGS(DefaultRoleNames, qDefaultRoleNames, ( +Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames, { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, @@ -777,7 +777,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(DefaultRoleNames, qDefaultRoleNames, ( { Qt::ToolTipRole, "toolTip" }, { Qt::StatusTipRole, "statusTip" }, { Qt::WhatsThisRole, "whatsThis" }, - })) + }) const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames() { diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index 73b15ce46a..b1bbd9c262 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -69,7 +69,7 @@ static jobject g_jActivity = nullptr; static jobject g_jService = nullptr; static jobject g_jClassLoader = nullptr; -Q_GLOBAL_STATIC_WITH_ARGS(QtAndroidPrivate::OnBindListener*, g_onBindListener, (nullptr)); +Q_GLOBAL_STATIC(QtAndroidPrivate::OnBindListener *, g_onBindListener, nullptr); Q_GLOBAL_STATIC(QMutex, g_onBindListenerMutex); Q_GLOBAL_STATIC(QSemaphore, g_waitForServiceSetupSemaphore); Q_GLOBAL_STATIC(QAtomicInt, g_serviceSetupLockers); diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 1f2a0b62e2..bdd896b4c8 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -860,8 +860,8 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1; Q_CONSTINIT QBasicAtomicInt QLocalePrivate::s_generation = Q_BASIC_ATOMIC_INITIALIZER(0); -Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, - (new QLocalePrivate(defaultData(), defaultIndex()))) +Q_GLOBAL_STATIC(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, + new QLocalePrivate(defaultData(), defaultIndex())) static QLocalePrivate *localePrivateByName(QStringView name) { diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index 4244e72e50..54b600c61a 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2019 Crimson AS <info@crimson.no> ** Copyright (C) 2013 John Layt <jlayt@kde.org> ** Contact: https://www.qt.io/licensing/ @@ -125,7 +125,7 @@ static QTzTimeZoneHash loadTzTimeZones() } // Hash of available system tz files as loaded by loadTzTimeZones() -Q_GLOBAL_STATIC_WITH_ARGS(const QTzTimeZoneHash, tzZones, (loadTzTimeZones())); +Q_GLOBAL_STATIC(const QTzTimeZoneHash, tzZones, loadTzTimeZones()); /* The following is copied and modified from tzfile.h which is in the public domain. |