From 1d9679d616bf588826a1731d616e733908abe198 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 28 Sep 2023 09:49:28 -0700 Subject: [PATCH 1/6] [ASan] Disable annotations on unsupported platforms Add a new define, `_DISABLE_ASAN_ANNOTATIONS`, which disables all ASan annotations in the standard library as opposed to requiring a person to define both `_DISABLE_STRING_ANNOTATION` and `_DISABLE_VECTOR_ANNOTATION`. Disable ASan annotations on unsupported platforms like ARM64. If someone is working on adding address sanitizer support on those platforms (* wink wink nudge nudge *) they can define the `_ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS` escape hatch to get STL annotations anyways, though they will need to provide their own stl_asan.lib. Also, fix a bug where `annotate_string` (and `annotate_vector`) were not getting set to `0` if you passed both `_DISABLE_STRING_ANNOTATION` and `_DISABLE_VECTOR_ANNOTATION`. --- .../__msvc_sanitizer_annotate_container.hpp | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 3633425feb..8dac1a4cb0 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -15,7 +15,28 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -#if !defined(_M_CEE_PURE) && !(defined(_DISABLE_STRING_ANNOTATION) && defined(_DISABLE_VECTOR_ANNOTATION)) +#ifdef _DISABLE_ASAN_ANNOTATIONS + +#ifdef _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS +#error \ + "Invalid set of defines - one cannot define both _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS and _DISABLE_ASAN_ANNOTATIONS at the same time" +#endif + +#else // ^^^ _DISABLE_ASAN_ANNOTATIONS / !_DISABLE_ASAN_ANNOTATIONS vvv + +#if defined(_DISABLE_STRING_ANNOTATION) && defined(_DISABLE_VECTOR_ANNOTATION) +#define _DISABLE_ASAN_ANNOTATIONS +#elif defined(_M_ARM64EC) || defined(_M_ARM64) || defined(_M_ARM) + +#ifndef _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS +#define _DISABLE_ASAN_ANNOTATIONS +#endif + +#elif defined(_M_CEE_PURE) +#define _DISABLE_ASAN_ANNOTATIONS +#endif + +#endif // ^^^ !_DISABLE_ASAN_ANNOTATIONS #ifdef __SANITIZE_ADDRESS__ @@ -45,11 +66,11 @@ _STL_DISABLE_CLANG_WARNINGS #endif // ^^^ !defined(__clang__) && !defined(__SANITIZE_ADDRESS__) ^^^ -#ifdef _DISABLE_STRING_ANNOTATION +#if defined(_DISABLE_ASAN_ANNOTATION) || defined(_DISABLE_STRING_ANNOTATION) #undef _ACTIVATE_STRING_ANNOTATION #undef _INSERT_STRING_ANNOTATION #endif // defined(_DISABLE_STRING_ANNOTATION) -#ifdef _DISABLE_VECTOR_ANNOTATION +#if defined(_DISABLE_ASAN_ANNOTATION) || defined(_DISABLE_VECTOR_ANNOTATION) #undef _ACTIVATE_VECTOR_ANNOTATION #undef _INSERT_VECTOR_ANNOTATION #endif // defined(_DISABLE_VECTOR_ANNOTATION) @@ -123,8 +144,6 @@ void __cdecl __sanitizer_annotate_contiguous_container( #endif // insert asan annotations -#endif // !defined(_M_CEE_PURE) && asan not disabled - #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) From 32f6be8912d8feddae5372147d48b007efac591e Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 29 Sep 2023 10:45:57 -0700 Subject: [PATCH 2/6] code reviews, plus more bug fixes I've also cleaned up everything in a way that's hopefully more obvious. --- stl/CMakeLists.txt | 4 +- .../__msvc_sanitizer_annotate_container.hpp | 82 +++++++++++-------- 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 4483dfeb8e..ab6d74bfcb 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -663,12 +663,12 @@ add_stl_dlls("d" Debug) function(add_stl_statics FLAVOR_SUFFIX REL_OR_DBG IDL_VALUE) add_library(libcpmt${FLAVOR_SUFFIX}_eha OBJECT ${EHA_SOURCES}) - target_compile_definitions(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE _ANNOTATE_VECTOR _ANNOTATE_STRING "_ITERATOR_DEBUG_LEVEL=${IDL_VALUE}") + target_compile_definitions(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE _ANNOTATE_STL "_ITERATOR_DEBUG_LEVEL=${IDL_VALUE}") target_compile_options(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE /EHa) target_stl_compile_options(libcpmt${FLAVOR_SUFFIX}_eha ${REL_OR_DBG}) add_library(libcpmt${FLAVOR_SUFFIX} STATIC ${HEADERS} ${IMPLIB_SOURCES} ${SOURCES} ${INITIALIZER_SOURCES} ${STATIC_SOURCES}) - target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE _ANNOTATE_VECTOR _ANNOTATE_STRING "_ITERATOR_DEBUG_LEVEL=${IDL_VALUE}") + target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE _ANNOTATE_STL "_ITERATOR_DEBUG_LEVEL=${IDL_VALUE}") target_compile_options(libcpmt${FLAVOR_SUFFIX} PRIVATE "$<$:/EHsc>") target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::math stl_alias_objects libcpmt${FLAVOR_SUFFIX}_eha) target_stl_compile_options(libcpmt${FLAVOR_SUFFIX} ${REL_OR_DBG}) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 8dac1a4cb0..90d1050138 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -15,28 +15,42 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -#ifdef _DISABLE_ASAN_ANNOTATIONS +// The following macros change the behavior of this file: +// - _DISABLE_STL_ANNOTATION: Disable ASan annotations in the standard library +// (this will be auto-defined on unsupported platforms) +// + _DISABLE_STRING_ANNOTATION: same, but for only `basic_string` +// + _DISABLE_VECTOR_ANNOTATION: same, but for only `vector` +// - _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS: Don't auto-disable ASan annotations +// - _ANNOTATE_STL: Even when ASan annotations are disabled, insert the code for annotating into the STL anyways; +// this is useful when building static libraries which may be linked against both ASan and non-ASan binaries. +// + _ANNOTATE_STRING: same, but only for `basic_string` +// + _ANNOTATE_VECTOR: same, but only for `vector` -#ifdef _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS -#error \ - "Invalid set of defines - one cannot define both _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS and _DISABLE_ASAN_ANNOTATIONS at the same time" -#endif +// if our user hasn't defined `_DISABLE_STL_ANNOTATION`, then we may disable it anyways +#if !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) -#else // ^^^ _DISABLE_ASAN_ANNOTATIONS / !_DISABLE_ASAN_ANNOTATIONS vvv +#if defined(_M_ARM64EC) || defined(_M_ARM64) || defined(_M_ARM) || defined(_M_CEE_PURE) +#define _DISABLE_STL_ANNOTATION +#endif // ^^^ unsupported platform -#if defined(_DISABLE_STRING_ANNOTATION) && defined(_DISABLE_VECTOR_ANNOTATION) -#define _DISABLE_ASAN_ANNOTATIONS -#elif defined(_M_ARM64EC) || defined(_M_ARM64) || defined(_M_ARM) +#endif // ^^^ !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORM) -#ifndef _ENABLE_ASAN_ANNOTATIONS_ON_UNSUPPORTED_PLATFORMS -#define _DISABLE_ASAN_ANNOTATIONS -#endif +// this may be user-defined, or we may be on an unsupported platform +#ifdef _DISABLE_STL_ANNOTATION -#elif defined(_M_CEE_PURE) -#define _DISABLE_ASAN_ANNOTATIONS -#endif +#ifdef _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS +#error _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS and _DISABLE_STL_ANNOTATION are mutually exclusive +#endif // ^^^ defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) + +#define _DISABLE_STRING_ANNOTATION +#define _DISABLE_VECTOR_ANNOTATION -#endif // ^^^ !_DISABLE_ASAN_ANNOTATIONS +#endif // ^^^ defined(_DISABLE_STL_ANNOTATION) + +#ifdef _ANNOTATE_STL +#define _ANNOTATE_STRING +#define _ANNOTATE_VECTOR +#endif // ^^^ defined(_ANNOTATE_STL) #ifdef __SANITIZE_ADDRESS__ @@ -55,41 +69,41 @@ _STL_DISABLE_CLANG_WARNINGS #pragma comment(linker, "/INFERASANLIBS") #endif // __has_feature(address_sanitizer) -#else // ^^^ defined(__clang__) / !defined(__clang__) && !defined(__SANITIZE_ADDRESS__) vvv - -#ifdef _ANNOTATE_STRING -#define _INSERT_STRING_ANNOTATION -#endif // defined(_ANNOTATE_STRING) -#ifdef _ANNOTATE_VECTOR -#define _INSERT_VECTOR_ANNOTATION -#endif // defined(_ANNOTATE_VECTOR) +#endif // ^^^ defined(__clang__) -#endif // ^^^ !defined(__clang__) && !defined(__SANITIZE_ADDRESS__) ^^^ -#if defined(_DISABLE_ASAN_ANNOTATION) || defined(_DISABLE_STRING_ANNOTATION) +#ifdef _DISABLE_STRING_ANNOTATION #undef _ACTIVATE_STRING_ANNOTATION #undef _INSERT_STRING_ANNOTATION -#endif // defined(_DISABLE_STRING_ANNOTATION) -#if defined(_DISABLE_ASAN_ANNOTATION) || defined(_DISABLE_VECTOR_ANNOTATION) +#endif // ^^^ defined(_DISABLE_STRING_ANNOTATION) +#ifdef _DISABLE_VECTOR_ANNOTATION #undef _ACTIVATE_VECTOR_ANNOTATION #undef _INSERT_VECTOR_ANNOTATION -#endif // defined(_DISABLE_VECTOR_ANNOTATION) +#endif // ^^^ defined(_DISABLE_VECTOR_ANNOTATION) + +#ifdef _ANNOTATE_STRING +#define _INSERT_STRING_ANNOTATION +#endif // ^^^ defined(_ANNOTATE_STRING) +#ifdef _ANNOTATE_VECTOR +#define _INSERT_VECTOR_ANNOTATION +#endif // ^^^ defined(_ANNOTATE_VECTOR) + #ifndef _INSERT_STRING_ANNOTATION #pragma detect_mismatch("annotate_string", "0") -#endif // !defined(_INSERT_STRING_ANNOTATION) +#endif // ^^^ !defined(_INSERT_STRING_ANNOTATION) #ifndef _INSERT_VECTOR_ANNOTATION #pragma detect_mismatch("annotate_vector", "0") -#endif // !defined(_INSERT_VECTOR_ANNOTATION) +#endif // ^^^ !defined(_INSERT_VECTOR_ANNOTATION) #ifdef _ACTIVATE_STRING_ANNOTATION #pragma comment(lib, "stl_asan") #pragma detect_mismatch("annotate_string", "1") -#endif // defined(_ACTIVATE_STRING_ANNOTATION) +#endif // ^^^ defined(_ACTIVATE_STRING_ANNOTATION) #ifdef _ACTIVATE_VECTOR_ANNOTATION #pragma comment(lib, "stl_asan") #pragma detect_mismatch("annotate_vector", "1") -#endif // defined(_ACTIVATE_VECTOR_ANNOTATION) +#endif // ^^^ defined(_ACTIVATE_VECTOR_ANNOTATION) #undef _ACTIVATE_STRING_ANNOTATION #undef _ACTIVATE_VECTOR_ANNOTATION @@ -142,7 +156,7 @@ void __cdecl __sanitizer_annotate_contiguous_container( #error Unknown architecture #endif // ^^^ unknown architecture ^^^ -#endif // insert asan annotations +#endif // ^^^ insert asan annotations #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS From debd882e4f612109597a21ac4a3d4b46536e0393 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Mon, 2 Oct 2023 10:20:42 -0700 Subject: [PATCH 3/6] fix asan capitalization/remove comments --- stl/inc/__msvc_sanitizer_annotate_container.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 90d1050138..7631ed357c 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -26,7 +26,6 @@ _STL_DISABLE_CLANG_WARNINGS // + _ANNOTATE_STRING: same, but only for `basic_string` // + _ANNOTATE_VECTOR: same, but only for `vector` -// if our user hasn't defined `_DISABLE_STL_ANNOTATION`, then we may disable it anyways #if !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) #if defined(_M_ARM64EC) || defined(_M_ARM64) || defined(_M_ARM) || defined(_M_CEE_PURE) @@ -35,7 +34,6 @@ _STL_DISABLE_CLANG_WARNINGS #endif // ^^^ !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORM) -// this may be user-defined, or we may be on an unsupported platform #ifdef _DISABLE_STL_ANNOTATION #ifdef _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS @@ -156,7 +154,7 @@ void __cdecl __sanitizer_annotate_contiguous_container( #error Unknown architecture #endif // ^^^ unknown architecture ^^^ -#endif // ^^^ insert asan annotations +#endif // ^^^ insert ASan annotations #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS From 1ba0bfa10804066bc21c20ab91f1e17ccbd9158f Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Mon, 2 Oct 2023 13:51:37 -0700 Subject: [PATCH 4/6] no macro redefinition pls --- stl/inc/__msvc_sanitizer_annotate_container.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 7631ed357c..8ffb3cab51 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -40,14 +40,25 @@ _STL_DISABLE_CLANG_WARNINGS #error _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS and _DISABLE_STL_ANNOTATION are mutually exclusive #endif // ^^^ defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) +#ifndef _DISABLE_STRING_ANNOTATION #define _DISABLE_STRING_ANNOTATION +#endif // ^^^ !defined(_DISABLE_STRING_ANNOTATION) +#ifndef _DISABLE_VECTOR_ANNOTATION #define _DISABLE_VECTOR_ANNOTATION +#endif // ^^^ !defined(_DISABLE_VECTOR_ANNOTATION) #endif // ^^^ defined(_DISABLE_STL_ANNOTATION) #ifdef _ANNOTATE_STL + +#ifdef _ANNOTATE_STRING #define _ANNOTATE_STRING +#endif // ^^^ defined(_ANNOTATE_STRING) + +#ifdef _ANNOTATE_VECTOR #define _ANNOTATE_VECTOR +#endif // ^^^ defined(_ANNOTATE_VECTOR) + #endif // ^^^ defined(_ANNOTATE_STL) #ifdef __SANITIZE_ADDRESS__ From fc6fb0cbed13831cbc04ef09dc08f85416b4fa24 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Mon, 2 Oct 2023 14:05:38 -0700 Subject: [PATCH 5/6] STL CRs --- .../__msvc_sanitizer_annotate_container.hpp | 38 +++++++++---------- stl/msbuild/stl_base/libcp.settings.targets | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 8ffb3cab51..22cbed5a86 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -30,36 +30,36 @@ _STL_DISABLE_CLANG_WARNINGS #if defined(_M_ARM64EC) || defined(_M_ARM64) || defined(_M_ARM) || defined(_M_CEE_PURE) #define _DISABLE_STL_ANNOTATION -#endif // ^^^ unsupported platform +#endif // ^^^ unsupported platform ^^^ -#endif // ^^^ !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORM) +#endif // ^^^ !defined(_DISABLE_STL_ANNOTATION) && !defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) ^^^ #ifdef _DISABLE_STL_ANNOTATION #ifdef _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS #error _ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS and _DISABLE_STL_ANNOTATION are mutually exclusive -#endif // ^^^ defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) +#endif // ^^^ defined(_ENABLE_STL_ANNOTATION_ON_UNSUPPORTED_PLATFORMS) ^^^ #ifndef _DISABLE_STRING_ANNOTATION #define _DISABLE_STRING_ANNOTATION -#endif // ^^^ !defined(_DISABLE_STRING_ANNOTATION) +#endif // ^^^ !defined(_DISABLE_STRING_ANNOTATION) ^^^ #ifndef _DISABLE_VECTOR_ANNOTATION #define _DISABLE_VECTOR_ANNOTATION -#endif // ^^^ !defined(_DISABLE_VECTOR_ANNOTATION) +#endif // ^^^ !defined(_DISABLE_VECTOR_ANNOTATION) ^^^ -#endif // ^^^ defined(_DISABLE_STL_ANNOTATION) +#endif // ^^^ defined(_DISABLE_STL_ANNOTATION) ^^^ #ifdef _ANNOTATE_STL #ifdef _ANNOTATE_STRING #define _ANNOTATE_STRING -#endif // ^^^ defined(_ANNOTATE_STRING) +#endif // ^^^ defined(_ANNOTATE_STRING) ^^^ #ifdef _ANNOTATE_VECTOR #define _ANNOTATE_VECTOR -#endif // ^^^ defined(_ANNOTATE_VECTOR) +#endif // ^^^ defined(_ANNOTATE_VECTOR) ^^^ -#endif // ^^^ defined(_ANNOTATE_STL) +#endif // ^^^ defined(_ANNOTATE_STL) ^^^ #ifdef __SANITIZE_ADDRESS__ @@ -78,41 +78,41 @@ _STL_DISABLE_CLANG_WARNINGS #pragma comment(linker, "/INFERASANLIBS") #endif // __has_feature(address_sanitizer) -#endif // ^^^ defined(__clang__) +#endif // ^^^ defined(__clang__) ^^^ #ifdef _DISABLE_STRING_ANNOTATION #undef _ACTIVATE_STRING_ANNOTATION #undef _INSERT_STRING_ANNOTATION -#endif // ^^^ defined(_DISABLE_STRING_ANNOTATION) +#endif // ^^^ defined(_DISABLE_STRING_ANNOTATION) ^^^ #ifdef _DISABLE_VECTOR_ANNOTATION #undef _ACTIVATE_VECTOR_ANNOTATION #undef _INSERT_VECTOR_ANNOTATION -#endif // ^^^ defined(_DISABLE_VECTOR_ANNOTATION) +#endif // ^^^ defined(_DISABLE_VECTOR_ANNOTATION) ^^^ #ifdef _ANNOTATE_STRING #define _INSERT_STRING_ANNOTATION -#endif // ^^^ defined(_ANNOTATE_STRING) +#endif // ^^^ defined(_ANNOTATE_STRING) ^^^ #ifdef _ANNOTATE_VECTOR #define _INSERT_VECTOR_ANNOTATION -#endif // ^^^ defined(_ANNOTATE_VECTOR) +#endif // ^^^ defined(_ANNOTATE_VECTOR) ^^^ #ifndef _INSERT_STRING_ANNOTATION #pragma detect_mismatch("annotate_string", "0") -#endif // ^^^ !defined(_INSERT_STRING_ANNOTATION) +#endif // ^^^ !defined(_INSERT_STRING_ANNOTATION) ^^^ #ifndef _INSERT_VECTOR_ANNOTATION #pragma detect_mismatch("annotate_vector", "0") -#endif // ^^^ !defined(_INSERT_VECTOR_ANNOTATION) +#endif // ^^^ !defined(_INSERT_VECTOR_ANNOTATION) ^^^ #ifdef _ACTIVATE_STRING_ANNOTATION #pragma comment(lib, "stl_asan") #pragma detect_mismatch("annotate_string", "1") -#endif // ^^^ defined(_ACTIVATE_STRING_ANNOTATION) +#endif // ^^^ defined(_ACTIVATE_STRING_ANNOTATION) ^^^ #ifdef _ACTIVATE_VECTOR_ANNOTATION #pragma comment(lib, "stl_asan") #pragma detect_mismatch("annotate_vector", "1") -#endif // ^^^ defined(_ACTIVATE_VECTOR_ANNOTATION) +#endif // ^^^ defined(_ACTIVATE_VECTOR_ANNOTATION) ^^^ #undef _ACTIVATE_STRING_ANNOTATION #undef _ACTIVATE_VECTOR_ANNOTATION @@ -165,7 +165,7 @@ void __cdecl __sanitizer_annotate_contiguous_container( #error Unknown architecture #endif // ^^^ unknown architecture ^^^ -#endif // ^^^ insert ASan annotations +#endif // ^^^ insert ASan annotations ^^^ #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS diff --git a/stl/msbuild/stl_base/libcp.settings.targets b/stl/msbuild/stl_base/libcp.settings.targets index 23f4ca72a5..0e03b8a714 100644 --- a/stl/msbuild/stl_base/libcp.settings.targets +++ b/stl/msbuild/stl_base/libcp.settings.targets @@ -27,7 +27,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception $(OutputLibPdbPath)$(OutputName)$(PdbVerName).pdb - $(ClDefines);_VCRT_ALLOW_INTERNALS;_ANNOTATE_VECTOR;_ANNOTATE_STRING + $(ClDefines);_VCRT_ALLOW_INTERNALS;_ANNOTATE_STL From a165c4edf57ba67a35121a9d561af099110e5b2e Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Mon, 2 Oct 2023 14:15:37 -0700 Subject: [PATCH 6/6] ifdef -> ifndef --- stl/inc/__msvc_sanitizer_annotate_container.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stl/inc/__msvc_sanitizer_annotate_container.hpp b/stl/inc/__msvc_sanitizer_annotate_container.hpp index 22cbed5a86..f0b27e0638 100644 --- a/stl/inc/__msvc_sanitizer_annotate_container.hpp +++ b/stl/inc/__msvc_sanitizer_annotate_container.hpp @@ -51,13 +51,13 @@ _STL_DISABLE_CLANG_WARNINGS #ifdef _ANNOTATE_STL -#ifdef _ANNOTATE_STRING +#ifndef _ANNOTATE_STRING #define _ANNOTATE_STRING -#endif // ^^^ defined(_ANNOTATE_STRING) ^^^ +#endif // ^^^ !defined(_ANNOTATE_STRING) ^^^ -#ifdef _ANNOTATE_VECTOR +#ifndef _ANNOTATE_VECTOR #define _ANNOTATE_VECTOR -#endif // ^^^ defined(_ANNOTATE_VECTOR) ^^^ +#endif // ^^^ !defined(_ANNOTATE_VECTOR) ^^^ #endif // ^^^ defined(_ANNOTATE_STL) ^^^