mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Use [[maybe_unused]] with C++17
This commit is contained in:
parent
186f5d21c1
commit
d08ff53e61
@ -57,9 +57,11 @@ if(MSVC) # MSVC or simulating MSVC
|
|||||||
-Wno-missing-prototypes
|
-Wno-missing-prototypes
|
||||||
-Wno-shift-sign-overflow # GTest gtest-port.h
|
-Wno-shift-sign-overflow # GTest gtest-port.h
|
||||||
-Wno-undef # GTest
|
-Wno-undef # GTest
|
||||||
-Wno-unused-variable
|
|
||||||
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
-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()
|
else()
|
||||||
@ -85,17 +87,23 @@ else()
|
|||||||
-Wno-missing-prototypes
|
-Wno-missing-prototypes
|
||||||
-Wno-padded
|
-Wno-padded
|
||||||
-Wno-unknown-attributes
|
-Wno-unknown-attributes
|
||||||
-Wno-unused-variable
|
|
||||||
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
||||||
$<$<EQUAL:${GSL_CXX_STANDARD},14>:-Wno-unused-member-function>
|
|
||||||
-Wno-weak-vtables
|
-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_ID:Clang>:
|
||||||
$<$<CXX_COMPILER_VERSION:5.0.2>:-Wno-undefined-func-template>
|
$<$<CXX_COMPILER_VERSION:5.0.2>:-Wno-undefined-func-template>
|
||||||
>
|
>
|
||||||
$<$<CXX_COMPILER_ID:GNU>:
|
$<$<CXX_COMPILER_ID:GNU>:
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
||||||
-Wno-unused-variable
|
-Wno-unused-variable
|
||||||
>
|
>
|
||||||
|
>
|
||||||
|
>
|
||||||
)
|
)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
@ -1287,7 +1287,11 @@ TEST(span_test, from_array_constructor)
|
|||||||
|
|
||||||
auto beyond = s.rend();
|
auto beyond = s.rend();
|
||||||
EXPECT_TRUE(it != beyond);
|
EXPECT_TRUE(it != beyond);
|
||||||
|
#if (__cplusplus > 201402L)
|
||||||
|
EXPECT_DEATH([[maybe_unused]] auto _ = *beyond , deathstring);
|
||||||
|
#else
|
||||||
EXPECT_DEATH(auto _ = *beyond , deathstring);
|
EXPECT_DEATH(auto _ = *beyond , deathstring);
|
||||||
|
#endif
|
||||||
|
|
||||||
EXPECT_TRUE(beyond - first == 4);
|
EXPECT_TRUE(beyond - first == 4);
|
||||||
EXPECT_TRUE(first - first == 0);
|
EXPECT_TRUE(first - first == 0);
|
||||||
@ -1332,7 +1336,11 @@ TEST(span_test, from_array_constructor)
|
|||||||
|
|
||||||
auto beyond = s.crend();
|
auto beyond = s.crend();
|
||||||
EXPECT_TRUE(it != beyond);
|
EXPECT_TRUE(it != beyond);
|
||||||
|
#if (__cplusplus > 201402L)
|
||||||
|
EXPECT_DEATH([[maybe_unused]] auto _ = *beyond, deathstring);
|
||||||
|
#else
|
||||||
EXPECT_DEATH(auto _ = *beyond, deathstring);
|
EXPECT_DEATH(auto _ = *beyond, deathstring);
|
||||||
|
#endif
|
||||||
|
|
||||||
EXPECT_TRUE(beyond - first == 4);
|
EXPECT_TRUE(beyond - first == 4);
|
||||||
EXPECT_TRUE(first - first == 0);
|
EXPECT_TRUE(first - first == 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user