QMetaTypeModuleHelper: mark instances constexpr

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

Task-number: QTBUG-100485
Pick-to: 6.7 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>
bb10
Marc Mutz 2024-01-18 09:11:03 +01:00
parent 3195e34742
commit 88c3cd6e08
3 changed files with 3 additions and 3 deletions

View File

@ -964,7 +964,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) {