Commit 29ffaf43 authored by Brad King's avatar Brad King

Suppress deprecation warnings for GetVersionEx

Visual Studio 12 (2013) deprecated GetVersionEx:

  warning C4996: 'GetVersionExW': was declared deprecated

in favor of either "versionhelpers.h" or VerifyVersionInfo, neither of
which exist in some of the older compilers we support.  Rather than
try to port conditionally to VerifyVersionInfo, simply suppress the
warning for now.

Change-Id: I85a6547c7dc25a104d4fe9b4034efdc5cea215ef
parent 6aa1f800
......@@ -36,6 +36,9 @@ a UNIX-style select system call.
#pragma warning (push, 1)
#endif
#include <windows.h> /* Windows API */
#if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
#endif
#include <string.h> /* strlen, strdup */
#include <stdio.h> /* sprintf */
#include <io.h> /* _unlink */
......@@ -335,7 +338,14 @@ kwsysProcess* kwsysProcess_New(void)
windows. */
ZeroMemory(&osv, sizeof(osv));
osv.dwOSVersionInfoSize = sizeof(osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
# pragma warning (disable:4996)
#endif
GetVersionEx(&osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
if(osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
/* Win9x no longer supported. */
......@@ -2370,7 +2380,14 @@ static kwsysProcess_List* kwsysProcess_List_New(void)
/* Select an implementation. */
ZeroMemory(&osv, sizeof(osv));
osv.dwOSVersionInfoSize = sizeof(osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
# pragma warning (disable:4996)
#endif
GetVersionEx(&osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
self->NT4 = (osv.dwPlatformId == VER_PLATFORM_WIN32_NT &&
osv.dwMajorVersion < 5)? 1:0;
......
......@@ -60,6 +60,9 @@
#if defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# endif
# include <errno.h>
# if defined(KWSYS_SYS_HAS_PSAPI)
# include <psapi.h>
......@@ -5063,6 +5066,10 @@ bool SystemInformationImplementation::QueryOSInformation()
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
ZeroMemory (&osvi, sizeof (OSVERSIONINFOEXW));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
# pragma warning (disable:4996)
#endif
bOsVersionInfoEx = GetVersionExW ((OSVERSIONINFOW*)&osvi);
if (!bOsVersionInfoEx)
{
......@@ -5072,6 +5079,9 @@ bool SystemInformationImplementation::QueryOSInformation()
return false;
}
}
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
switch (osvi.dwPlatformId)
{
......
......@@ -82,6 +82,9 @@
# ifndef INVALID_FILE_ATTRIBUTES
# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
# endif
# if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# endif
#elif defined (__CYGWIN__)
# include <windows.h>
# undef _WIN32
......@@ -4629,6 +4632,10 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
# pragma warning (disable:4996)
#endif
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
if (!bOsVersionInfoEx)
{
......@@ -4638,6 +4645,9 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
return 0;
}
}
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
switch (osvi.dwPlatformId)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment