From 4bd089bd7b227519159d68c6d08a6a8b4025815d Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Thu, 11 May 2023 07:53:02 +0200 Subject: [PATCH] ``: Remove some C28020 warning suppressions (#3690) Co-authored-by: Stephan T. Lavavej --- stl/inc/mdspan | 9 --------- tests/std/tests/P0009R18_mdspan_layout_left/test.cpp | 6 +++--- .../std/tests/P0009R18_mdspan_layout_left_death/test.cpp | 3 --- .../tests/P0009R18_mdspan_layout_right_death/test.cpp | 3 --- tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp | 6 +++--- .../tests/P0009R18_mdspan_layout_stride_death/test.cpp | 3 --- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/stl/inc/mdspan b/stl/inc/mdspan index 638943cb4c..0c188a582a 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -146,8 +146,6 @@ public: && (is_nothrow_constructible_v && ...) && (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(_Exts)) && ...), "Either sizeof...(exts) must be equal to 0 or each element of exts must be nonnegative and must be " @@ -170,7 +168,6 @@ public: } } } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? } template @@ -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; @@ -605,7 +600,6 @@ public: } } } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? constexpr mapping(const mapping&) noexcept = default; @@ -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; @@ -701,7 +693,6 @@ public: return _Result; } } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? template requires (sizeof...(_IndexTypes) == extents_type::rank()) && (is_convertible_v<_IndexTypes, index_type> && ...) diff --git a/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp index fdae36b755..5b77ab1760 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp @@ -75,14 +75,15 @@ constexpr void check_members(const 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 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(strides[i - 1] * ext.extent(i - 1)); +#pragma warning(pop) } } @@ -91,7 +92,6 @@ constexpr void check_members(const 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 diff --git a/tests/std/tests/P0009R18_mdspan_layout_left_death/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_left_death/test.cpp index 64fd0f7c72..90425880ec 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_left_death/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_left_death/test.cpp @@ -24,8 +24,6 @@ void test_construction_from_other_right_mapping() { layout_left::mapping> 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; layout_stride::mapping m1{Ext{}, array{1, 1}}; @@ -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> m2{m1}; } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? void test_stride_function() { layout_left::mapping> m; diff --git a/tests/std/tests/P0009R18_mdspan_layout_right_death/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_right_death/test.cpp index 449227a714..aed180045f 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_right_death/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_right_death/test.cpp @@ -24,8 +24,6 @@ void test_construction_from_other_left_mapping() { layout_right::mapping> 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; layout_stride::mapping m1{Ext{}, array{3, 1}}; @@ -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> m2{m1}; } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? void test_stride_function() { layout_right::mapping> m; diff --git a/tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp index 7900fa7c80..4f98daa7b9 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_stride/test.cpp @@ -43,8 +43,6 @@ constexpr void do_check_members(const extents& ext, static_assert(same_as); static_assert(same_as); -#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; @@ -127,7 +125,10 @@ constexpr void do_check_members(const extents& ext, { // Check 'stride' function for (size_t i = 0; i < strs.size(); ++i) { same_as 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) } } @@ -136,7 +137,6 @@ constexpr void do_check_members(const extents& ext, assert(!(m != m)); // Other tests are defined in 'check_comparisons' function [FIXME] } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? } template diff --git a/tests/std/tests/P0009R18_mdspan_layout_stride_death/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_stride_death/test.cpp index 4d66c20b0e..eadd0d3a49 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_stride_death/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_stride_death/test.cpp @@ -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> m1{extents{}, array{-1}}; @@ -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> m2{m1}; } -#pragma warning(pop) // TRANSITION, "/analyze:only" BUG? int main(int argc, char* argv[]) { std_testing::death_test_executive exec;