From 9104f8128511975ee3063fd882e656d78cc0017a Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 20 Feb 2019 14:53:12 +0000 Subject: [PATCH] Remove Undefined preprocessor behaviour --- src/pal/pal_windows.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pal/pal_windows.h b/src/pal/pal_windows.h index 6f65ad2..9b64fe7 100644 --- a/src/pal/pal_windows.h +++ b/src/pal/pal_windows.h @@ -7,6 +7,13 @@ # define WIN32_LEAN_AND_MEAN # define NOMINMAX # include +// VirtualAlloc2 is exposed in RS5 headers. +# ifdef NTDDI_WIN10_RS5 +# if (NTDDI_VERSION >= NTDDI_WIN10_RS5) && (WINVER >= _WIN32_WINNT_WIN10)\ + && !defined(USE_SYSTEMATIC_TESTING) +# define PLATFORM_HAS_VIRTUALALLOC2 +# endif +# endif namespace snmalloc { @@ -73,8 +80,7 @@ namespace snmalloc if (committed) flags |= MEM_COMMIT; -# if defined(NTDDI_WIN10_RS5) && (NTDDI_VERSION >= NTDDI_WIN10_RS5) && \ - (WINVER >= _WIN32_WINNT_WIN10) && !defined(USE_SYSTEMATIC_TESTING) +# ifdef PLATFORM_HAS_VIRTUALALLOC2 // If we're on Windows 10 or newer, we can use the VirtualAlloc2 // function. The FromApp variant is useable by UWP applications and // cannot allocate executable memory.