diff --git a/include/span.h b/include/span.h index 32cf828..f4a57d9 100644 --- a/include/span.h +++ b/include/span.h @@ -55,6 +55,7 @@ // turn off some misguided warnings #pragma warning(push) #pragma warning(disable: 4351) // warns about newly introduced aggregate initializer behavior +#pragma warning(disable: 4512) // warns that assignment op could not be generated #endif // _MSC_VER <= 1800 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3435a7f..d49cf93 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,6 +14,7 @@ add_definitions(-DGSL_THROWS_FOR_TESTING) if(MSVC14 OR MSVC12) # has the support we need # remove unnecessary warnings about unchecked iterators add_definitions(-D_SCL_SECURE_NO_WARNINGS) + add_compile_options(/W4) else() include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 4c21116..ae14f20 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -198,6 +198,7 @@ SUITE(span_tests) string str = "ttttttttttttttt"; // size = 15 auto t = str.data(); + (void)t; auto av3 = as_span(str); overloaded_func(av3.as_span(dim<>(1), dim<3>(), dim<5>()), 't'); } @@ -223,12 +224,12 @@ SUITE(span_tests) } } - template void fn(const Bounds& b) { static_assert(Bounds::static_size == 60, "static bounds is wrong size"); } + template void fn(const Bounds&) { static_assert(Bounds::static_size == 60, "static bounds is wrong size"); } TEST (span_reshape_test) { int a[3][4][5]; auto av = as_span(a); - fn(av.bounds()); + fn(av.bounds()); auto av2 = av.as_span(dim<60>()); auto av3 = av2.as_span(dim<3>(), dim<4>(), dim<5>()); auto av4 = av3.as_span(dim<4>(), dim<>(3), dim<5>()); @@ -755,6 +756,7 @@ SUITE(span_tests) CHECK_THROW(empty_av.cbegin()[0], fail_fast); for (auto& v : empty_av) { + (void)v; CHECK(false); } } @@ -767,6 +769,7 @@ SUITE(span_tests) CHECK_THROW(empty_av.cbegin()[0], fail_fast); for (auto& v : empty_av) { + (void)v; CHECK(false); } } @@ -782,6 +785,7 @@ SUITE(span_tests) for (auto& v : empty_sav) { + (void)v; CHECK(false); } } @@ -796,6 +800,7 @@ SUITE(span_tests) for (auto& v : empty_sav) { + (void)v; CHECK(false); } } diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index ab48fcb..5d4681a 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -41,14 +41,14 @@ SUITE(string_span_tests) { std::string s = "Hello there world"; cstring_span<> v = s; - CHECK(v.length() == s.length()); + CHECK(v.length() == static_cast::size_type>(s.length())); } TEST(TestConstructFromStdVector) { std::vector vec(5, 'h'); string_span<> v = vec; - CHECK(v.length() == vec.size()); + CHECK(v.length() == static_cast::size_type>(vec.size())); } TEST(TestStackArrayConstruction) @@ -114,7 +114,7 @@ SUITE(string_span_tests) char stack_string[] = "Hello"; cstring_span<> v = ensure_z(stack_string); auto s2 = gsl::to_string(v); - CHECK(s2.length() == v.length()); + CHECK(static_cast::size_type>(s2.length()) == v.length()); CHECK(s2.length() == 5); } }