Skip to content

Commit

Permalink
Merge pull request #3744 from microsoft/main
Browse files Browse the repository at this point in the history
Merge `main` to `feature/mdspan2`
  • Loading branch information
StephanTLavavej authored Jun 1, 2023
2 parents 5e7a0f4 + c8d1efb commit 7a680e5
Show file tree
Hide file tree
Showing 48 changed files with 1,726 additions and 1,548 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ StatementMacros:
- _STD_END
- _STDEXT_BEGIN
- _STDEXT_END
- _FMT_P2286_BEGIN
- _FMT_P2286_END
- _EXTERN_C
- _END_EXTERN_C
- _EXTERN_C_UNLESS_PURE
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ set(VCLIBS_SUFFIX "_oss" CACHE STRING "suffix for built DLL names to avoid confl

option(STL_USE_ANALYZE "Pass the /analyze flag to MSVC" OFF)

set(VCLIBS_EXPLICIT_MACHINE "")

if("${VCLIBS_TARGET_ARCHITECTURE}" MATCHES "^x86$")
set(VCLIBS_TARGET_ARCHITECTURE "x86")
set(VCLIBS_I386_OR_AMD64 "i386")
Expand All @@ -71,6 +73,13 @@ elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64$")
set(VCLIBS_I386_OR_AMD64 "arm64")
set(VCLIBS_X86_OR_X64 "arm64")
add_compile_definitions(_ARM64_ _VCRT_WIN32_WINNT=0x0A00 _STL_WIN32_WINNT=0x0A00)
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64ec$")
set(VCLIBS_TARGET_ARCHITECTURE "arm64ec")
set(VCLIBS_I386_OR_AMD64 "arm64ec")
set(VCLIBS_X86_OR_X64 "arm64") # Yes, really: `%VCToolsInstallDir%lib\arm64ec` only contains the Link Options
add_compile_definitions(_AMD64_ _ARM64EC_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/arm64EC>)
set(VCLIBS_EXPLICIT_MACHINE "/machine:arm64ec")
else()
message(FATAL_ERROR "Could not determine target architecture: VCLIBS_TARGET_ARCHITECTURE: ${VCLIBS_TARGET_ARCHITECTURE}")
endif()
Expand Down
8 changes: 5 additions & 3 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ function(generate_satellite_def SATELLITE_NAME D_SUFFIX)
endfunction()

function(add_stl_dlls D_SUFFIX REL_OR_DBG)
set(link_options_Release "/LTCG;/opt:ref,icf")
set(link_options_Debug "/opt:ref,noicf")
set(link_options_Release "/LTCG;/opt:ref,icf;${VCLIBS_EXPLICIT_MACHINE}")
set(link_options_Debug "/opt:ref,noicf;${VCLIBS_EXPLICIT_MACHINE}")

set(gl_flag_Release "/GL")
set(gl_flag_Debug "")
Expand Down Expand Up @@ -653,7 +653,7 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG)
add_library(msvcp${D_SUFFIX}_implib STATIC ${HEADERS})
target_link_libraries(msvcp${D_SUFFIX}_implib stl_alias_objects msvcp${D_SUFFIX}_implib_objects)
add_dependencies(msvcp${D_SUFFIX}_implib msvcp${D_SUFFIX} msvcp_1${D_SUFFIX} msvcp_2${D_SUFFIX} msvcp${D_SUFFIX}_atomic_wait msvcp${D_SUFFIX}_codecvt_ids)
set_target_properties(msvcp${D_SUFFIX}_implib PROPERTIES STATIC_LIBRARY_OPTIONS "/NOLOGO;/NODEFAULTLIB;/IGNORE:4006;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_1${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_2${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_codecvt_ids>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_atomic_wait>")
set_target_properties(msvcp${D_SUFFIX}_implib PROPERTIES STATIC_LIBRARY_OPTIONS "/NOLOGO;/NODEFAULTLIB;/IGNORE:4006;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_1${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_2${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_codecvt_ids>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_atomic_wait>;${VCLIBS_EXPLICIT_MACHINE}")
set_target_properties(msvcp${D_SUFFIX}_implib PROPERTIES ARCHIVE_OUTPUT_NAME "msvcprt${D_SUFFIX}")
endfunction()

Expand All @@ -671,6 +671,7 @@ function(add_stl_statics FLAVOR_SUFFIX REL_OR_DBG IDL_VALUE)
target_compile_options(libcpmt${FLAVOR_SUFFIX} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/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})
set_target_properties(libcpmt${FLAVOR_SUFFIX} PROPERTIES STATIC_LIBRARY_OPTIONS "${VCLIBS_EXPLICIT_MACHINE}")
endfunction()

add_stl_statics("" Release 0)
Expand All @@ -680,6 +681,7 @@ add_stl_statics("d1" Debug 1)
add_stl_statics("d0" Debug 0)

add_library(stl_asan STATIC ${ASAN_SOURCES})
set_target_properties(stl_asan PROPERTIES STATIC_LIBRARY_OPTIONS "${VCLIBS_EXPLICIT_MACHINE}")

configure_file(set_environment.bat.in "${PROJECT_BINARY_DIR}/set_environment.bat" @ONLY)
configure_file(set_environment.ps1.in "${PROJECT_BINARY_DIR}/set_environment.ps1" @ONLY)
19 changes: 19 additions & 0 deletions stl/inc/__msvc_iter_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ _STL_DISABLE_CLANG_WARNINGS
#undef new

_STD_BEGIN
template <class _Ty, class _Alloc, class = void>
struct _Has_allocator_type : false_type {}; // tests for suitable _Ty::allocator_type

template <class _Ty, class _Alloc>
struct _Has_allocator_type<_Ty, _Alloc, void_t<typename _Ty::allocator_type>>
: is_convertible<_Alloc, typename _Ty::allocator_type>::type {};

_EXPORT_STD struct allocator_arg_t { // tag type for added allocator argument
explicit allocator_arg_t() = default;
};

_EXPORT_STD _INLINE_VAR constexpr allocator_arg_t allocator_arg{};

_EXPORT_STD template <class _Ty, class _Alloc>
struct uses_allocator : _Has_allocator_type<_Ty, _Alloc>::type {};

_EXPORT_STD template <class _Ty, class _Alloc>
_INLINE_VAR constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value;

// from <iterator>
_EXPORT_STD struct input_iterator_tag {};

Expand Down
10 changes: 10 additions & 0 deletions stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ _NODISCARD _CONSTEXPR23 from_chars_result _Integer_from_chars(

constexpr _Unsigned _Uint_max = static_cast<_Unsigned>(-1);
constexpr _Unsigned _Int_max = static_cast<_Unsigned>(_Uint_max >> 1);
#pragma warning(push)
#pragma warning(disable : 26450) // TRANSITION, VSO-1828677
constexpr _Unsigned _Abs_int_min = static_cast<_Unsigned>(_Int_max + 1);
#pragma warning(pop)

_Unsigned _Risky_val;
_Unsigned _Max_digit;
Expand Down Expand Up @@ -395,7 +398,11 @@ _EXPORT_STD _CONSTEXPR23 from_chars_result from_chars(const char* const _First,
// - Otherwise, no initialization is performed."
// Therefore, _Mydata's elements are not initialized.
struct _Big_integer_flt {
#pragma warning(push)
#pragma warning(disable : 26495) // Variable 'std::_Big_integer_flt::_Mydata' is uninitialized.
// Always initialize a member variable (type.6).
_Big_integer_flt() noexcept : _Myused(0) {}
#pragma warning(pop)

_Big_integer_flt(const _Big_integer_flt& _Other) noexcept : _Myused(_Other._Myused) {
_CSTD memcpy(_Mydata, _Other._Mydata, _Other._Myused * sizeof(uint32_t));
Expand Down Expand Up @@ -1020,7 +1027,10 @@ _NODISCARD inline uint64_t _Right_shift_with_rounding(
constexpr uint32_t _Total_number_of_bits = 64;
if (_Shift >= _Total_number_of_bits) {
if (_Shift == _Total_number_of_bits) {
#pragma warning(push)
#pragma warning(disable : 26454) // TRANSITION, VSO-1826196
constexpr uint64_t _Extra_bits_mask = (1ULL << (_Total_number_of_bits - 1)) - 1;
#pragma warning(pop)
constexpr uint64_t _Round_bit_mask = (1ULL << (_Total_number_of_bits - 1));

const bool _Round_bit = (_Value & _Round_bit_mask) != 0;
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -4145,7 +4145,7 @@ namespace chrono {
--_Width;
}

char _Ac[_MAX_INT_DIG];
char _Ac[_Max_int_dig];
char* _Ptr = _Ac;
if (_First != _Last && _Width > 0) {
const char _Ch = _Ctype_fac.narrow(*_First);
Expand Down
2 changes: 2 additions & 0 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ public:
: _Mypair(_One_then_variadic_args_t{}, _Al) {
_Alproxy_ty _Alproxy(_Getal());
_Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data());
_Tidy_guard<deque> _Guard{this};
resize(_Count);
_Guard._Target = nullptr;
_Proxy._Release();
}

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/exception
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ private:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif // __clang__
void* _Data1;
void* _Data2;
void* _Data1{};
void* _Data2{};
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
Expand Down
Loading

0 comments on commit 7a680e5

Please sign in to comment.