Author: dquintana Date: Thu Apr 30 21:48:26 2015 New Revision: 67483
URL: http://svn.reactos.org/svn/reactos?rev=67483&view=rev Log: This commit brings support for compiling ReactOS with Visual Studio 2015 RC (and possibly the final release).
[BUILD] msvc.cmake: Disable thread-local static initialization. CMakeLists.txt: Disable PCH for VS2015. configure.cmd: Make it aware of cl.exe version 19.x
[CPPRT] Add alias for the new variants of the delete operators.
[BROWSEUI] [MFIFS] [FRAMEDYN] [NDIS] [DDK] [PSDK] [STLPORT] Add explicit declarations of the new delete operators for those modules that don't use the WITH_RUNTIME option.
[WIDL] [WPP] Do not alias the snprintf family of functions to the _snprintf variants, since VS14 already declares them internally.
Modified: trunk/reactos/CMakeLists.txt trunk/reactos/cmake/msvc.cmake trunk/reactos/configure.cmd trunk/reactos/dll/win32/browseui/utility.cpp trunk/reactos/dll/win32/fmifs/precomp.h trunk/reactos/dll/win32/framedyn/chstring.cpp trunk/reactos/drivers/network/ndis/include/ndissys.h trunk/reactos/include/ddk/stdunk.h trunk/reactos/include/psdk/kcom.h trunk/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp trunk/reactos/lib/sdk/cpprt/i386/cpprt.s trunk/reactos/tools/widl/CMakeLists.txt trunk/reactos/tools/wpp/CMakeLists.txt
Modified: trunk/reactos/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=67483&am... ============================================================================== --- trunk/reactos/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/CMakeLists.txt [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -137,7 +137,7 @@ add_definitions(-D_WINKD_=1) endif()
- if(CMAKE_VERSION MATCHES "ReactOS") + if(CMAKE_VERSION MATCHES "ReactOS" AND MSVC_VERSION LESS 1900) set(PCH 1 CACHE BOOL "Whether to use precompiled headers") else() set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
Modified: trunk/reactos/cmake/msvc.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=67483&... ============================================================================== --- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -31,6 +31,11 @@ # VS 12+ requires /FS when used in parallel compilations if(MSVC_VERSION GREATER 1799 AND NOT MSVC_IDE) add_compile_flags("/FS") +endif () + +# VS14+ tries to use thread-safe initialization +if(MSVC_VERSION GREATER 1899) + add_compile_flags("/Zc:threadSafeInit-") endif ()
# Disable overly sensitive warnings as well as those that generally aren't
Modified: trunk/reactos/configure.cmd URL: http://svn.reactos.org/svn/reactos/trunk/reactos/configure.cmd?rev=67483&... ============================================================================== --- trunk/reactos/configure.cmd [iso-8859-1] (original) +++ trunk/reactos/configure.cmd [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -56,6 +56,7 @@ cl 2>&1 | find "16.00." > NUL && set VS_VERSION=10 cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11 cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12 + cl 2>&1 | find "19.00." > NUL && set VS_VERSION=14 if not defined VS_VERSION ( echo Error: Visual Studio version too old or version detection failed. exit /b
Modified: trunk/reactos/dll/win32/browseui/utility.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/utility.... ============================================================================== --- trunk/reactos/dll/win32/browseui/utility.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/utility.cpp [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -9,3 +9,8 @@ { LocalFree(p); } + +void operator delete(void *p, unsigned int) +{ + LocalFree(p); +}
Modified: trunk/reactos/dll/win32/fmifs/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fmifs/precomp.h?r... ============================================================================== --- trunk/reactos/dll/win32/fmifs/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fmifs/precomp.h [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -13,9 +13,10 @@
/* INCLUDES ******************************************************************/
+#define WIN32_NO_STATUS + #include <stdio.h>
-#define WIN32_NO_STATUS
/* PSDK/NDK Headers */ #include <windef.h>
Modified: trunk/reactos/dll/win32/framedyn/chstring.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/framedyn/chstring... ============================================================================== --- trunk/reactos/dll/win32/framedyn/chstring.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/framedyn/chstring.cpp [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -54,6 +54,19 @@ } }
+#if _MSC_VER >= 51900 +void __cdecl operator delete(void* ptr, unsigned int) +{ + // In Windows 2k3, they check for ptr being null. + // ISO, POSIX and even MSDN explains that it is allowed + // to call free with NULL pointer... + if (ptr) + { + free(ptr); + } +} +#endif + // Implement our own new operator so that we can throw our own exception in case // of allocation failure. // It could have been done using set_new_handler(), but well. MS guys didn't do it
Modified: trunk/reactos/drivers/network/ndis/include/ndissys.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/includ... ============================================================================== --- trunk/reactos/drivers/network/ndis/include/ndissys.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/ndis/include/ndissys.h [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -9,6 +9,13 @@ */ #ifndef __NDISSYS_H #define __NDISSYS_H + +/* portability fixes */ +#ifdef _M_AMD64 +#define KfReleaseSpinLock KeReleaseSpinLock +#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel +#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel +#endif
#include <ndis.h>
@@ -54,11 +61,4 @@ ExGetCurrentProcessorCpuUsage( PULONG CpuUsage);
-/* portability fixes */ -#ifdef _M_AMD64 -#define KfReleaseSpinLock KeReleaseSpinLock -#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel -#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel -#endif - #endif /* __NDISSYS_H */
Modified: trunk/reactos/include/ddk/stdunk.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/stdunk.h?rev=67... ============================================================================== --- trunk/reactos/include/ddk/stdunk.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/stdunk.h [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -204,6 +204,13 @@ ExFreePool(ptr); }
+inline void __cdecl +operator delete( + PVOID ptr, UINT unk) +{ + ExFreePool(ptr); +} + #endif /* ALLOCATION_OPERATORS_DEFINED */
Modified: trunk/reactos/include/psdk/kcom.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/kcom.h?rev=674... ============================================================================== --- trunk/reactos/include/psdk/kcom.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/kcom.h [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -234,6 +234,12 @@ if (pVoid) ExFreePool(pVoid); }
+inline void __cdecl operator delete( + PVOID pVoid, UINT unk) +{ + if (pVoid) ExFreePool(pVoid); +} + #endif /* _NEW_DELETE_OPERATORS_ */
#if defined(_SYS_GUID_OPERATOR_EQ_)
Modified: trunk/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/stlport/test/e... ============================================================================== --- trunk/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -264,6 +264,14 @@ } }
+#if defined (EH_DELETE_HAS_THROW_SPEC) +void _STLP_CALL operator delete(void* s, unsigned int) throw() +#else +void _STLP_CALL operator delete(void* s, unsigned int) +#endif +{ + ::operator delete(s); +}
/*=================================================================================== ClearAllocationSet (private helper)
Modified: trunk/reactos/lib/sdk/cpprt/i386/cpprt.s URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/cpprt/i386/cpprt.s?... ============================================================================== --- trunk/reactos/lib/sdk/cpprt/i386/cpprt.s [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/cpprt/i386/cpprt.s [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -27,7 +27,17 @@ ; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *)) DEFINE_ALIAS ??_L@YGXPAXIHP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
+; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *)) +DEFINE_ALIAS ??_L@YGXPAXIIP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z + ; void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *)) DEFINE_ALIAS ??_M@YGXPAXIHP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z
+; void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *)) +DEFINE_ALIAS ??_M@YGXPAXIIP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z + +; void __cdecl operator delete(void *,unsigned int) +DEFINE_ALIAS ??3@YAXPAXI@Z, ??3@YAXPAX@Z +DEFINE_ALIAS ??3@YAXPAXII@Z, ??3@YAXPAX@Z + END
Modified: trunk/reactos/tools/widl/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/CMakeLists.txt?r... ============================================================================== --- trunk/reactos/tools/widl/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/tools/widl/CMakeLists.txt [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -1,10 +1,12 @@
if(MSVC) - add_definitions(-Dsnprintf=_snprintf) + if(MSVC_VERSION LESS 1900) + add_definitions(-Dsnprintf=_snprintf)
- # Add this definition for WDK only, VS 9 doesn't like that - if(DEFINED ENV{DDKBUILDENV}) - add_definitions(-Dvsnprintf=_vsnprintf) + # Add this definition for WDK only, VS 9 doesn't like that + if(DEFINED ENV{DDKBUILDENV}) + add_definitions(-Dvsnprintf=_vsnprintf) + endif() endif()
list(APPEND SOURCE getopt.c)
Modified: trunk/reactos/tools/wpp/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wpp/CMakeLists.txt?re... ============================================================================== --- trunk/reactos/tools/wpp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/tools/wpp/CMakeLists.txt [iso-8859-1] Thu Apr 30 21:48:26 2015 @@ -1,13 +1,15 @@
if(MSVC) - add_definitions( - -Dsnprintf=_snprintf - -Dstrtoull=_strtoui64 - -Dstrtoll=_strtoi64) + if(MSVC_VERSION LESS 1900) + add_definitions( + -Dsnprintf=_snprintf + -Dstrtoull=_strtoui64 + -Dstrtoll=_strtoi64)
- # Add this definition for WDK only, VS 9 doesn't like that - if(DEFINED ENV{DDKBUILDENV}) - add_definitions(-Dvsnprintf=_vsnprintf) + # Add this definition for WDK only, VS 9 doesn't like that + if(DEFINED ENV{DDKBUILDENV}) + add_definitions(-Dvsnprintf=_vsnprintf) + endif() endif() endif()