summaryrefslogtreecommitdiffstats
path: root/src/AllocationPool.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-06-19 11:09:16 +0200
committerGitHub <noreply@github.com>2017-06-19 11:09:16 +0200
commitb0f3336533e104e3d0cf087858b616e3411f117a (patch)
treea08bc4f6d7a872b71f8ed5cbbb707b941b7ddb85 /src/AllocationPool.h
parentLuaState: Fixed VS2017's throw warnings for destructors. (#3779) (diff)
downloadcuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar.gz
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar.bz2
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar.lz
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar.xz
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.tar.zst
cuberite-b0f3336533e104e3d0cf087858b616e3411f117a.zip
Diffstat (limited to '')
-rw-r--r--src/AllocationPool.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index b8fae4a95..d1769dc03 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -81,7 +81,19 @@ public:
void * space = malloc(sizeof(T));
if (space != nullptr)
{
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ // The debugging-new that is set up using macros in Globals.h doesn't support the placement-new syntax used here.
+ // Temporarily disable the macro
+ #pragma push_macro("new")
+ #undef new
+ #endif
+
return new(space) T;
+
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ // Re-enable the debugging-new macro
+ #pragma pop_macro("new")
+ #endif
}
else if (m_FreeList.size() == NumElementsInReserve)
{
@@ -95,7 +107,21 @@ public:
}
}
// placement new, used to initalize the object
+
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ // The debugging-new that is set up using macros in Globals.h doesn't support the placement-new syntax used here.
+ // Temporarily disable the macro
+ #pragma push_macro("new")
+ #undef new
+ #endif
+
T * ret = new (m_FreeList.front()) T;
+
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ // Re-enable the debugging-new macro
+ #pragma pop_macro("new")
+ #endif
+
m_FreeList.pop_front();
return ret;
}