Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<mdspan>: Remove some C28020 warning suppressions #3690

Merged
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
9 changes: 0 additions & 9 deletions stl/inc/mdspan
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ public:
&& (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...)
&& (sizeof...(_OtherIndexTypes) == rank_dynamic() || sizeof...(_OtherIndexTypes) == rank())
constexpr explicit extents(_OtherIndexTypes... _Exts) noexcept {
#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
if constexpr ((_Is_standard_integer<_OtherIndexTypes> && ...)) {
_STL_VERIFY(sizeof...(_Exts) == 0 || ((_Exts >= 0 && _STD in_range<index_type>(_Exts)) && ...),
"Either sizeof...(exts) must be equal to 0 or each element of exts must be nonnegative and must be "
Expand All @@ -170,7 +168,6 @@ public:
}
}
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?
}

template <class _OtherIndexType, size_t _Size, size_t... _Indices>
Expand Down Expand Up @@ -594,8 +591,6 @@ public:
"If Extents::rank_dynamic() == 0 is true, then the size of the multidimensional index space Extents() must be "
"representable as a value of type typename Extents::index_type (N4944 [mdspan.layout.stride.overview]/4).");

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
constexpr mapping() noexcept : _Exts(extents_type{}) {
if constexpr (extents_type::rank() != 0) {
_Strides.back() = 1;
Expand All @@ -605,7 +600,6 @@ public:
}
}
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

constexpr mapping(const mapping&) noexcept = default;

Expand Down Expand Up @@ -682,8 +676,6 @@ public:
return _Strides;
}

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
_NODISCARD constexpr index_type required_span_size() const noexcept {
if constexpr (extents_type::rank() == 0) {
return 1;
Expand All @@ -701,7 +693,6 @@ public:
return _Result;
}
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

template <class... _IndexTypes>
requires (sizeof...(_IndexTypes) == extents_type::rank()) && (is_convertible_v<_IndexTypes, index_type> && ...)
Expand Down
6 changes: 3 additions & 3 deletions tests/std/tests/P0009R18_mdspan_layout_left/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ constexpr void check_members(const extents<IndexType, Extents...>& ext, index_se
// Other tests are defined in 'check_construction_from_other_right_mapping' function
}

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
{ // Check construction from layout_stride::mapping
array<IndexType, Ext::rank()> strides{};
if constexpr (Ext::rank() > 0) {
strides.front() = 1;
for (size_t i = 1; i < Ext::rank(); ++i) {
#pragma warning(push)
#pragma warning(disable : 28020) // TRANSITION, DevCom-923103
strides[i] = static_cast<IndexType>(strides[i - 1] * ext.extent(i - 1));
#pragma warning(pop)
}
}

Expand All @@ -91,7 +92,6 @@ constexpr void check_members(const extents<IndexType, Extents...>& ext, index_se
[[maybe_unused]] Mapping m{stride_mapping};
// Other tests are defined in 'check_construction_from_other_stride_mapping' function
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

Mapping m{ext}; // For later use

Expand Down
3 changes: 0 additions & 3 deletions tests/std/tests/P0009R18_mdspan_layout_left_death/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ void test_construction_from_other_right_mapping() {
layout_left::mapping<dextents<unsigned char, 1>> m2{m1};
}

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
void test_construction_from_other_stride_mapping_1() {
using Ext = extents<int, 2, 4>;
layout_stride::mapping<Ext> m1{Ext{}, array{1, 1}};
Expand All @@ -39,7 +37,6 @@ void test_construction_from_other_stride_mapping_2() {
// Value of other.required_span_size() must be representable as a value of type index_type
layout_left::mapping<dextents<unsigned char, 1>> m2{m1};
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

void test_stride_function() {
layout_left::mapping<extents<int, 3>> m;
Expand Down
3 changes: 0 additions & 3 deletions tests/std/tests/P0009R18_mdspan_layout_right_death/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ void test_construction_from_other_left_mapping() {
layout_right::mapping<dextents<unsigned char, 1>> m2{m1};
}

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
void test_construction_from_other_stride_mapping_1() {
using Ext = extents<int, 2, 4>;
layout_stride::mapping<Ext> m1{Ext{}, array{3, 1}};
Expand All @@ -39,7 +37,6 @@ void test_construction_from_other_stride_mapping_2() {
// Value of other.required_span_size() must be representable as a value of type index_type
layout_right::mapping<dextents<unsigned char, 1>> m2{m1};
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

void test_stride_function() {
layout_right::mapping<extents<int, 3>> m;
Expand Down
6 changes: 3 additions & 3 deletions tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ constexpr void do_check_members(const extents<IndexType, Extents...>& ext,
static_assert(same_as<typename Mapping::rank_type, typename Ext::rank_type>);
static_assert(same_as<typename Mapping::layout_type, layout_stride>);

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
{ // Check default and copy constructor
Mapping m;
const Mapping cpy = m;
Expand Down Expand Up @@ -127,7 +125,10 @@ constexpr void do_check_members(const extents<IndexType, Extents...>& ext,
{ // Check 'stride' function
for (size_t i = 0; i < strs.size(); ++i) {
same_as<IndexType> decltype(auto) s = m.stride(i);
#pragma warning(push)
#pragma warning(disable : 28020) // TRANSITION, DevCom-923103
assert(cmp_equal(strs[i], s));
#pragma warning(pop)
}
}

Expand All @@ -136,7 +137,6 @@ constexpr void do_check_members(const extents<IndexType, Extents...>& ext,
assert(!(m != m));
// Other tests are defined in 'check_comparisons' function [FIXME]
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?
}

template <class StridesIndexType, class IndexType, size_t... Extents>
Expand Down
3 changes: 0 additions & 3 deletions tests/std/tests/P0009R18_mdspan_layout_stride_death/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

using namespace std;

#pragma warning(push) // TRANSITION, "/analyze:only" BUG?
#pragma warning(disable : 28020) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call
void test_construction_from_extents_and_array() {
// Value of s[i] must be greater than 0 for all i in the range [0, rank_)
[[maybe_unused]] layout_stride::mapping<dextents<int, 1>> m1{extents<int, 1>{}, array<int, 1>{-1}};
Expand All @@ -28,7 +26,6 @@ void test_construction_from_strided_layout_mapping() {
// Value of other.required_span_size() must be representable as a value of type index_type
[[maybe_unused]] layout_stride::mapping<dextents<unsigned char, 1>> m2{m1};
}
#pragma warning(pop) // TRANSITION, "/analyze:only" BUG?

int main(int argc, char* argv[]) {
std_testing::death_test_executive exec;
Expand Down