diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-03-17 12:07:44 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-03-29 06:18:49 +0100 |
commit | 32692667a625f31aa02e0303f2139c780ae42694 (patch) | |
tree | bab74a97f673fd2caee7d1d0b68fac4583fcfb11 /src/corelib/text | |
parent | 9578a3f72fd67011263eac9d306750a2dbef01d1 (diff) |
Apply Q_CONSTINIT across the codebase
Still not complete. Just grepping for static and thread_local.
Task-number: QTBUG-100486
Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale.cpp | 8 | ||||
-rw-r--r-- | src/corelib/text/qunicodetools.cpp | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 88aef5989f..d9518c9e8f 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE -const char QByteArray::_empty = '\0'; +Q_CONSTINIT const char QByteArray::_empty = '\0'; // ASCII case system, used by QByteArray::to{Upper,Lower}() and qstr(n)icmp(): static constexpr inline uchar asciiUpper(uchar c) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index dd92cfe354..6a191dfce6 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; #ifndef QT_NO_SYSTEMLOCALE -static QSystemLocale *_systemLocale = nullptr; +Q_CONSTINIT static QSystemLocale *_systemLocale = nullptr; class QSystemLocaleSingleton: public QSystemLocale { public: @@ -95,7 +95,7 @@ public: }; Q_GLOBAL_STATIC(QSystemLocaleSingleton, QSystemLocale_globalSystemLocale) -static QLocaleData systemLocaleData; +Q_CONSTINIT static QLocaleData systemLocaleData = {}; #endif /****************************************************************************** @@ -695,7 +695,7 @@ int qt_repeatCount(QStringView s) return int(j); } -static const QLocaleData *default_data = nullptr; +Q_CONSTINIT static const QLocaleData *default_data = nullptr; static const QLocaleData *const c_data = locale_data; static QLocalePrivate *c_private() @@ -852,7 +852,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1; -QBasicAtomicInt QLocalePrivate::s_generation = Q_BASIC_ATOMIC_INITIALIZER(0); +Q_CONSTINIT QBasicAtomicInt QLocalePrivate::s_generation = Q_BASIC_ATOMIC_INITIALIZER(0); Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, (new QLocalePrivate(defaultData(), defaultIndex()))) diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index bba950102e..ff11baa99a 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -1404,12 +1404,12 @@ typedef int (*th_brk_def) (const unsigned char*, int*, size_t); typedef size_t (*th_next_cell_def) (const unsigned char *, size_t, struct thcell_t *, int); /* libthai related function handles */ -static th_brk_def th_brk = nullptr; -static th_next_cell_def th_next_cell = nullptr; +Q_CONSTINIT static th_brk_def th_brk = nullptr; +Q_CONSTINIT static th_next_cell_def th_next_cell = nullptr; static int init_libthai() { #if QT_CONFIG(library) - static bool initialized = false; + Q_CONSTINIT static bool initialized = false; if (!initialized && (!th_brk || !th_next_cell)) { th_brk = reinterpret_cast<th_brk_def>(QLibrary::resolve("thai"_L1, static_cast<int>(LIBTHAI_MAJOR), "th_brk")); th_next_cell = (th_next_cell_def)QLibrary::resolve("thai"_L1, LIBTHAI_MAJOR, "th_next_cell"); |