mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Turned on Level 3 warnings for MSVC.
This commit is contained in:
parent
42a7030052
commit
a998a9b33b
@ -55,6 +55,7 @@
|
|||||||
// turn off some misguided warnings
|
// turn off some misguided warnings
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4351) // warns about newly introduced aggregate initializer behavior
|
#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
|
#endif // _MSC_VER <= 1800
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ add_definitions(-DGSL_THROWS_FOR_TESTING)
|
|||||||
if(MSVC14 OR MSVC12) # has the support we need
|
if(MSVC14 OR MSVC12) # has the support we need
|
||||||
# remove unnecessary warnings about unchecked iterators
|
# remove unnecessary warnings about unchecked iterators
|
||||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
|
add_compile_options(/W4)
|
||||||
else()
|
else()
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
||||||
|
@ -198,6 +198,7 @@ SUITE(span_tests)
|
|||||||
|
|
||||||
string str = "ttttttttttttttt"; // size = 15
|
string str = "ttttttttttttttt"; // size = 15
|
||||||
auto t = str.data();
|
auto t = str.data();
|
||||||
|
(void)t;
|
||||||
auto av3 = as_span(str);
|
auto av3 = as_span(str);
|
||||||
overloaded_func(av3.as_span(dim<>(1), dim<3>(), dim<5>()), 't');
|
overloaded_func(av3.as_span(dim<>(1), dim<3>(), dim<5>()), 't');
|
||||||
}
|
}
|
||||||
@ -223,12 +224,12 @@ 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)
|
TEST (span_reshape_test)
|
||||||
{
|
{
|
||||||
int a[3][4][5];
|
int a[3][4][5];
|
||||||
auto av = as_span(a);
|
auto av = as_span(a);
|
||||||
fn(av.bounds());
|
fn(av.bounds());
|
||||||
auto av2 = av.as_span(dim<60>());
|
auto av2 = av.as_span(dim<60>());
|
||||||
auto av3 = av2.as_span(dim<3>(), dim<4>(), dim<5>());
|
auto av3 = av2.as_span(dim<3>(), dim<4>(), dim<5>());
|
||||||
auto av4 = av3.as_span(dim<4>(), dim<>(3), 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);
|
CHECK_THROW(empty_av.cbegin()[0], fail_fast);
|
||||||
for (auto& v : empty_av)
|
for (auto& v : empty_av)
|
||||||
{
|
{
|
||||||
|
(void)v;
|
||||||
CHECK(false);
|
CHECK(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,6 +769,7 @@ SUITE(span_tests)
|
|||||||
CHECK_THROW(empty_av.cbegin()[0], fail_fast);
|
CHECK_THROW(empty_av.cbegin()[0], fail_fast);
|
||||||
for (auto& v : empty_av)
|
for (auto& v : empty_av)
|
||||||
{
|
{
|
||||||
|
(void)v;
|
||||||
CHECK(false);
|
CHECK(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,6 +785,7 @@ SUITE(span_tests)
|
|||||||
|
|
||||||
for (auto& v : empty_sav)
|
for (auto& v : empty_sav)
|
||||||
{
|
{
|
||||||
|
(void)v;
|
||||||
CHECK(false);
|
CHECK(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -796,6 +800,7 @@ SUITE(span_tests)
|
|||||||
|
|
||||||
for (auto& v : empty_sav)
|
for (auto& v : empty_sav)
|
||||||
{
|
{
|
||||||
|
(void)v;
|
||||||
CHECK(false);
|
CHECK(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,14 @@ SUITE(string_span_tests)
|
|||||||
{
|
{
|
||||||
std::string s = "Hello there world";
|
std::string s = "Hello there world";
|
||||||
cstring_span<> v = s;
|
cstring_span<> v = s;
|
||||||
CHECK(v.length() == s.length());
|
CHECK(v.length() == static_cast<cstring_span<>::size_type>(s.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestConstructFromStdVector)
|
TEST(TestConstructFromStdVector)
|
||||||
{
|
{
|
||||||
std::vector<char> vec(5, 'h');
|
std::vector<char> vec(5, 'h');
|
||||||
string_span<> v = vec;
|
string_span<> v = vec;
|
||||||
CHECK(v.length() == vec.size());
|
CHECK(v.length() == static_cast<string_span<>::size_type>(vec.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestStackArrayConstruction)
|
TEST(TestStackArrayConstruction)
|
||||||
@ -114,7 +114,7 @@ SUITE(string_span_tests)
|
|||||||
char stack_string[] = "Hello";
|
char stack_string[] = "Hello";
|
||||||
cstring_span<> v = ensure_z(stack_string);
|
cstring_span<> v = ensure_z(stack_string);
|
||||||
auto s2 = gsl::to_string(v);
|
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);
|
CHECK(s2.length() == 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user