mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Build: Support ASAN on msvc
This commit is contained in:
@@ -159,6 +159,19 @@ target_compile_options(trinity-compile-option-interface
|
||||
/we4263
|
||||
/we4264)
|
||||
|
||||
if(ASAN)
|
||||
target_compile_definitions(trinity-compile-option-interface
|
||||
INTERFACE
|
||||
-D_DISABLE_STRING_ANNOTATION
|
||||
-D_DISABLE_VECTOR_ANNOTATION)
|
||||
|
||||
target_compile_options(trinity-compile-option-interface
|
||||
INTERFACE
|
||||
/fsanitize=address)
|
||||
|
||||
message(STATUS "MSVC: Enabled Address Sanitizer ASan")
|
||||
endif()
|
||||
|
||||
# Disable incremental linking in debug builds.
|
||||
# To prevent linking getting stuck (which might be fixed in a later VS version).
|
||||
macro(DisableIncrementalLinking variable)
|
||||
|
||||
@@ -1634,7 +1634,7 @@ public:
|
||||
uint8 stack_array[10] = {};
|
||||
int size = 10;
|
||||
|
||||
handler->PSendSysMessage("Triggered an array out of bounds read at address %p, value %u", stack_array + size, stack_array[size]);
|
||||
handler->PSendSysMessage("Triggered an array out of bounds read at address %p, value %u", static_cast<void*>(stack_array + size), stack_array[size]);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@@ -1643,7 +1643,7 @@ public:
|
||||
{
|
||||
#ifdef ASAN
|
||||
uint8* leak = new uint8();
|
||||
handler->PSendSysMessage("Leaked 1 uint8 object at address %p", leak);
|
||||
handler->PSendSysMessage("Leaked 1 uint8 object at address %p", static_cast<void*>(leak));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user