Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -4344,7 +4344,6 @@ namespace ranges {
constexpr bool _Allow_vectorization =
conjunction_v<_Is_trivially_swappable<_Elem>, negation<is_volatile<_Elem>>>;

#pragma warning(suppress : 6326) // Potential comparison of a constant with another constant
if constexpr (_Allow_vectorization && _Nx <= 8 && (_Nx & (_Nx - 1)) == 0) {
if (!_STD is_constant_evaluated()) {
_Elem* const _First_addr = _STD to_address(_First);
Expand Down Expand Up @@ -4414,7 +4413,6 @@ _CONSTEXPR20 _OutIt reverse_copy(_BidIt _First, _BidIt _Last, _OutIt _Dest) {
negation<is_volatile<_Elem>>>;
constexpr size_t _Nx = sizeof(_Elem);

#pragma warning(suppress : 6326) // Potential comparison of a constant with another constant
if constexpr (_Allow_vectorization && _Nx <= 8 && (_Nx & (_Nx - 1)) == 0) {
#if _HAS_CXX20
if (!_STD is_constant_evaluated())
Expand Down Expand Up @@ -4503,7 +4501,6 @@ namespace ranges {
is_trivially_copyable<_Elem>, negation<is_volatile<_Elem>>>;
constexpr size_t _Nx = sizeof(_Elem);

#pragma warning(suppress : 6326) // Potential comparison of a constant with another constant
if constexpr (_Allow_vectorization && _Nx <= 8 && (_Nx & (_Nx - 1)) == 0) {
if (!_STD is_constant_evaluated()) {
_Elem* const _First_addr = _STD to_address(_First);
Expand Down
9 changes: 6 additions & 3 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept {
#endif // x86/x64
#endif // hardware

#pragma warning(push)
#pragma warning(disable : 6001) // "Using uninitialized memory '_Guard'"
#pragma warning(disable : 28113) // "Accessing a local variable _Guard via an Interlocked function: This is an unusual
// usage which could be reconsidered."
extern "C" inline void _Atomic_thread_fence(const unsigned int _Order) noexcept {
if (_Order == _Atomic_memory_order_relaxed) {
return;
Expand All @@ -208,9 +212,6 @@ extern "C" inline void _Atomic_thread_fence(const unsigned int _Order) noexcept
// _mm_mfence could have been used, but it is not supported on older x86 CPUs and is slower on some recent CPUs.
// The memory fence provided by interlocked operations has some exceptions, but this is fine:
// std::atomic_thread_fence works with respect to other atomics only; it may not be a full fence for all ops.
#pragma warning(suppress : 6001) // "Using uninitialized memory '_Guard'"
#pragma warning(suppress : 28113) // "Accessing a local variable _Guard via an Interlocked function: This is an unusual
// usage which could be reconsidered."
(void) _InterlockedIncrement(&_Guard);
_Compiler_barrier();
}
Expand All @@ -220,6 +221,8 @@ extern "C" inline void _Atomic_thread_fence(const unsigned int _Order) noexcept
#error Unsupported hardware
#endif // unsupported hardware
}
#pragma warning(pop)

// End of code shared with vcruntime

_EXTERN_C
Expand Down
10 changes: 6 additions & 4 deletions stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,8 @@ private:
_Format_arg_index _Index_array[_Num_args];
unsigned char _Storage[_Storage_length];

#pragma warning(push)
#pragma warning(disable : 6386) // Buffer overrun while writing to '%s' ...
template <class _Ty>
void _Store_impl(
const size_t _Arg_index, const _Basic_format_arg_type _Arg_type, const type_identity_t<_Ty>& _Val) noexcept {
Expand All @@ -1841,10 +1843,10 @@ private:
_Index_array[_Arg_index]._Type(_Arg_type);
if (_Arg_index + 1 < _Num_args) {
// Set the starting index of the next arg, as that is dynamic, must be called with increasing index
#pragma warning(suppress : 6386) // Buffer overrun while writing to '%s' ...
_Index_array[_Arg_index + 1] = _Format_arg_index{_Store_index + sizeof(_Ty)};
}
}
#pragma warning(pop)

template <class _Ty>
void _Store(const size_t _Arg_index, _Ty&& _Val) noexcept {
Expand Down Expand Up @@ -2562,6 +2564,8 @@ template <class _CharT, class _OutputIt>
_NODISCARD _OutputIt _Fmt_write(
_OutputIt _Out, basic_string_view<_CharT> _Value, const _Basic_format_specs<_CharT>& _Specs, _Lazy_locale);

#pragma warning(push)
#pragma warning(disable : 4296) // '<': expression is always false
template <class _CharT, class _OutputIt, integral _Integral>
_NODISCARD _OutputIt _Write_integral(
_OutputIt _Out, const _Integral _Value, _Basic_format_specs<_CharT> _Specs, _Lazy_locale _Locale) {
Expand Down Expand Up @@ -2642,10 +2646,7 @@ _NODISCARD _OutputIt _Write_integral(

const bool _Write_leading_zeroes = _Specs._Leading_zero && _Specs._Alignment == _Fmt_align::_None;
auto _Writer = [&, _End = _End](_OutputIt _Out) {
#pragma warning(push)
#pragma warning(disable : 4296) // '<': expression is always false
_Out = _Write_sign(_STD move(_Out), _Specs._Sgn, _Value < _Integral{0});
#pragma warning(pop)
_Out = _RANGES transform(_Prefix, _STD move(_Out), _Widen_char<_CharT>{}).out;
if (_Write_leading_zeroes && _Width < _Specs._Width) {
_Out = _RANGES fill_n(_STD move(_Out), _Specs._Width - _Width, _CharT{'0'});
Expand All @@ -2665,6 +2666,7 @@ _NODISCARD _OutputIt _Write_integral(

return _Write_aligned(_STD move(_Out), _Width, _Specs, _Fmt_align::_Right, _Writer);
}
#pragma warning(pop)

// clang-format off
template <class _CharT, class _OutputIt, integral _Integral>
Expand Down
5 changes: 3 additions & 2 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -1281,22 +1281,23 @@ namespace ranges {
}
}

#pragma warning(push)
#pragma warning(disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
// clang-format off
_NODISCARD constexpr auto size() const noexcept(noexcept(_Bound - _Value)) /* strengthened */
requires (same_as<_Wi, _Bo> && _Advanceable<_Wi>)
|| (_Integer_like<_Wi> && _Integer_like<_Bo>)
|| sized_sentinel_for<_Bo, _Wi> {
// clang-format on
if constexpr (_Integer_like<_Wi> && _Integer_like<_Bo>) {
#pragma warning(suppress : 4146) // unary minus operator applied to unsigned type, result still unsigned
return (_Value < 0) ? ((_Bound < 0) ? (_To_unsigned_like(-_Value) - _To_unsigned_like(-_Bound))
#pragma warning(suppress : 4146) // unary minus operator applied to unsigned type, result still unsigned
: (_To_unsigned_like(_Bound) + _To_unsigned_like(-_Value)))
: (_To_unsigned_like(_Bound) - _To_unsigned_like(_Value));
} else {
return _To_unsigned_like(_Bound - _Value);
}
}
#pragma warning(pop)
};

// clang-format off
Expand Down
4 changes: 1 addition & 3 deletions stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -4475,12 +4475,10 @@ inline void _Calculate_loop_simplicity(_Node_base* _Nx, _Node_base* _Ne, _Node_r
case _N_end_rep:
if (_Outer_rep == static_cast<_Node_end_rep*>(_Nx)->_Begin_rep) {
// if the _Node_rep is still undetermined when we reach its end, it is simple
#pragma warning(push)
#pragma warning(disable : 6011) // Dereferencing NULL pointer
_Analysis_assume_(_Outer_rep);
if (_Outer_rep->_Simple_loop == -1) {
_Outer_rep->_Simple_loop = 1;
}
#pragma warning(pop)
_Outer_rep = nullptr;
}
break;
Expand Down
9 changes: 6 additions & 3 deletions stl/inc/span
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,16 @@ public:
return _Mysize;
}

#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
_NODISCARD constexpr size_type size_bytes() const noexcept {
#if _CONTAINER_DEBUG_LEVEL > 0
#pragma warning(suppress : 4127) // conditional expression is constant
_STL_VERIFY(_Mysize <= dynamic_extent / sizeof(element_type),
"size of span in bytes exceeds std::numeric_limits<size_t>::max()");
#endif // _CONTAINER_DEBUG_LEVEL > 0
return _Mysize * sizeof(element_type);
}
#pragma warning(pop)

_NODISCARD constexpr bool empty() const noexcept {
return _Mysize == 0;
Expand All @@ -575,21 +577,22 @@ public:
return _Mydata[_Off];
}

#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
_NODISCARD constexpr reference front() const noexcept /* strengthened */ {
#if _CONTAINER_DEBUG_LEVEL > 0
#pragma warning(suppress : 4127) // conditional expression is constant
_STL_VERIFY(_Mysize > 0, "front of empty span");
#endif // _CONTAINER_DEBUG_LEVEL > 0
return _Mydata[0];
}

_NODISCARD constexpr reference back() const noexcept /* strengthened */ {
#if _CONTAINER_DEBUG_LEVEL > 0
#pragma warning(suppress : 4127) // conditional expression is constant
_STL_VERIFY(_Mysize > 0, "back of empty span");
#endif // _CONTAINER_DEBUG_LEVEL > 0
return _Mydata[_Mysize - 1];
}
#pragma warning(pop)

_NODISCARD constexpr pointer data() const noexcept {
return _Mydata;
Expand Down
8 changes: 3 additions & 5 deletions stl/inc/thread
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,16 @@ private:
return &_Invoke<_Tuple, _Indices...>;
}

#pragma warning(push) // pointer or reference to potentially throwing function passed to 'extern "C"' function under
#pragma warning(disable : 5039) // -EHc. Undefined behavior may occur if this function throws an exception. (/Wall)
template <class _Fn, class... _Args>
void _Start(_Fn&& _Fx, _Args&&... _Ax) {
using _Tuple = tuple<decay_t<_Fn>, decay_t<_Args>...>;
auto _Decay_copied = _STD make_unique<_Tuple>(_STD forward<_Fn>(_Fx), _STD forward<_Args>(_Ax)...);
constexpr auto _Invoker_proc = _Get_invoke<_Tuple>(make_index_sequence<1 + sizeof...(_Args)>{});

#pragma warning(push)
#pragma warning(disable : 5039) // pointer or reference to potentially throwing function passed to
// extern C function under -EHc. Undefined behavior may occur
// if this function throws an exception. (/Wall)
_Thr._Hnd =
reinterpret_cast<void*>(_CSTD _beginthreadex(nullptr, 0, _Invoker_proc, _Decay_copied.get(), 0, &_Thr._Id));
#pragma warning(pop)

if (_Thr._Hnd) { // ownership transferred to the thread
(void) _Decay_copied.release();
Expand All @@ -83,6 +80,7 @@ private:
_Throw_Cpp_error(_RESOURCE_UNAVAILABLE_TRY_AGAIN);
}
}
#pragma warning(pop)

public:
template <class _Fn, class... _Args, enable_if_t<!is_same_v<_Remove_cvref_t<_Fn>, thread>, int> = 0>
Expand Down
4 changes: 3 additions & 1 deletion stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -4294,6 +4294,8 @@ public:
}

#if _HAS_CXX23
#pragma warning(push)
#pragma warning(disable : 4018) // '<=': signed/unsigned mismatch (we compare to 0 before _New_size below, so it's safe)
template <class _Operation>
constexpr void resize_and_overwrite(_CRT_GUARDOVERFLOW const size_type _New_size, _Operation _Op) {
if (_Mypair._Myval2._Myres < _New_size) {
Expand All @@ -4306,11 +4308,11 @@ public:
const auto _Result_size = _STD move(_Op)(_Mypair._Myval2._Myptr(), _New_size);
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(_Result_size >= 0, "the returned size can't be smaller than 0");
#pragma warning(suppress : 4018) // '<=': signed/unsigned mismatch, we already compared with 0, so it's safe
_STL_VERIFY(_Result_size <= _New_size, "the returned size can't be greater than the passed size");
#endif // _CONTAINER_DEBUG_LEVEL > 0
_Eos(static_cast<size_type>(_Result_size));
}
#pragma warning(pop)
#endif // _HAS_CXX23

_NODISCARD _CONSTEXPR20 size_type capacity() const noexcept {
Expand Down
1 change: 0 additions & 1 deletion stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -5479,7 +5479,6 @@ _CONSTEXPR20 void reverse(const _BidIt _First, const _BidIt _Last) { // reverse
_Is_trivially_swappable<_Elem>, negation<is_volatile<_Elem>>>;
constexpr size_t _Nx = sizeof(_Elem);

#pragma warning(suppress : 6326) // Potential comparison of a constant with another constant
if constexpr (_Allow_vectorization && _Nx <= 8 && (_Nx & (_Nx - 1)) == 0) {
#if _HAS_CXX20
if (!_STD is_constant_evaluated())
Expand Down