Skip to content

Commit e5bf22e

Browse files
committed
Silence deprecation warnings in the unit tests
1 parent 8bace31 commit e5bf22e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/message.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ TEST_CASE("message constructor with char array", "[message]")
6969
CHECK(0 == memcmp(data, hi_msg.data(), 2));
7070
}
7171

72+
#pragma GCC diagnostic push
73+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
7274
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
7375
TEST_CASE("message constructor with container - deprecated", "[message]")
7476
{
7577
zmq::message_t hi_msg("Hi"); // deprecated
7678
REQUIRE(3u == hi_msg.size());
7779
CHECK(0 == memcmp(data, hi_msg.data(), 3));
7880
}
81+
#pragma GCC diagnostic pop
7982

8083
TEST_CASE("message constructor with container of trivial data", "[message]")
8184
{
@@ -189,11 +192,14 @@ TEST_CASE("message to string", "[message]")
189192
CHECK(b.to_string_view() == "Foo");
190193
#endif
191194

195+
#pragma GCC diagnostic push
196+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
192197
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
193198
const zmq::message_t depr("Foo"); // deprecated
194199
CHECK(depr.to_string() != "Foo");
195200
CHECK(depr.to_string() == std::string("Foo", 4));
196201
#endif
202+
#pragma GCC diagnostic pop
197203
}
198204

199205
TEST_CASE("message to debug string", "[message]")

tests/socket.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ TEST_CASE("socket check integral options", "[socket]")
365365
"router_mandatory", true);
366366
#endif
367367
#ifdef ZMQ_ROUTER_RAW
368-
check_integral_opt<int>(zmq::sockopt::router_raw, router, "router_raw",
368+
check_integral_opt<int>(zmq::sockopt::router_raw, router, "router_raw",
369369
true);
370370
#endif
371371
#ifdef ZMQ_ROUTER_NOTIFY
@@ -619,9 +619,12 @@ TEST_CASE("socket send recv message_t by pointer", "[socket]")
619619
CHECK(*res_send == 10);
620620
CHECK(smsg.size() == 0);
621621

622+
#pragma GCC diagnostic push
623+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
622624
zmq::message_t rmsg;
623625
const bool res = s.recv(&rmsg);
624626
CHECK(res);
627+
#pragma GCC diagnostic pop
625628
}
626629

627630
TEST_CASE("socket recv dontwait", "[socket]")

0 commit comments

Comments
 (0)