Turned on Level 3 warnings for MSVC.

This commit is contained in:
Neil MacIntosh 2015-11-12 18:57:23 -08:00
parent 42a7030052
commit a998a9b33b
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,7 +224,7 @@ SUITE(span_tests)
}
}
template <class Bounds> void fn(const Bounds& b) { static_assert(Bounds::static_size == 60, "static bounds is wrong size"); }
template <class Bounds> void fn(const Bounds&) { static_assert(Bounds::static_size == 60, "static bounds is wrong size"); }
TEST (span_reshape_test)
{
int a[3][4][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);
}
}

View File

@ -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<cstring_span<>::size_type>(s.length()));
}
TEST(TestConstructFromStdVector)
{
std::vector<char> vec(5, 'h');
string_span<> v = vec;
CHECK(v.length() == vec.size());
CHECK(v.length() == static_cast<string_span<>::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<cstring_span<>::size_type>(s2.length()) == v.length());
CHECK(s2.length() == 5);
}
}