Skip to content

Commit 571c008

Browse files
committed
Add delete operator in Crst class
1 parent e55968b commit 571c008

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

eng/native/configurecompiler.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ if (CLR_CMAKE_HOST_UNIX)
399399
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-misleading-indentation>)
400400
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-stringop-overflow>)
401401
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-stringop-truncation>)
402-
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-mismatched-new-delete>)
403-
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-free-nonheap-object>)
404402
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-placement-new>)
405403

406404
check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW)

src/coreclr/vm/crst.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ class Crst : public CrstBase
421421
return new BYTE[size];
422422
}
423423

424+
void operator delete(void* mem)
425+
{
426+
WRAPPER_NO_CONTRACT;
427+
delete[] (BYTE*)mem;
428+
}
429+
424430
private:
425431
// Do not use inplace operator new on Crst. A wrong destructor would be called if the constructor fails.
426432
// Use CrstStatic or CrstExplicitInit instead of the inplace operator new.

0 commit comments

Comments
 (0)