QMetaTypeModuleHelper: mark instances constexpr

Static and thread-local objects should be constexpr or constinit if possible.

Task-number: QTBUG-100485
Pick-to: 6.6 6.5
Change-Id: I29088798a50d6278252c9088e7c191c4214b2e5b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 88c3cd6e08c86bfb5bb676ceed4c92344f8ed91c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-01-18 09:11:03 +01:00 committed by Qt Cherry-pick Bot
parent ede7d80b39
commit 7b5df411db
3 changed files with 3 additions and 3 deletions

View File

@ -955,7 +955,7 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
};
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
static const struct : QMetaTypeModuleHelper
static constexpr struct : QMetaTypeModuleHelper
{
template<typename T, typename LiteralWrapper =
std::conditional_t<std::is_same_v<T, QString>, QLatin1StringView, const char *>>

View File

@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace {
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
static const struct : QMetaTypeModuleHelper
static constexpr struct : QMetaTypeModuleHelper
{
#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
QT_METATYPE_INTERFACE_INIT(RealName),

View File

@ -13,7 +13,7 @@ QT_BEGIN_NAMESPACE
namespace {
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
static const struct : QMetaTypeModuleHelper
static constexpr struct : QMetaTypeModuleHelper
{
const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override {
switch (type) {