From 186f5d21c13c2b8dffa86ba5610afedfafebd13b Mon Sep 17 00:00:00 2001 From: Roelf-Jilling Date: Tue, 14 Jan 2020 17:09:27 +0100 Subject: [PATCH 1/4] Move compiler warning suppression for tests from cpp files to CMake --- tests/CMakeLists.txt | 17 ++++++++++++++++- tests/algorithm_tests.cpp | 17 ----------------- tests/assertion_tests.cpp | 17 ----------------- tests/at_tests.cpp | 17 ----------------- tests/bounds_tests.cpp | 19 ------------------- tests/byte_tests.cpp | 17 ----------------- tests/multi_span_tests.cpp | 19 ------------------- tests/notnull_tests.cpp | 17 ----------------- tests/owner_tests.cpp | 17 ----------------- tests/span_tests.cpp | 19 ------------------- tests/strict_notnull_tests.cpp | 17 ----------------- tests/strided_span_tests.cpp | 18 ------------------ tests/string_span_tests.cpp | 17 ----------------- tests/utils_tests.cpp | 18 ------------------ 14 files changed, 16 insertions(+), 230 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5c93a9a..1d74c45 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -49,9 +49,16 @@ if(MSVC) # MSVC or simulating MSVC -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic + -Wno-covered-switch-default # GTest + -Wno-deprecated-declarations # Allow tests for [[deprecated]] elements + -Wno-global-constructors # GTest + -Wno-language-extension-token # GTest gtest-port.h -Wno-missing-braces -Wno-missing-prototypes - -Wno-unknown-attributes + -Wno-shift-sign-overflow # GTest gtest-port.h + -Wno-undef # GTest + -Wno-unused-variable + -Wno-used-but-marked-unused # GTest EXPECT_DEATH $<$:-Wno-unused-member-function> > ) @@ -67,20 +74,28 @@ else() -Wpedantic -Wshadow -Wsign-conversion + -Wno-deprecated-declarations # Allow tests for [[deprecated]] elements $<$,$>: -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-missing-braces + -Wno-covered-switch-default # GTest + -Wno-global-constructors # GTest -Wno-missing-prototypes -Wno-padded -Wno-unknown-attributes + -Wno-unused-variable + -Wno-used-but-marked-unused # GTest EXPECT_DEATH $<$:-Wno-unused-member-function> -Wno-weak-vtables > $<$: $<$:-Wno-undefined-func-template> > + $<$: + -Wno-unused-variable + > ) endif(MSVC) diff --git a/tests/algorithm_tests.cpp b/tests/algorithm_tests.cpp index 50bff11..cf6eb01 100644 --- a/tests/algorithm_tests.cpp +++ b/tests/algorithm_tests.cpp @@ -20,19 +20,6 @@ #pragma warning(disable : 26440 26426) // from catch #endif -#if __clang__ || __GNUC__ -// disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for copy #include // for span @@ -244,7 +231,3 @@ TEST(algorithm_tests, small_destination_span) copy(src_span_static, dst_span_static); #endif } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index 598c7dc..da45128 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -20,19 +20,6 @@ #pragma warning(disable : 26440 26426) // from catch #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for fail_fast (ptr only), Ensures, Expects @@ -78,7 +65,3 @@ TEST(assertion_tests, ensures) EXPECT_TRUE(g(2) == 3); EXPECT_DEATH(g(9), deathstring); } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp index cbed5ba..370350c 100644 --- a/tests/at_tests.cpp +++ b/tests/at_tests.cpp @@ -20,19 +20,6 @@ #pragma warning(disable : 26440 26426) // from catch #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for at @@ -152,7 +139,3 @@ static constexpr bool test_constexpr() static_assert(test_constexpr(), "FAIL"); #endif - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/bounds_tests.cpp b/tests/bounds_tests.cpp index 4291ae1..d7fc33b 100644 --- a/tests/bounds_tests.cpp +++ b/tests/bounds_tests.cpp @@ -21,21 +21,6 @@ #pragma warning(disable : 4996) // use of function or classes marked [[deprecated]] #endif -#if __clang__ || __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -//disable warnings from gtest -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for static_bounds, static_bounds_dynamic_range_t @@ -122,7 +107,3 @@ TEST(bounds_tests, bounds_convertible) #ifdef CONFIRM_COMPILATION_ERRORS copy(src_span_static, dst_span_static); #endif - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index ab243a7..45ba66d 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -20,19 +20,6 @@ #pragma warning(disable : 26440 26426) #endif // _MSC_VER -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for to_byte, to_integer, byte, operator&, ope... @@ -146,7 +133,3 @@ TEST(byte_tests, aliasing) #ifdef CONFIRM_COMPILATION_ERRORS copy(src_span_static, dst_span_static); #endif - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index f2e040f..6940c28 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -22,21 +22,6 @@ // Suppressing warnings until it is completely removed #endif -#if __clang__ || __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -//disable warnings from gtest -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for byte @@ -1884,7 +1869,3 @@ TEST(multi_span_test, iterator) #ifdef CONFIRM_COMPILATION_ERRORS copy(src_span_static, dst_span_static); #endif - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 038119e..3e91cfd 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -23,19 +23,6 @@ #pragma warning(disable : 4702) // unreachable code #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for not_null, operator<, operator<=, operator> @@ -558,7 +545,3 @@ TEST(notnull_tests, TestMakeNotNull) static_assert(std::is_nothrow_move_constructible>::value, "not_null must be no-throw move constructible"); - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/owner_tests.cpp b/tests/owner_tests.cpp index 8756596..16134e8 100644 --- a/tests/owner_tests.cpp +++ b/tests/owner_tests.cpp @@ -21,19 +21,6 @@ #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for owner @@ -61,7 +48,3 @@ TEST(owner_tests, check_pointer_constraint) } #endif } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 28c97f5..d0da49d 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -20,21 +20,6 @@ #pragma warning(disable : 26440 26426 26497 4189 4996) #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for byte @@ -1698,7 +1683,3 @@ TEST(span_test, from_array_constructor) EXPECT_DEATH(s2.front(), deathstring); EXPECT_DEATH(s2.back(), deathstring); } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/strict_notnull_tests.cpp b/tests/strict_notnull_tests.cpp index 3c971db..f06542b 100644 --- a/tests/strict_notnull_tests.cpp +++ b/tests/strict_notnull_tests.cpp @@ -23,19 +23,6 @@ #pragma warning(disable : 4702) // unreachable code #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for not_null, operator<, operator<=, operator> @@ -213,7 +200,3 @@ TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction) static_assert(std::is_nothrow_move_constructible>::value, "strict_not_null must be no-throw move constructible"); - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/strided_span_tests.cpp b/tests/strided_span_tests.cpp index f5f3704..2773ac1 100644 --- a/tests/strided_span_tests.cpp +++ b/tests/strided_span_tests.cpp @@ -22,20 +22,6 @@ // Suppressing warnings until it is completely removed #endif -#if __clang__ || __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -//disable warnings from gtest -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for byte #include // for narrow_cast @@ -810,7 +796,3 @@ TEST(strided_span_tests, strided_span_conversion) i++; } } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index 24bf140..0e90b85 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -21,19 +21,6 @@ #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - #include #include // for Expects, fail_fast (ptr only) @@ -1235,7 +1222,3 @@ TEST(string_span_tests, as_writeable_bytes) EXPECT_TRUE(static_cast(bs.data()) == static_cast(s.data())); EXPECT_TRUE(bs.size() == s.size_bytes()); } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index db6e8c5..54f2882 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -21,20 +21,6 @@ #endif -#if __clang__ || __GNUC__ -//disable warnings from gtest -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#endif // __clang__ || __GNUC__ - -#if __clang__ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -#pragma GCC diagnostic ignored "-Wused-but-marked-unused" -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -#pragma GCC diagnostic ignored "-Winconsistent-missing-destructor-override" -#endif // __clang__ - - #include #include // for narrow, finally, narrow_cast, narrowing_e... @@ -154,7 +140,3 @@ TEST(utils_tests, narrow) #endif } - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic pop -#endif // __clang__ || __GNUC__ From d08ff53e612c18e7cc3622b0ffb9476353b9d9d9 Mon Sep 17 00:00:00 2001 From: Roelf-Jilling Date: Tue, 14 Jan 2020 17:38:42 +0100 Subject: [PATCH 2/4] Use [[maybe_unused]] with C++17 --- tests/CMakeLists.txt | 18 +++++++++++++----- tests/span_tests.cpp | 12 ++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1d74c45..973403f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,9 +57,11 @@ if(MSVC) # MSVC or simulating MSVC -Wno-missing-prototypes -Wno-shift-sign-overflow # GTest gtest-port.h -Wno-undef # GTest - -Wno-unused-variable -Wno-used-but-marked-unused # GTest EXPECT_DEATH - $<$:-Wno-unused-member-function> + $<$: # no support for [[maybe_unused]] + -Wno-unused-member-function + -Wno-unused-variable + > > ) else() @@ -85,16 +87,22 @@ else() -Wno-missing-prototypes -Wno-padded -Wno-unknown-attributes - -Wno-unused-variable -Wno-used-but-marked-unused # GTest EXPECT_DEATH - $<$:-Wno-unused-member-function> -Wno-weak-vtables + $<$: # no support for [[maybe_unused]] + -Wno-unused-member-function + -Wno-unused-variable + > > $<$: $<$:-Wno-undefined-func-template> > $<$: - -Wno-unused-variable + $<$,6>>: + $<$: # no support for [[maybe_unused]] + -Wno-unused-variable + > + > > ) endif(MSVC) diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index d0da49d..20c8bc0 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1287,7 +1287,11 @@ TEST(span_test, from_array_constructor) auto beyond = s.rend(); EXPECT_TRUE(it != beyond); - EXPECT_DEATH(auto _ = *beyond , deathstring); +#if (__cplusplus > 201402L) + EXPECT_DEATH([[maybe_unused]] auto _ = *beyond , deathstring); +#else + EXPECT_DEATH(auto _ = *beyond , deathstring); +#endif EXPECT_TRUE(beyond - first == 4); EXPECT_TRUE(first - first == 0); @@ -1332,7 +1336,11 @@ TEST(span_test, from_array_constructor) auto beyond = s.crend(); EXPECT_TRUE(it != beyond); - EXPECT_DEATH(auto _ = *beyond, deathstring); +#if (__cplusplus > 201402L) + EXPECT_DEATH([[maybe_unused]] auto _ = *beyond, deathstring); +#else + EXPECT_DEATH(auto _ = *beyond, deathstring); +#endif EXPECT_TRUE(beyond - first == 4); EXPECT_TRUE(first - first == 0); From 4cbd8948125a9070d8f342b6cb51bc02d108ca82 Mon Sep 17 00:00:00 2001 From: Roelf-Jilling Date: Wed, 15 Jan 2020 19:55:39 +0100 Subject: [PATCH 3/4] Enable more warnings in GCC --- tests/CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 973403f..c3a7327 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -98,11 +98,19 @@ else() $<$:-Wno-undefined-func-template> > $<$: + -Wdouble-promotion # float implicit to double + -Wlogical-op # suspicious uses of logical operators $<$,6>>: + -Wduplicated-cond # duplicated if-else conditions + -Wmisleading-indentation + -Wnull-dereference $<$: # no support for [[maybe_unused]] -Wno-unused-variable > > + $<$,7>>: + -Wduplicated-branches # identical if-else branches + > > ) endif(MSVC) @@ -194,6 +202,22 @@ else() -Wno-unknown-attributes -Wno-weak-vtables > + $<$: + -Wdouble-promotion # float implicit to double + -Wlogical-op # suspicious uses of logical operators + -Wuseless-cast # casting to its own type + $<$,6>>: + -Wduplicated-cond # duplicated if-else conditions + -Wmisleading-indentation + -Wnull-dereference + > + $<$,7>>: + -Wduplicated-branches # identical if-else branches + > + $<$,8>>: + -Wcast-align=strict # increase alignment (i.e. char* to int*) + > + > ) endif(MSVC) From 81f56796a1c844eada87c4bf91a479a29715703e Mon Sep 17 00:00:00 2001 From: Roelf-Jilling Date: Wed, 15 Jan 2020 18:33:37 +0100 Subject: [PATCH 4/4] MSVC and CoreChecker warning suppression for tests to CMake Suppress CppCoreCheck warnings on GTest macros. Suppress CppCoreCheck advice to use the GSL --- tests/CMakeLists.txt | 17 +++++++++++++++++ tests/algorithm_tests.cpp | 6 ------ tests/assertion_tests.cpp | 6 ------ tests/at_tests.cpp | 6 ------ tests/bounds_tests.cpp | 7 ------- tests/byte_tests.cpp | 6 ------ tests/multi_span_tests.cpp | 8 -------- tests/notnull_tests.cpp | 9 --------- tests/owner_tests.cpp | 7 ------- tests/span_tests.cpp | 6 ------ tests/strict_notnull_tests.cpp | 9 --------- tests/strided_span_tests.cpp | 8 -------- tests/string_span_tests.cpp | 7 ------- tests/utils_tests.cpp | 7 ------- 14 files changed, 17 insertions(+), 92 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c3a7327..eaa4c86 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -45,6 +45,21 @@ if(MSVC) # MSVC or simulating MSVC /EHsc /W4 /WX + $<$: + /wd4996 # Use of function or classes marked [[deprecated]] + /wd26409 # CppCoreCheck - GTest + /wd26426 # CppCoreCheck - GTest + /wd26440 # CppCoreCheck - GTest + /wd26446 # CppCoreCheck - prefer gsl::at() + /wd26472 # CppCoreCheck - use gsl::narrow(_cast) + /wd26481 # CppCoreCheck - use span instead of pointer arithmetic + $<$,1920>: # VS2015 + /wd4189 # variable is initialized but not referenced + $<$>: # Release, RelWithDebInfo + /wd4702 # Unreachable code + > + > + > $<$: -Weverything -Wno-c++98-compat @@ -172,6 +187,8 @@ if(MSVC) # MSVC or simulating MSVC $<$: /wd4577 /wd4702 + /wd26440 # CppCoreCheck - GTest + /wd26446 # CppCoreCheck - prefer gsl::at() > $<$: -Weverything diff --git a/tests/algorithm_tests.cpp b/tests/algorithm_tests.cpp index cf6eb01..ec9b2d1 100644 --- a/tests/algorithm_tests.cpp +++ b/tests/algorithm_tests.cpp @@ -14,12 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch -#endif - #include #include // for copy #include // for span diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index da45128..c45b00c 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -14,12 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch -#endif - #include #include // for fail_fast (ptr only), Ensures, Expects diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp index 370350c..be2c7b8 100644 --- a/tests/at_tests.cpp +++ b/tests/at_tests.cpp @@ -14,12 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch -#endif - #include #include // for at diff --git a/tests/bounds_tests.cpp b/tests/bounds_tests.cpp index d7fc33b..9c2fb96 100644 --- a/tests/bounds_tests.cpp +++ b/tests/bounds_tests.cpp @@ -14,13 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch -#pragma warning(disable : 4996) // use of function or classes marked [[deprecated]] -#endif - #include #include // for static_bounds, static_bounds_dynamic_range_t diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index 45ba66d..f2850ad 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -14,12 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) -#endif // _MSC_VER - #include #include // for to_byte, to_integer, byte, operator&, ope... diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index 6940c28..6425928 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -14,14 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch -#pragma warning(disable : 4996) // multi_span is in the process of being deprecated. - // Suppressing warnings until it is completely removed -#endif - #include #include // for byte diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 3e91cfd..d4c8cf4 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -14,15 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch - -// Fix VS2015 build breaks in Release -#pragma warning(disable : 4702) // unreachable code -#endif - #include #include // for not_null, operator<, operator<=, operator> diff --git a/tests/owner_tests.cpp b/tests/owner_tests.cpp index 16134e8..ca8222f 100644 --- a/tests/owner_tests.cpp +++ b/tests/owner_tests.cpp @@ -14,13 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch - -#endif - #include #include // for owner diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 20c8bc0..c41e013 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -14,12 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426 26497 4189 4996) -#endif - #include #include // for byte diff --git a/tests/strict_notnull_tests.cpp b/tests/strict_notnull_tests.cpp index f06542b..a568e95 100644 --- a/tests/strict_notnull_tests.cpp +++ b/tests/strict_notnull_tests.cpp @@ -14,15 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch - -// Fix VS2015 build breaks in Release -#pragma warning(disable : 4702) // unreachable code -#endif - #include #include // for not_null, operator<, operator<=, operator> diff --git a/tests/strided_span_tests.cpp b/tests/strided_span_tests.cpp index 2773ac1..5a18f1b 100644 --- a/tests/strided_span_tests.cpp +++ b/tests/strided_span_tests.cpp @@ -14,14 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch deprecated -#pragma warning(disable : 4996) // strided_span is in the process of being deprecated. - // Suppressing warnings until it is completely removed -#endif - #include #include // for byte #include // for narrow_cast diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index 0e90b85..e501bba 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -14,13 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch - -#endif - #include #include // for Expects, fail_fast (ptr only) diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index 54f2882..b6b5fc9 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -14,13 +14,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifdef _MSC_VER -// blanket turn off warnings from CppCoreCheck from catch -// so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426) // from catch - -#endif - #include #include // for narrow, finally, narrow_cast, narrowing_e...