diff --git a/stl/inc/__msvc_int128.hpp b/stl/inc/__msvc_int128.hpp index 56b0b4371e6..0018edbf674 100644 --- a/stl/inc/__msvc_int128.hpp +++ b/stl/inc/__msvc_int128.hpp @@ -10,10 +10,11 @@ #include #if _STL_COMPILER_PREPROCESSOR #include -#include _STL_INTRIN_HEADER #include #include +#include _STL_INTRIN_HEADER + #if _HAS_CXX20 #include #include diff --git a/stl/inc/bit b/stl/inc/bit index b4ecd911d05..cf2e52705b8 100644 --- a/stl/inc/bit +++ b/stl/inc/bit @@ -12,11 +12,12 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); #else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv -#include _STL_INTRIN_HEADER #include #include #include +#include _STL_INTRIN_HEADER + #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) diff --git a/stl/inc/charconv b/stl/inc/charconv index c26313fb9b3..4393c7dd217 100644 --- a/stl/inc/charconv +++ b/stl/inc/charconv @@ -13,13 +13,14 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++17 or later."); #else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv #include -#include _STL_INTRIN_HEADER #include #include #include #include #include +#include _STL_INTRIN_HEADER + #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) diff --git a/stl/inc/limits b/stl/inc/limits index 01e0f119c50..3617866926e 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -11,10 +11,11 @@ #include #include #include -#include _STL_INTRIN_HEADER #include #include +#include _STL_INTRIN_HEADER + // TRANSITION, GH-2129, move down to _Arm64_popcount #if (defined(_M_ARM64) || defined(_M_ARM64EC)) && !defined(_M_CEE_PURE) && !defined(__CUDACC__) \ && !defined(__INTEL_COMPILER) && !defined(__clang__) // TRANSITION, LLVM-51488 diff --git a/stl/inc/memory_resource b/stl/inc/memory_resource index 16d8d0c9756..b008571c42a 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -576,18 +576,18 @@ namespace pmr { void release() noexcept /* strengthened */ { lock_guard _Guard{_Mtx}; - this->unsynchronized_pool_resource::release(); + unsynchronized_pool_resource::release(); } protected: void* do_allocate(const size_t _Bytes, const size_t _Align) override { lock_guard _Guard{_Mtx}; - return this->unsynchronized_pool_resource::do_allocate(_Bytes, _Align); + return unsynchronized_pool_resource::do_allocate(_Bytes, _Align); } void do_deallocate(void* const _Ptr, const size_t _Bytes, const size_t _Align) override { lock_guard _Guard{_Mtx}; - this->unsynchronized_pool_resource::do_deallocate(_Ptr, _Bytes, _Align); + unsynchronized_pool_resource::do_deallocate(_Ptr, _Bytes, _Align); } private: diff --git a/stl/inc/ranges b/stl/inc/ranges index 66e94c498ad..5469647071b 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -3549,6 +3549,17 @@ namespace ranges { _EXPORT_STD inline constexpr _Drop_while_fn drop_while; } // namespace views +#ifdef __clang__ + template // TRANSITION, LLVM-47414 + concept _Can_const_join = forward_range && is_reference_v> + && input_range>; +#endif // ^^^ workaround ^^^ + + template + _NODISCARD constexpr _Ty& _As_lvalue(_Ty&& _Val) noexcept { + return static_cast<_Ty&>(_Val); + } + _EXPORT_STD template requires view<_Vw> && input_range> class join_view; @@ -3569,17 +3580,6 @@ namespace ranges { /* [[no_unique_address]] */ _Non_propagating_cache<_Cache_wrapper, false> _Inner{}; }; -#ifdef __clang__ - template // TRANSITION, LLVM-47414 - concept _Can_const_join = forward_range && is_reference_v> - && input_range>; -#endif // ^^^ workaround ^^^ - - template - _NODISCARD constexpr _Ty& _As_lvalue(_Ty&& _Val) noexcept { - return static_cast<_Ty&>(_Val); - } - template requires is_reference_v> class _Join_view_base<_Vw> : public view_interface> {}; diff --git a/stl/inc/regex b/stl/inc/regex index 4e7cc0036e0..aa1974d47e1 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -628,7 +628,7 @@ public: } void swap(sub_match& _Other) noexcept(_Is_nothrow_swappable<_BidIt>::value) { - this->_Mybase::swap(_Other); + _Mybase::swap(_Other); _STD swap(matched, _Other.matched); } diff --git a/stl/inc/type_traits b/stl/inc/type_traits index cd40abc7795..679c42f7a18 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -1610,7 +1610,7 @@ _CONSTEXPR17 auto invoke(_Callable&& _Obj, _Ty1&& _Arg1, _Types2&&... _Args2) no } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_refwrap) { return _Arg1.get().*_Obj; } else { - static_assert(_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_pointer, "bug in invoke"); + _STL_INTERNAL_STATIC_ASSERT(_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_pointer); return (*static_cast<_Ty1&&>(_Arg1)).*_Obj; } } diff --git a/stl/inc/xatomic.h b/stl/inc/xatomic.h index d6924b29ff5..83ca9def6f8 100644 --- a/stl/inc/xatomic.h +++ b/stl/inc/xatomic.h @@ -9,9 +9,10 @@ #include #if _STL_COMPILER_PREPROCESSOR -#include _STL_INTRIN_HEADER #include +#include _STL_INTRIN_HEADER + #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) diff --git a/stl/inc/xbit_ops.h b/stl/inc/xbit_ops.h index d7075cc2980..a46e3cdfb9c 100644 --- a/stl/inc/xbit_ops.h +++ b/stl/inc/xbit_ops.h @@ -10,6 +10,7 @@ #if _STL_COMPILER_PREPROCESSOR #include + #include _STL_INTRIN_HEADER #pragma pack(push, _CRT_PACKING) diff --git a/stl/inc/xcharconv_ryu.h b/stl/inc/xcharconv_ryu.h index 70ab5338355..8a7d22910fb 100644 --- a/stl/inc/xcharconv_ryu.h +++ b/stl/inc/xcharconv_ryu.h @@ -1318,7 +1318,7 @@ _NODISCARD pair<_CharT*, errc> __to_chars(_CharT* const _First, _CharT* const _L chars_format _Fmt, const uint32_t __ieeeMantissa, const uint32_t __ieeeExponent) { // Step 5: Print the decimal representation. uint32_t _Output = __v.__mantissa; - int32_t _Ryu_exponent = __v.__exponent; + const int32_t _Ryu_exponent = __v.__exponent; const uint32_t __olength = __decimalLength9(_Output); int32_t _Scientific_exponent = _Ryu_exponent + static_cast(__olength) - 1; @@ -1926,7 +1926,7 @@ _NODISCARD pair<_CharT*, errc> __to_chars(_CharT* const _First, _CharT* const _L chars_format _Fmt, const double __f) { // Step 5: Print the decimal representation. uint64_t _Output = __v.__mantissa; - int32_t _Ryu_exponent = __v.__exponent; + const int32_t _Ryu_exponent = __v.__exponent; const uint32_t __olength = __decimalLength17(_Output); int32_t _Scientific_exponent = _Ryu_exponent + static_cast(__olength) - 1; diff --git a/stl/inc/xutility b/stl/inc/xutility index 74782010400..13b78725526 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -375,7 +375,7 @@ struct _Ref_fn { // pass function object by value as a reference }; template -constexpr auto _Pass_fn(_Fn& _Func) noexcept { +_NODISCARD constexpr auto _Pass_fn(_Fn& _Func) noexcept { constexpr bool _Pass_by_value = conjunction_v, is_trivially_copy_constructible<_Fn>, is_trivially_destructible<_Fn>>; if constexpr (_Pass_by_value) { diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index de405dd6cfb..e1d4375f473 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -39,7 +39,9 @@ namespace Concurrency { #if (defined(_M_IX86) || defined(_M_X64)) && !defined(_CRT_APP) if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE)) #endif + { __fastfail(FAST_FAIL_INVALID_ARG); + } std::terminate(); } diff --git a/stl/src/xmath.hpp b/stl/src/xmath.hpp index 67528bdd35f..eafcb9cef1e 100644 --- a/stl/src/xmath.hpp +++ b/stl/src/xmath.hpp @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef _XMATH -#define _XMATH +#pragma once + #include #include #include @@ -205,5 +205,3 @@ template #ifndef _M_CEE_PURE #pragma float_control(pop) #endif - -#endif // _XMATH diff --git a/stl/src/xmtx.hpp b/stl/src/xmtx.hpp index 9380716a3c0..44eb904eba5 100644 --- a/stl/src/xmtx.hpp +++ b/stl/src/xmtx.hpp @@ -2,19 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #pragma once -#ifndef _XMTX -#define _XMTX + #include #include #include -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, 3) -#pragma push_macro("new") -#undef new - _EXTERN_C_UNLESS_PURE using _Rmtx = CRITICAL_SECTION; @@ -33,8 +27,3 @@ _MRTIMP2 void __cdecl _Mtxunlock(_Rmtx*) noexcept; #endif // _M_CEE_PURE _END_EXTERN_C_UNLESS_PURE - -#pragma pop_macro("new") -#pragma warning(pop) -#pragma pack(pop) -#endif // _XMTX