From 32468cf0ecbf8e14a5aa767980bcab88e59ffdba Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Sep 2016 09:53:02 +0200 Subject: [PATCH] Fix build with MSVC 2015 Update 2 Complains about the constexpr otherwise. Change-Id: Idb64ed3287b8f9506a811a091dd1ad8ae11b2ad8 Reviewed-by: Orgad Shaneh --- src/libs/utils/hostosinfo.h | 49 +++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/libs/utils/hostosinfo.h b/src/libs/utils/hostosinfo.h index 5d5f3909711..70f01f8f5d9 100644 --- a/src/libs/utils/hostosinfo.h +++ b/src/libs/utils/hostosinfo.h @@ -42,7 +42,20 @@ namespace Utils { class QTCREATOR_UTILS_EXPORT HostOsInfo { public: - static constexpr inline OsType hostOs(); + static constexpr inline OsType hostOs() + { +#if defined(Q_OS_WIN) + return OsTypeWindows; +#elif defined(Q_OS_LINUX) + return OsTypeLinux; +#elif defined(Q_OS_MAC) + return OsTypeMac; +#elif defined(Q_OS_UNIX) + return OsTypeOtherUnix; +#else + return OsTypeOther; +#endif + } enum HostArchitecture { HostArchitectureX86, HostArchitectureAMD64, HostArchitectureItanium, HostArchitectureArm, HostArchitectureUnknown }; @@ -51,7 +64,14 @@ public: static constexpr bool isWindowsHost() { return hostOs() == OsTypeWindows; } static constexpr bool isLinuxHost() { return hostOs() == OsTypeLinux; } static constexpr bool isMacHost() { return hostOs() == OsTypeMac; } - static constexpr inline bool isAnyUnixHost(); + static constexpr inline bool isAnyUnixHost() + { +#ifdef Q_OS_UNIX + return true; +#else + return false; +#endif + } static QString withExecutableSuffix(const QString &executable) { @@ -87,29 +107,4 @@ private: static bool m_useOverrideFileNameCaseSensitivity; }; - -constexpr OsType HostOsInfo::hostOs() -{ -#if defined(Q_OS_WIN) - return OsTypeWindows; -#elif defined(Q_OS_LINUX) - return OsTypeLinux; -#elif defined(Q_OS_MAC) - return OsTypeMac; -#elif defined(Q_OS_UNIX) - return OsTypeOtherUnix; -#else - return OsTypeOther; -#endif -} - -constexpr bool HostOsInfo::isAnyUnixHost() -{ -#ifdef Q_OS_UNIX - return true; -#else - return false; -#endif -} - } // namespace Utils