diff --git a/tests/algorithm_tests.cpp b/tests/algorithm_tests.cpp index 9345e95..96bfb93 100644 --- a/tests/algorithm_tests.cpp +++ b/tests/algorithm_tests.cpp @@ -20,6 +20,13 @@ #pragma warning(disable : 26440 26426) // from catch #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif #include #include // for copy @@ -214,3 +221,7 @@ TEST(algorithm_tests, small_destination_span) copy(src_span_static, dst_span_static); #endif } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index 6aa3830..b1d8f60 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -20,6 +20,14 @@ #pragma warning(disable : 26440 26426) // from catch #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for fail_fast (ptr only), Ensures, Expects @@ -54,3 +62,7 @@ TEST(assertion_tests, ensures) EXPECT_EQ(g(2), 3); EXPECT_DEATH(g(9), ".*"); } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp index fb007b8..67e8729 100644 --- a/tests/at_tests.cpp +++ b/tests/at_tests.cpp @@ -20,7 +20,15 @@ #pragma warning(disable : 26440 26426) // from catch #endif -#include +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + +#include #include // for at @@ -115,3 +123,6 @@ static constexpr bool test_constexpr() static_assert(test_constexpr(), "FAIL"); #endif +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/bounds_tests.cpp b/tests/bounds_tests.cpp index d8a9793..7bd3b2a 100644 --- a/tests/bounds_tests.cpp +++ b/tests/bounds_tests.cpp @@ -24,9 +24,14 @@ #if __clang__ || __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +//disable warnings from gtest +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" #endif -#include +#include #include // for static_bounds, static_bounds_dynamic_range_t @@ -96,8 +101,6 @@ TEST(bounds_tests, bounds_convertible) static_bounds<7, 4, 2> b4 = b3; (void) b4; - static_bounds b11; - static_bounds b5; static_bounds<34> b6; diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index 0a8a1f6..6d3342a 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -20,6 +20,14 @@ #pragma warning(disable : 26440 26426) // from catch #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for to_byte, to_integer, byte, operator&, ope... @@ -133,3 +141,7 @@ TEST(byte_tests, aliasing) #ifdef CONFIRM_COMPILATION_ERRORS copy(src_span_static, dst_span_static); #endif + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index 53c029e..63ebd63 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -25,6 +25,12 @@ #if __clang__ || __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +//disable warnings from gtest +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" + #endif #include @@ -1033,18 +1039,18 @@ TEST(multi_span_test, rank) { multi_span s; - EXPECT_EQ(s.rank(), 1); + EXPECT_EQ(s.rank(), static_cast(1)); } { multi_span s = arr; - EXPECT_EQ(s.rank(), 1); + EXPECT_EQ(s.rank(), static_cast(1)); } int arr2d[1][1] = {}; { multi_span s = arr2d; - EXPECT_EQ(s.rank(), 2); + EXPECT_EQ(s.rank(), static_cast(2)); } } diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index c2dfbdb..b26e618 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -23,6 +23,14 @@ #pragma warning(disable : 4702) // unreachable code #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for not_null, operator<, operator<=, operator> @@ -527,3 +535,7 @@ 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 diff --git a/tests/owner_tests.cpp b/tests/owner_tests.cpp index 9babb38..32343af 100644 --- a/tests/owner_tests.cpp +++ b/tests/owner_tests.cpp @@ -21,6 +21,14 @@ #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for owner @@ -48,3 +56,7 @@ TEST(owner_tests, check_pointer_constraint) } #endif } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 15a5109..2e752fd 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -21,6 +21,14 @@ #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include // for byte #include // for narrow_cast, at #include // for span, span_iterator, operator==, operator!= @@ -1548,3 +1556,7 @@ TEST(span_test, from_array_constructor) EXPECT_TRUE((std::is_default_constructible>::value)); EXPECT_FALSE((std::is_default_constructible>::value)); } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/strict_notnull_tests.cpp b/tests/strict_notnull_tests.cpp index 07aa957..f060912 100644 --- a/tests/strict_notnull_tests.cpp +++ b/tests/strict_notnull_tests.cpp @@ -23,6 +23,14 @@ #pragma warning(disable : 4702) // unreachable code #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for not_null, operator<, operator<=, operator> @@ -191,3 +199,7 @@ 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 diff --git a/tests/strided_span_tests.cpp b/tests/strided_span_tests.cpp index 460bb01..6344228 100644 --- a/tests/strided_span_tests.cpp +++ b/tests/strided_span_tests.cpp @@ -25,6 +25,11 @@ #if __clang__ || __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +//disable warnings from gtest +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" #endif #include diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index 2a56c46..41863e4 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -21,7 +21,15 @@ #endif -#include +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + +#include #include // for Expects, fail_fast (ptr only) #include // for owner @@ -68,6 +76,9 @@ T move_wrapper(T&& t) return std::move(t); } +// not used otherwise +#ifdef CONFIRM_COMPILATION_ERRORS + template T create() { @@ -78,6 +89,7 @@ template void use(basic_string_span) { } +#endif czstring_span<> CreateTempName(string_span<> span) { @@ -226,26 +238,26 @@ TEST(string_span_tests, TestConversionFromConst) TEST(string_span_tests, TestToString) { auto s = gsl::to_string(cstring_span<>{}); - EXPECT_EQ(s.length(), 0); + EXPECT_EQ(s.length(), static_cast(0)); char stack_string[] = "Hello"; cstring_span<> v = ensure_z(stack_string); auto s2 = gsl::to_string(v); EXPECT_EQ(static_cast::index_type>(s2.length()), v.length()); - EXPECT_EQ(s2.length(), 5); + EXPECT_EQ(s2.length(), static_cast(5)); } TEST(string_span_tests, TestToBasicString) { auto s = gsl::to_basic_string, ::std::allocator>( cstring_span<>{}); - EXPECT_EQ(s.length(), 0); + EXPECT_EQ(s.length(), static_cast(0)); char stack_string[] = "Hello"; cstring_span<> v = ensure_z(stack_string); auto s2 = gsl::to_basic_string, ::std::allocator>(v); EXPECT_EQ(static_cast::index_type>(s2.length()), v.length()); - EXPECT_EQ(s2.length(), 5); + EXPECT_EQ(s2.length(), static_cast(5)); } TEST(string_span_tests, EqualityAndImplicitConstructors) @@ -1198,3 +1210,7 @@ TEST(string_span_tests, as_writeable_bytes) EXPECT_EQ(static_cast(bs.data()), static_cast(s.data())); EXPECT_EQ(bs.size(), s.size_bytes()); } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index a135749..3583ea4 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -21,6 +21,14 @@ #endif +#if __clang__ || __GNUC__ +//disable warnings from gtest +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wglobal-constructors" +#pragma GCC diagnostic ignored "-Wused-but-marked-unused" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif + #include #include // for narrow, finally, narrow_cast, narrowing_e... @@ -130,3 +138,7 @@ TEST(utils_tests, narrow) #endif } + +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif