Skip to content

Commit bf64e9a

Browse files
Silence some deprecation warnings (#355)
1 parent c47affa commit bf64e9a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

realtime_tools/include/realtime_tools/realtime_publisher.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class RealtimePublisher
6363

6464
RCLCPP_SMART_PTR_DEFINITIONS(RealtimePublisher<MessageT>)
6565

66-
[[deprecated(
67-
"This variable is deprecated, it is recommended to use the try_publish() method instead.")]]
6866
MessageT msg_;
6967

7068
/**
@@ -204,7 +202,10 @@ class RealtimePublisher
204202
void unlockAndPublish()
205203
{
206204
turn_.store(State::NON_REALTIME, std::memory_order_release);
205+
#pragma GCC diagnostic push
206+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
207207
unlock();
208+
#pragma GCC diagnostic pop
208209
}
209210

210211
/**

realtime_tools/test/realtime_publisher_tests.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ struct StringCallback
5454
}
5555
};
5656

57-
TEST(RealtimePublisher, rt_publish)
57+
#pragma GCC diagnostic push
58+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
59+
TEST(RealtimePublisher, rt_publish_legacy)
5860
{
5961
rclcpp::init(0, nullptr);
6062
const size_t ATTEMPTS = 10;
@@ -90,7 +92,7 @@ TEST(RealtimePublisher, rt_publish)
9092
rclcpp::shutdown();
9193
}
9294

93-
TEST(RealtimePublisher, rt_try_publish)
95+
TEST(RealtimePublisher, rt_try_publish_legacy)
9496
{
9597
rclcpp::init(0, nullptr);
9698
const size_t ATTEMPTS = 10;
@@ -130,6 +132,7 @@ TEST(RealtimePublisher, rt_try_publish)
130132
EXPECT_STREQ(expected_msg, str_callback.msg_.string_value.c_str());
131133
rclcpp::shutdown();
132134
}
135+
#pragma GCC diagnostic pop
133136

134137
TEST(RealtimePublisher, rt_can_try_publish)
135138
{

0 commit comments

Comments
 (0)