Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej committed May 16, 2022
1 parent 313aa59 commit f9d1af0
Show file tree
Hide file tree
Showing 9 changed files with 2,408 additions and 212 deletions.
4 changes: 2 additions & 2 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,11 @@ add_stl_dlls("d" "_DEBUG" "${VCLIBS_DEBUG_OPTIONS}" "" "/opt:ref,noicf")

function(add_stl_statics FLAVOR_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIONS)
add_library(libcpmt${FLAVOR_SUFFIX}_eha OBJECT ${EHA_SOURCES})
target_compile_definitions(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR")
target_compile_definitions(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR;_ANNOTATE_STRING")
target_compile_options(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};/EHa")

add_library(libcpmt${FLAVOR_SUFFIX} STATIC ${HEADERS} ${IMPLIB_SOURCES} ${SOURCES} ${INITIALIZER_SOURCES} ${STATIC_SOURCES})
target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR")
target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR;_ANNOTATE_STRING")
target_compile_options(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};/EHsc")
target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::math libcpmt${FLAVOR_SUFFIX}_eha)
endfunction()
Expand Down
6 changes: 2 additions & 4 deletions stl/inc/sstream
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ public:
// the buffer is full
_Result.assign(_View._Ptr, _View._Size);
} else {
_Traits::assign(_View._Ptr[_View._Size], _Elem());
if (_Result._Move_assign_from_buffer(_View._Ptr, _View._Size, _View._Res)) {
_Mystate &= ~_Allocated;
}
Expand Down Expand Up @@ -428,9 +427,8 @@ protected:
_Xbad_alloc();
}

if (_Count != 0
&& (_State & (_Noread | _Constant))
!= (_Noread | _Constant)) { // finite buffer that can be read or written, set it up
if (_Count != 0 && (_State & (_Noread | _Constant)) != (_Noread | _Constant)) {
// finite buffer that can be read or written, set it up
const auto _Pnew = _Unfancy(_Al.allocate(_Count));
_Traits::copy(_Pnew, _Ptr, _Count);
_Seekhigh = _Pnew + _Count;
Expand Down
720 changes: 515 additions & 205 deletions stl/inc/xstring

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion stl/msbuild/stl_base/libcp.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<PropertyGroup>
<ClProgramDataBaseFileName>$(OutputLibPdbPath)$(OutputName)$(PdbVerName).pdb</ClProgramDataBaseFileName>
<ClDefines Condition="'$(DependsOnConcRT)' == 'true'">$(ClDefines);_STL_CONCRT_SUPPORT</ClDefines>
<ClDefines>$(ClDefines);_VCRT_ALLOW_INTERNALS;_ANNOTATE_VECTOR</ClDefines>
<ClDefines>$(ClDefines);_VCRT_ALLOW_INTERNALS;_ANNOTATE_VECTOR;_ANNOTATE_STRING</ClDefines>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)\stl.files.settings.targets"/>
Expand Down
1 change: 1 addition & 0 deletions stl/src/asan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace std {
extern "C" {
extern const bool _Asan_string_should_annotate = true;
extern const bool _Asan_vector_should_annotate = true;
}
} // namespace std
1 change: 1 addition & 0 deletions stl/src/asan_noop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

extern "C" {
extern const bool _Asan_string_should_annotate_default = false;
extern const bool _Asan_vector_should_annotate_default = false;

void __cdecl __sanitizer_annotate_contiguous_container_default(
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ tests\GH_001850_clog_tied_to_cout
tests\GH_001858_iostream_exception
tests\GH_001914_cached_position
tests\GH_001964_constexpr_generate_canonical
tests\GH_002030_asan_annotate_string
tests\GH_002030_asan_annotate_vector
tests\GH_002039_byte_is_not_trivially_swappable
tests\GH_002058_debug_iterator_race
Expand Down
60 changes: 60 additions & 0 deletions tests/std/tests/GH_002030_asan_annotate_string/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# This test matrix is the usual test matrix, with all currently unsupported options removed, crossed with the ASan flags.
# TRANSITION, VSO-1350252
# Due to a bug in the ASan libs using ASan with /MD or /MT requires IDL==0 and using /MDd or /MTd requires IDL==2.
# clang-cl does not currently support targeting /MDd or /MTd.
RUNALL_INCLUDE ..\prefix.lst
RUNALL_CROSSLIST
PM_CL="/Zi /wd4611 /w14640 /Zc:threadSafeInit-" PM_LINK="/debug"
RUNALL_CROSSLIST
PM_CL="-fsanitize=address /BE /c /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /BE /c /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /BE /c /EHsc /MT /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /BE /c /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MD /std:c++17 /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MD /std:c++20 /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MDd /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /fp:strict /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /Za /EHsc /MD /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="-fsanitize=address /Za /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MT /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++17 /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++20 /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MT /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive- /fp:strict /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /Za /EHsc /MD /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
PM_CL="/D_ANNOTATE_STRING /Za /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib"
# TRANSITION, clang-cl does not support /alternatename so we cannot test /D_ANNOTATE_STRING without -fsanitize=address
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14"
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++17"
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive-"
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive- /D_HAS_CXX23 /fp:strict"
Loading

0 comments on commit f9d1af0

Please sign in to comment.