Add placement deletes to avoid warnings on VC++
When compiling with VC++ 2017, Godot generates huge numbers of C4291 warnings about missing placement delete. I have not found a way to disable these warnings using compiler options: AFAICT there is no equivalent to `-f-no-exceptions` for VC++ (there is only /EH to change the exception-handling model, /GX is deprecated) and adding /wd4291 to the `disable_nonessential_warnings` list in the `SConstruct` file or even compiling with `warnings=no` does not disable the messages. Placement delete is only called when placement new throws an exception, since Godot doesn't use exceptions this change should have no runtime effect. Fixes #12654 (probably, difficult to say without log)
This commit is contained in:
@ -44,6 +44,26 @@ void *operator new(size_t p_size, void *(*p_allocfunc)(size_t p_size)) {
|
||||
return p_allocfunc(p_size);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void operator delete(void *p_mem, const char *p_description) {
|
||||
|
||||
ERR_EXPLAINC("Call to placement delete should not happen.");
|
||||
CRASH_NOW();
|
||||
}
|
||||
|
||||
void operator delete(void *p_mem, void *(*p_allocfunc)(size_t p_size)) {
|
||||
|
||||
ERR_EXPLAINC("Call to placement delete should not happen.");
|
||||
CRASH_NOW();
|
||||
}
|
||||
|
||||
void operator delete(void *p_mem, void *p_pointer, size_t check, const char *p_description) {
|
||||
|
||||
ERR_EXPLAINC("Call to placement delete should not happen.");
|
||||
CRASH_NOW();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
uint64_t Memory::mem_usage = 0;
|
||||
uint64_t Memory::max_usage = 0;
|
||||
|
||||
Reference in New Issue
Block a user