Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoelf-Jilling <r-j.wolthuis@live.com>2020-01-14 19:38:42 +0300
committerRoelf-Jilling <r-j.wolthuis@live.com>2020-01-16 13:49:15 +0300
commitd08ff53e612c18e7cc3622b0ffb9476353b9d9d9 (patch)
treee5c2d314e7988474da94fb5e4393abeae5893d0f /tests
parent186f5d21c13c2b8dffa86ba5610afedfafebd13b (diff)
Use [[maybe_unused]] with C++17
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt18
-rw-r--r--tests/span_tests.cpp12
2 files changed, 23 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1d74c45..973403f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -57,9 +57,11 @@ if(MSVC) # MSVC or simulating MSVC
-Wno-missing-prototypes
-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>: # no support for [[maybe_unused]]
+ -Wno-unused-member-function
+ -Wno-unused-variable
+ >
>
)
else()
@@ -85,16 +87,22 @@ else()
-Wno-missing-prototypes
-Wno-padded
-Wno-unknown-attributes
- -Wno-unused-variable
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
- $<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function>
-Wno-weak-vtables
+ $<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
+ -Wno-unused-member-function
+ -Wno-unused-variable
+ >
>
$<$<CXX_COMPILER_ID:Clang>:
$<$<CXX_COMPILER_VERSION:5.0.2>:-Wno-undefined-func-template>
>
$<$<CXX_COMPILER_ID:GNU>:
- -Wno-unused-variable
+ $<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
+ $<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
+ -Wno-unused-variable
+ >
+ >
>
)
endif(MSVC)
diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp
index d0da49d..20c8bc0 100644
--- a/tests/span_tests.cpp
+++ b/tests/span_tests.cpp
@@ -1287,7 +1287,11 @@ TEST(span_test, from_array_constructor)
auto beyond = s.rend();
EXPECT_TRUE(it != beyond);
- EXPECT_DEATH(auto _ = *beyond , deathstring);
+#if (__cplusplus > 201402L)
+ EXPECT_DEATH([[maybe_unused]] auto _ = *beyond , deathstring);
+#else
+ EXPECT_DEATH(auto _ = *beyond , deathstring);
+#endif
EXPECT_TRUE(beyond - first == 4);
EXPECT_TRUE(first - first == 0);
@@ -1332,7 +1336,11 @@ TEST(span_test, from_array_constructor)
auto beyond = s.crend();
EXPECT_TRUE(it != beyond);
- EXPECT_DEATH(auto _ = *beyond, deathstring);
+#if (__cplusplus > 201402L)
+ EXPECT_DEATH([[maybe_unused]] auto _ = *beyond, deathstring);
+#else
+ EXPECT_DEATH(auto _ = *beyond, deathstring);
+#endif
EXPECT_TRUE(beyond - first == 4);
EXPECT_TRUE(first - first == 0);