Do not define global inline new/delete operators
authorMike Danes <onemihaid@hotmail.com>
Thu, 18 Feb 2016 21:42:35 +0000 (23:42 +0200)
committerMike Danes <onemihaid@hotmail.com>
Thu, 18 Feb 2016 21:42:35 +0000 (23:42 +0200)
VS2015 Update 2 generates C4595 for such code and the build fails due to /WX

src/ToolBox/SOS/Strike/util.cpp
src/ToolBox/SOS/Strike/util.h

index 1239c69..1763646 100644 (file)
@@ -83,6 +83,17 @@ const UINT kcMaxRevertedRejitData = 10;
 
 #ifndef FEATURE_PAL
 
+// ensure we always allocate on the process heap
+void* __cdecl operator new(size_t size) throw()
+{ return HeapAlloc(GetProcessHeap(), 0, size); }
+void __cdecl operator delete(void* pObj) throw()
+{ HeapFree(GetProcessHeap(), 0, pObj); }
+
+void* __cdecl operator new[](size_t size) throw()
+{ return HeapAlloc(GetProcessHeap(), 0, size); }
+void __cdecl operator delete[](void* pObj) throw()
+{ HeapFree(GetProcessHeap(), 0, pObj); }
+
 /**********************************************************************\
 * Here we define types and functions that support custom COM           *
 * activation rules, as defined by the CIOptions enum.                  *
index 583c7a6..68a7232 100644 (file)
@@ -1632,19 +1632,6 @@ WCHAR *CreateMethodTableName(TADDR mt, TADDR cmt = NULL);
 void isRetAddr(DWORD_PTR retAddr, DWORD_PTR* whereCalled);
 DWORD_PTR GetValueFromExpression (___in __in_z const char *const str);
 
-#ifndef FEATURE_PAL
-// ensure we always allocate on the process heap
-FORCEINLINE void* __cdecl operator new(size_t size) throw()
-{ return HeapAlloc(GetProcessHeap(), 0, size); }
-FORCEINLINE void __cdecl operator delete(void* pObj) throw()
-{ HeapFree(GetProcessHeap(), 0, pObj); }
-
-FORCEINLINE void* __cdecl operator new[](size_t size) throw()
-{ return HeapAlloc(GetProcessHeap(), 0, size); }
-FORCEINLINE void __cdecl operator delete[](void* pObj) throw()
-{ HeapFree(GetProcessHeap(), 0, pObj); }
-#endif
-
 enum ModuleHeapType
 {
     ModuleHeapType_ThunkHeap,