瀏覽代碼

Merge pull request #9 from kevcadieux/msvc-asan-support

Adding AddressSanitizer detection for MSVC and GCC
liam-mitchell 4 年之前
父節點
當前提交
fbcc34e89c
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      include/EAStdC/internal/Config.h

+ 5 - 3
include/EAStdC/internal/Config.h

@@ -274,10 +274,12 @@
 // EASTDC_ASAN_ENABLED
 //
 // Defined as 0 or 1. It's value depends on the compile environment.
-// Specifies whether the code is being built with Clang's Address Sanitizer.
+// Specifies whether the code is being built with Address Sanitizer.
 //
-#if defined(__has_feature)
-	#if __has_feature(address_sanitizer)
+#if defined(__SANITIZE_ADDRESS__) // GCC or MSVC
+	#define EASTDC_ASAN_ENABLED 1
+#elif defined(__has_feature)
+	#if __has_feature(address_sanitizer)  // Clang
 		#define EASTDC_ASAN_ENABLED 1
 	#else
 		#define EASTDC_ASAN_ENABLED 0