QLocale: mark c_locale Q_CONSTINIT and c_private() noexcept
Add Q_CONSTINIT to the c_locale variable to statically assert that it cannot fail (no runtime initialization = no failure). The QLocalePrivate ctor is already constexpr, so Q_CONSTINIT works out of the box here. Because c_locale construction is now known not to fail, c_private() cannot fail, either, and can and should be noexcept. Change-Id: Ibe94cb4bcd990fbd0b440dd98509eb39447a94b7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit c745b59e36b421039e71779fd9e5db8c619163f2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1714af1721
commit
b2df824e02
@ -686,9 +686,9 @@ qsizetype qt_repeatCount(QStringView s)
|
|||||||
Q_CONSTINIT static const QLocaleData *default_data = nullptr;
|
Q_CONSTINIT static const QLocaleData *default_data = nullptr;
|
||||||
Q_CONSTINIT QBasicAtomicInt QLocalePrivate::s_generation = Q_BASIC_ATOMIC_INITIALIZER(0);
|
Q_CONSTINIT QBasicAtomicInt QLocalePrivate::s_generation = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||||
|
|
||||||
static QLocalePrivate *c_private()
|
static QLocalePrivate *c_private() noexcept
|
||||||
{
|
{
|
||||||
static QLocalePrivate c_locale(locale_data, 0, QLocale::OmitGroupSeparator, 1);
|
Q_CONSTINIT static QLocalePrivate c_locale(locale_data, 0, QLocale::OmitGroupSeparator, 1);
|
||||||
return &c_locale;
|
return &c_locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user