Skip to content

Commit 0247358

Browse files
authored
[libcxx][test] Avoid warnings about unused variables and typedefs if _LIBCPP_VERSION is not defined (llvm#155679)
Make these tests pass with MSVC STL
1 parent bb54be5 commit 0247358

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_assign_noexcept.compile.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct MoveThrowsComp {
5151

5252
void test() {
5353
{
54-
using C = std::flat_map<int, int>;
54+
using C [[maybe_unused]] = std::flat_map<int, int>;
5555
LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable_v<C>);
5656
}
5757
{
@@ -73,7 +73,7 @@ void test() {
7373
static_assert(!std::is_nothrow_move_assignable_v<C>);
7474
}
7575
{
76-
using C =
76+
using C [[maybe_unused]] =
7777
std::flat_map<MoveOnly,
7878
int,
7979
std::less<MoveOnly>,
@@ -82,7 +82,7 @@ void test() {
8282
LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable_v<C>);
8383
}
8484
{
85-
using C =
85+
using C [[maybe_unused]] =
8686
std::flat_map<int,
8787
MoveOnly,
8888
std::less<int>,
@@ -92,7 +92,7 @@ void test() {
9292
}
9393
{
9494
// Test with a comparator that throws on move-assignment.
95-
using C = std::flat_map<int, int, MoveThrowsComp>;
95+
using C [[maybe_unused]] = std::flat_map<int, int, MoveThrowsComp>;
9696
LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable_v<C>);
9797
}
9898
{

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.erasure/erase_if_exceptions.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct ErasurePredicate {
6666
};
6767

6868
int main(int, char**) {
69-
const std::pair<int, int> expected[] = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}};
69+
[[maybe_unused]] const std::pair<int, int> expected[] = {
70+
{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}};
7071
{
7172
using M = std::flat_map<ThrowingAssignment, int, ThrowingComparator>;
7273
for (int first_throw = 1; first_throw < 99; ++first_throw) {

libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.cons/move_assign_noexcept.compile.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct MoveThrowsComp {
5151

5252
void test() {
5353
{
54-
using C = std::flat_multimap<int, int>;
54+
using C [[maybe_unused]] = std::flat_multimap<int, int>;
5555
LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable_v<C>);
5656
}
5757
{
@@ -73,7 +73,7 @@ void test() {
7373
static_assert(!std::is_nothrow_move_assignable_v<C>);
7474
}
7575
{
76-
using C =
76+
using C [[maybe_unused]] =
7777
std::flat_multimap<MoveOnly,
7878
int,
7979
std::less<MoveOnly>,
@@ -82,7 +82,7 @@ void test() {
8282
LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable_v<C>);
8383
}
8484
{
85-
using C =
85+
using C [[maybe_unused]] =
8686
std::flat_multimap<int,
8787
MoveOnly,
8888
std::less<int>,
@@ -92,7 +92,7 @@ void test() {
9292
}
9393
{
9494
// Test with a comparator that throws on move-assignment.
95-
using C = std::flat_multimap<int, int, MoveThrowsComp>;
95+
using C [[maybe_unused]] = std::flat_multimap<int, int, MoveThrowsComp>;
9696
LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable_v<C>);
9797
}
9898
{

libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.erasure/erase_if_exceptions.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ struct ErasurePredicate {
6868
};
6969

7070
int main(int, char**) {
71-
const std::pair<int, int> expected[] = {{1, 1}, {2, 2}, {3, 3}, {3, 3}, {5, 5}, {6, 6}, {7, 7}, {8, 8}};
71+
[[maybe_unused]] const std::pair<int, int> expected[] = {
72+
{1, 1}, {2, 2}, {3, 3}, {3, 3}, {5, 5}, {6, 6}, {7, 7}, {8, 8}};
7273
{
7374
using M = std::flat_multimap<ThrowingAssignment, int, ThrowingComparator>;
7475
for (int first_throw = 1; first_throw < 99; ++first_throw) {

libcxx/test/std/containers/container.adaptors/flat.set/flat.set.erasure/erase_if_exceptions.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct ErasurePredicate {
6666
};
6767

6868
void test() {
69-
const int expected[] = {1, 2, 3, 4, 5, 6, 7, 8};
69+
[[maybe_unused]] const int expected[] = {1, 2, 3, 4, 5, 6, 7, 8};
7070
{
7171
using M = std::flat_set<ThrowingAssignment, ThrowingComparator>;
7272
for (int first_throw = 1; first_throw < 99; ++first_throw) {

0 commit comments

Comments
 (0)