From 81f56796a1c844eada87c4bf91a479a29715703e Mon Sep 17 00:00:00 2001 From: Roelf-Jilling Date: Wed, 15 Jan 2020 18:33:37 +0100 Subject: [PATCH] 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...