Move compiler warning suppression for tests from cpp files to CMake

This commit is contained in:
Roelf-Jilling 2020-01-14 17:09:27 +01:00
parent 888b9b9723
commit 186f5d21c1
14 changed files with 16 additions and 230 deletions

View File

@ -49,9 +49,16 @@ if(MSVC) # MSVC or simulating MSVC
-Weverything -Weverything
-Wno-c++98-compat -Wno-c++98-compat
-Wno-c++98-compat-pedantic -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-braces
-Wno-missing-prototypes -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
$<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function> $<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function>
> >
) )
@ -67,20 +74,28 @@ else()
-Wpedantic -Wpedantic
-Wshadow -Wshadow
-Wsign-conversion -Wsign-conversion
-Wno-deprecated-declarations # Allow tests for [[deprecated]] elements
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
-Weverything -Weverything
-Wno-c++98-compat -Wno-c++98-compat
-Wno-c++98-compat-pedantic -Wno-c++98-compat-pedantic
-Wno-missing-braces -Wno-missing-braces
-Wno-covered-switch-default # GTest
-Wno-global-constructors # GTest
-Wno-missing-prototypes -Wno-missing-prototypes
-Wno-padded -Wno-padded
-Wno-unknown-attributes -Wno-unknown-attributes
-Wno-unused-variable
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
$<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function> $<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function>
-Wno-weak-vtables -Wno-weak-vtables
> >
$<$<CXX_COMPILER_ID:Clang>: $<$<CXX_COMPILER_ID:Clang>:
$<$<CXX_COMPILER_VERSION:5.0.2>:-Wno-undefined-func-template> $<$<CXX_COMPILER_VERSION:5.0.2>:-Wno-undefined-func-template>
> >
$<$<CXX_COMPILER_ID:GNU>:
-Wno-unused-variable
>
) )
endif(MSVC) endif(MSVC)

View File

@ -20,19 +20,6 @@
#pragma warning(disable : 26440 26426) // from catch #pragma warning(disable : 26440 26426) // from catch
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_algorithm> // for copy #include <gsl/gsl_algorithm> // for copy
#include <gsl/span> // for span #include <gsl/span> // for span
@ -244,7 +231,3 @@ TEST(algorithm_tests, small_destination_span)
copy(src_span_static, dst_span_static); copy(src_span_static, dst_span_static);
#endif #endif
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -20,19 +20,6 @@
#pragma warning(disable : 26440 26426) // from catch #pragma warning(disable : 26440 26426) // from catch
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_assert> // for fail_fast (ptr only), Ensures, Expects #include <gsl/gsl_assert> // for fail_fast (ptr only), Ensures, Expects
@ -78,7 +65,3 @@ TEST(assertion_tests, ensures)
EXPECT_TRUE(g(2) == 3); EXPECT_TRUE(g(2) == 3);
EXPECT_DEATH(g(9), deathstring); EXPECT_DEATH(g(9), deathstring);
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -20,19 +20,6 @@
#pragma warning(disable : 26440 26426) // from catch #pragma warning(disable : 26440 26426) // from catch
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_util> // for at #include <gsl/gsl_util> // for at
@ -152,7 +139,3 @@ static constexpr bool test_constexpr()
static_assert(test_constexpr(), "FAIL"); static_assert(test_constexpr(), "FAIL");
#endif #endif
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -21,21 +21,6 @@
#pragma warning(disable : 4996) // use of function or classes marked [[deprecated]] #pragma warning(disable : 4996) // use of function or classes marked [[deprecated]]
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/multi_span> // for static_bounds, static_bounds_dynamic_range_t #include <gsl/multi_span> // for static_bounds, static_bounds_dynamic_range_t
@ -122,7 +107,3 @@ TEST(bounds_tests, bounds_convertible)
#ifdef CONFIRM_COMPILATION_ERRORS #ifdef CONFIRM_COMPILATION_ERRORS
copy(src_span_static, dst_span_static); copy(src_span_static, dst_span_static);
#endif #endif
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -20,19 +20,6 @@
#pragma warning(disable : 26440 26426) #pragma warning(disable : 26440 26426)
#endif // _MSC_VER #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_byte> // for to_byte, to_integer, byte, operator&, ope... #include <gsl/gsl_byte> // for to_byte, to_integer, byte, operator&, ope...
@ -146,7 +133,3 @@ TEST(byte_tests, aliasing)
#ifdef CONFIRM_COMPILATION_ERRORS #ifdef CONFIRM_COMPILATION_ERRORS
copy(src_span_static, dst_span_static); copy(src_span_static, dst_span_static);
#endif #endif
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -22,21 +22,6 @@
// Suppressing warnings until it is completely removed // Suppressing warnings until it is completely removed
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_byte> // for byte #include <gsl/gsl_byte> // for byte
@ -1884,7 +1869,3 @@ TEST(multi_span_test, iterator)
#ifdef CONFIRM_COMPILATION_ERRORS #ifdef CONFIRM_COMPILATION_ERRORS
copy(src_span_static, dst_span_static); copy(src_span_static, dst_span_static);
#endif #endif
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -23,19 +23,6 @@
#pragma warning(disable : 4702) // unreachable code #pragma warning(disable : 4702) // unreachable code
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/pointers> // for not_null, operator<, operator<=, operator> #include <gsl/pointers> // for not_null, operator<, operator<=, operator>
@ -558,7 +545,3 @@ TEST(notnull_tests, TestMakeNotNull)
static_assert(std::is_nothrow_move_constructible<not_null<void*>>::value, static_assert(std::is_nothrow_move_constructible<not_null<void*>>::value,
"not_null must be no-throw move constructible"); "not_null must be no-throw move constructible");
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -21,19 +21,6 @@
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/pointers> // for owner #include <gsl/pointers> // for owner
@ -61,7 +48,3 @@ TEST(owner_tests, check_pointer_constraint)
} }
#endif #endif
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -20,21 +20,6 @@
#pragma warning(disable : 26440 26426 26497 4189 4996) #pragma warning(disable : 26440 26426 26497 4189 4996)
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_byte> // for byte #include <gsl/gsl_byte> // for byte
@ -1698,7 +1683,3 @@ TEST(span_test, from_array_constructor)
EXPECT_DEATH(s2.front(), deathstring); EXPECT_DEATH(s2.front(), deathstring);
EXPECT_DEATH(s2.back(), deathstring); EXPECT_DEATH(s2.back(), deathstring);
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -23,19 +23,6 @@
#pragma warning(disable : 4702) // unreachable code #pragma warning(disable : 4702) // unreachable code
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/pointers> // for not_null, operator<, operator<=, operator> #include <gsl/pointers> // for not_null, operator<, operator<=, operator>
@ -213,7 +200,3 @@ TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction)
static_assert(std::is_nothrow_move_constructible<strict_not_null<void*>>::value, static_assert(std::is_nothrow_move_constructible<strict_not_null<void*>>::value,
"strict_not_null must be no-throw move constructible"); "strict_not_null must be no-throw move constructible");
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -22,20 +22,6 @@
// Suppressing warnings until it is completely removed // Suppressing warnings until it is completely removed
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_byte> // for byte #include <gsl/gsl_byte> // for byte
#include <gsl/gsl_util> // for narrow_cast #include <gsl/gsl_util> // for narrow_cast
@ -810,7 +796,3 @@ TEST(strided_span_tests, strided_span_conversion)
i++; i++;
} }
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -21,19 +21,6 @@
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_assert> // for Expects, fail_fast (ptr only) #include <gsl/gsl_assert> // for Expects, fail_fast (ptr only)
@ -1235,7 +1222,3 @@ TEST(string_span_tests, as_writeable_bytes)
EXPECT_TRUE(static_cast<const void*>(bs.data()) == static_cast<const void*>(s.data())); EXPECT_TRUE(static_cast<const void*>(bs.data()) == static_cast<const void*>(s.data()));
EXPECT_TRUE(bs.size() == s.size_bytes()); EXPECT_TRUE(bs.size() == s.size_bytes());
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__

View File

@ -21,20 +21,6 @@
#endif #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 <gtest/gtest.h> #include <gtest/gtest.h>
#include <gsl/gsl_util> // for narrow, finally, narrow_cast, narrowing_e... #include <gsl/gsl_util> // for narrow, finally, narrow_cast, narrowing_e...
@ -154,7 +140,3 @@ TEST(utils_tests, narrow)
#endif #endif
} }
#if __clang__ || __GNUC__
#pragma GCC diagnostic pop
#endif // __clang__ || __GNUC__