diff --git a/rmw/CMakeLists.txt b/rmw/CMakeLists.txt index 2d914e10..9873ec28 100644 --- a/rmw/CMakeLists.txt +++ b/rmw/CMakeLists.txt @@ -64,6 +64,9 @@ ament_export_targets(${PROJECT_NAME}) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() + # pass extra include dirs to cppcheck explicitly + list(APPEND AMENT_LINT_AUTO_EXCLUDE ament_cmake_cppcheck) + ament_cppcheck(INCLUDE_DIRS ${rcutils_INCLUDE_DIRS}) add_subdirectory(test) endif() diff --git a/rmw/include/rmw/rmw.h b/rmw/include/rmw/rmw.h index adf590de..cd6100cc 100644 --- a/rmw/include/rmw/rmw.h +++ b/rmw/include/rmw/rmw.h @@ -88,6 +88,7 @@ extern "C" #include #include +#include "rcutils/macros.h" #include "rcutils/types.h" #include "rosidl_runtime_c/message_type_support_struct.h" @@ -198,27 +199,11 @@ RMW_WARN_UNUSED rmw_ret_t rmw_destroy_node(rmw_node_t * node); -/// Manually assert that this node is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE) -/** - * If the rmw Liveliness policy is set to RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE, the creator of - * this node may manually call `assert_liveliness` at some point in time to signal to the rest - * of the system that this Node is still alive. - * - *
- * Attribute | Adherence - * ------------------ | ------------- - * Allocates Memory | No - * Thread-Safe | Yes - * Uses Atomics | No - * Lock-Free | Yes - * - * \param[in] node handle to the node that needs liveliness to be asserted - * \return `RMW_RET_OK` if the liveliness assertion was completed successfully, or - * \return `RMW_RET_ERROR` if an unspecified error occurs, or - * \return `RMW_RET_UNSUPPORTED` if the rmw implementation does not support asserting liveliness. - */ + RMW_PUBLIC -RMW_WARN_UNUSED +RCUTILS_DEPRECATED_WITH_MSG( + "rmw_node_assert_liveliness implementation was removed." + " If manual liveliness assertion is needed, use MANUAL_BY_TOPIC.") rmw_ret_t rmw_node_assert_liveliness(const rmw_node_t * node); diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 63f81a29..03afe07d 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -384,26 +384,41 @@ enum RMW_PUBLIC_TYPE rmw_qos_durability_policy_t RMW_QOS_POLICY_DURABILITY_UNKNOWN }; +#define RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE_DEPRECATED_MSG \ + "RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE is deprecated. " \ + "Use RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC if manually asserted liveliness is needed." + +#ifndef _WIN32 +# define RMW_DECLARE_DEPRECATED(name, msg) name __attribute__((deprecated(msg))) +#else +# define RMW_DECLARE_DEPRECATED(name, msg) name __pragma(deprecated(name)) +#endif + /// QoS liveliness enumerations that describe a publisher's reporting policy for its alive status. /// For a subscriber, these are its requirements for its topic's publishers. enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t { /// Implementation specific default - RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT, + RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT = 0, /// The signal that establishes a Topic is alive comes from the ROS rmw layer. - RMW_QOS_POLICY_LIVELINESS_AUTOMATIC, + RMW_QOS_POLICY_LIVELINESS_AUTOMATIC = 1, - /// The signal that establishes a Topic is alive is manually reported by the node - RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE, + /// Explicitly asserting node liveliness is required in this case. + /// This option is deprecated, use RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC if your application + /// requires to assert liveliness manually. + RMW_DECLARE_DEPRECATED( + RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE, + RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE_DEPRECATED_MSG) = 2, /// The signal that establishes a Topic is alive is at the Topic level. Only publishing a message /// on the Topic or an explicit signal from the application to assert liveliness on the Topic /// will mark the Topic as being alive. - RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC, + // Using `3` for backwards compatibility. + RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC = 3, /// Liveliness policy has not yet been set - RMW_QOS_POLICY_LIVELINESS_UNKNOWN + RMW_QOS_POLICY_LIVELINESS_UNKNOWN = 4 }; /// QoS Deadline default, 0s indicates deadline policies are not tracked or enforced diff --git a/rmw/test/test_topic_endpoint_info.cpp b/rmw/test/test_topic_endpoint_info.cpp index e69bc623..6d0aeece 100644 --- a/rmw/test/test_topic_endpoint_info.cpp +++ b/rmw/test/test_topic_endpoint_info.cpp @@ -148,7 +148,7 @@ TEST(test_topic_endpoint_info, set_qos_profile) { qos_profile.durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; qos_profile.deadline = {1, 0}; qos_profile.lifespan = {2, 0}; - qos_profile.liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE; + qos_profile.liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC; qos_profile.liveliness_lease_duration = {3, 0}; qos_profile.avoid_ros_namespace_conventions = false; @@ -179,7 +179,7 @@ TEST(test_topic_endpoint_info, set_qos_profile) { EXPECT_EQ(topic_endpoint_info.qos_profile.lifespan.nsec, 0u) << "Unequal lifespan nsec"; EXPECT_EQ( topic_endpoint_info.qos_profile.liveliness, - RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE) << "Unequal liveliness"; + RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC) << "Unequal liveliness"; EXPECT_EQ( topic_endpoint_info.qos_profile.liveliness_lease_duration.sec, 3u) << "Unequal liveliness lease duration sec"; @@ -231,7 +231,7 @@ TEST(test_topic_endpoint_info, fini) { qos_profile.durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; qos_profile.deadline = {1, 0}; qos_profile.lifespan = {2, 0}; - qos_profile.liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE; + qos_profile.liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC; qos_profile.liveliness_lease_duration = {3, 0}; qos_profile.avoid_ros_namespace_conventions = false; rmw_ret_t ret = rmw_topic_endpoint_info_set_qos_profile(&topic_endpoint_info, &qos_profile);