Utils: Add constexpr to most functions in HostOsInfo

Change-Id: If45cc91e0ae4061e01e3540e1867b08bffbe5774
Reviewed-by: Daniel Teske <qt@squorn.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Orgad Shaneh
2015-07-22 23:26:08 +03:00
committed by Orgad Shaneh
parent 074b61c3a7
commit 129591cb52

View File

@@ -42,16 +42,16 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT HostOsInfo class QTCREATOR_UTILS_EXPORT HostOsInfo
{ {
public: public:
static inline OsType hostOs(); static constexpr inline OsType hostOs();
enum HostArchitecture { HostArchitectureX86, HostArchitectureAMD64, HostArchitectureItanium, enum HostArchitecture { HostArchitectureX86, HostArchitectureAMD64, HostArchitectureItanium,
HostArchitectureArm, HostArchitectureUnknown }; HostArchitectureArm, HostArchitectureUnknown };
static HostArchitecture hostArchitecture(); static HostArchitecture hostArchitecture();
static bool isWindowsHost() { return hostOs() == OsTypeWindows; } static constexpr bool isWindowsHost() { return hostOs() == OsTypeWindows; }
static bool isLinuxHost() { return hostOs() == OsTypeLinux; } static constexpr bool isLinuxHost() { return hostOs() == OsTypeLinux; }
static bool isMacHost() { return hostOs() == OsTypeMac; } static constexpr bool isMacHost() { return hostOs() == OsTypeMac; }
static inline bool isAnyUnixHost(); static constexpr inline bool isAnyUnixHost();
static QString withExecutableSuffix(const QString &executable) static QString withExecutableSuffix(const QString &executable)
{ {
@@ -88,7 +88,7 @@ private:
}; };
OsType HostOsInfo::hostOs() constexpr OsType HostOsInfo::hostOs()
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
return OsTypeWindows; return OsTypeWindows;
@@ -103,7 +103,7 @@ OsType HostOsInfo::hostOs()
#endif #endif
} }
bool HostOsInfo::isAnyUnixHost() constexpr bool HostOsInfo::isAnyUnixHost()
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
return true; return true;