Use ::GetVersionEx directly rather than the Win8.1 SDK helpers
authorReid Kleckner <rnk@google.com>
Mon, 11 Jan 2016 20:35:45 +0000 (20:35 +0000)
committerReid Kleckner <rnk@google.com>
Mon, 11 Jan 2016 20:35:45 +0000 (20:35 +0000)
This removes ifdefs and fixes the build for users of the Win8.0 SDK,
which I happen to be. Upgrading is not hard, but executing the same code
everywhere seems better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257379 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/WindowsSupport.h

index c65e3148921ec6094f449c5c7962af6bfccdf746..cb091f186404dd7e8193b95e04f5b063d55f6058 100644 (file)
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
 
-#if !defined(__CYGWIN__) && !defined(__MINGW32__)
-#include <VersionHelpers.h>
-#else
-// Cygwin does not have the IsWindows8OrGreater() API.
-// Some version of mingw does not have the API either.
+/// Determines if the program is running on Windows 8 or newer. This
+/// reimplements the helpers in the Windows 8.1 SDK, which are intended to
+/// supercede raw calls to GetVersionEx, because old Windows SDKs, Cygwin, and
+/// MinGW don't have VersionSupport.h yet.
 inline bool IsWindows8OrGreater() {
   OSVERSIONINFO osvi = {};
   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 inline bool IsWindows8OrGreater() {
   OSVERSIONINFO osvi = {};
   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -60,7 +59,6 @@ inline bool IsWindows8OrGreater() {
   return (osvi.dwMajorVersion > 6 ||
           (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 2));
 }
   return (osvi.dwMajorVersion > 6 ||
           (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 2));
 }
-#endif // __CYGWIN__
 
 inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) {
   if (!ErrMsg)
 
 inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) {
   if (!ErrMsg)