Utils: Make some HostInfo functions constexpr

Enables the removal of static function scope variables.

Change-Id: I337468c1525546a5cad9e95ae4a859de18ee514d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marco Bubke
2022-09-28 12:37:57 +02:00
parent 77bba6d640
commit ac21848acc
2 changed files with 6 additions and 6 deletions

View File

@@ -72,12 +72,12 @@ public:
: OsSpecificAspects::fileNameCaseSensitivity(hostOs()); : OsSpecificAspects::fileNameCaseSensitivity(hostOs());
} }
static QChar pathListSeparator() static constexpr QChar pathListSeparator()
{ {
return OsSpecificAspects::pathListSeparator(hostOs()); return OsSpecificAspects::pathListSeparator(hostOs());
} }
static Qt::KeyboardModifier controlModifier() static constexpr Qt::KeyboardModifier controlModifier()
{ {
return OsSpecificAspects::controlModifier(hostOs()); return OsSpecificAspects::controlModifier(hostOs());
} }

View File

@@ -24,22 +24,22 @@ inline QString withExecutableSuffix(OsType osType, const QString &executable)
return finalName; return finalName;
} }
inline Qt::CaseSensitivity fileNameCaseSensitivity(OsType osType) constexpr Qt::CaseSensitivity fileNameCaseSensitivity(OsType osType)
{ {
return osType == OsTypeWindows || osType == OsTypeMac ? Qt::CaseInsensitive : Qt::CaseSensitive; return osType == OsTypeWindows || osType == OsTypeMac ? Qt::CaseInsensitive : Qt::CaseSensitive;
} }
inline Qt::CaseSensitivity envVarCaseSensitivity(OsType osType) constexpr Qt::CaseSensitivity envVarCaseSensitivity(OsType osType)
{ {
return fileNameCaseSensitivity(osType); return fileNameCaseSensitivity(osType);
} }
inline QChar pathListSeparator(OsType osType) constexpr QChar pathListSeparator(OsType osType)
{ {
return QLatin1Char(osType == OsTypeWindows ? ';' : ':'); return QLatin1Char(osType == OsTypeWindows ? ';' : ':');
} }
inline Qt::KeyboardModifier controlModifier(OsType osType) constexpr Qt::KeyboardModifier controlModifier(OsType osType)
{ {
return osType == OsTypeMac ? Qt::MetaModifier : Qt::ControlModifier; return osType == OsTypeMac ? Qt::MetaModifier : Qt::ControlModifier;
} }