From ddf1d14f3423a3530a9960e8caaedea2a48680d0 Mon Sep 17 00:00:00 2001 From: v4hn Date: Thu, 30 Nov 2023 14:56:08 +0100 Subject: [PATCH 1/3] mark virtual overrides as override clang -Werror complains about the obsolete `virtual` definition these days. --- .../include/industrial_trajectory_filters/filter_base.h | 6 +++--- .../src/add_smoothing_filter.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/industrial_trajectory_filters/include/industrial_trajectory_filters/filter_base.h b/industrial_trajectory_filters/include/industrial_trajectory_filters/filter_base.h index d4f06f73..a917aa88 100644 --- a/industrial_trajectory_filters/include/industrial_trajectory_filters/filter_base.h +++ b/industrial_trajectory_filters/include/industrial_trajectory_filters/filter_base.h @@ -224,10 +224,10 @@ template * from the old FilterBase interface class. The filtered trajectory is finally * saved in the MotionPlanResponse object. */ - virtual bool adaptAndPlan(const PlannerFn &planner, const planning_scene::PlanningSceneConstPtr &planning_scene, + bool adaptAndPlan(const PlannerFn &planner, const planning_scene::PlanningSceneConstPtr &planning_scene, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res, - std::vector &added_path_index) const + std::vector &added_path_index) const override { // non const pointer to this @@ -272,7 +272,7 @@ template * @brief Return description string * @return description (as a string) */ - virtual std::string getDescription() const + std::string getDescription() const override { // non const pointer to this FilterBase *p = const_cast*>(this); diff --git a/industrial_trajectory_filters/src/add_smoothing_filter.cpp b/industrial_trajectory_filters/src/add_smoothing_filter.cpp index 63b48311..14666d1c 100644 --- a/industrial_trajectory_filters/src/add_smoothing_filter.cpp +++ b/industrial_trajectory_filters/src/add_smoothing_filter.cpp @@ -102,14 +102,14 @@ class AddSmoothingFilter : public planning_request_adapter::PlanningRequestAdapt } if(!smoothing_filter_.init(filter_coef_)) ROS_ERROR("Initialization error on smoothing filter. Requires an odd number of coeficients"); - + }; /*! \brief Destructor */ ~AddSmoothingFilter(){ }; /*! \brief Returns a short description of this plugin */ - virtual std::string getDescription() const { return "Add Smoothing Trajectory Filter"; } + std::string getDescription() const override { return "Add Smoothing Trajectory Filter"; } /*! \brief The work hourse of planning request adapters * \param planner A function called somewhere within this subroutine @@ -118,11 +118,11 @@ class AddSmoothingFilter : public planning_request_adapter::PlanningRequestAdapt * \param res the response, includes the robot trajectory and other info * \param added_path_index, a index of the points added by this adapter, which in this case will be empty */ - virtual bool adaptAndPlan(const PlannerFn &planner, + bool adaptAndPlan(const PlannerFn &planner, const planning_scene::PlanningSceneConstPtr& planning_scene, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res, - std::vector &added_path_index) const + std::vector &added_path_index) const override { // do anything prior to calling the planner here // .... From 32bf6860d3df75c7e5db97eb220eb1acea83feda Mon Sep 17 00:00:00 2001 From: v4hn Date: Thu, 30 Nov 2023 14:57:03 +0100 Subject: [PATCH 2/3] correctly define CONNECT_HANDSHAKE as unsigned `char` is signed by default and `142 > std::numeric_limits::max()` so clang -Werror complained. --- simple_message/include/simple_message/socket/udp_socket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_message/include/simple_message/socket/udp_socket.h b/simple_message/include/simple_message/socket/udp_socket.h index 083b4f19..3231a050 100644 --- a/simple_message/include/simple_message/socket/udp_socket.h +++ b/simple_message/include/simple_message/socket/udp_socket.h @@ -76,7 +76,7 @@ class UdpSocket : public industrial::simple_socket::SimpleSocket /** * \brief udp socket connect handshake value */ - static const char CONNECT_HANDSHAKE = 142; + static const unsigned char CONNECT_HANDSHAKE = 142; char udp_read_buffer_[MAX_BUFFER_SIZE + 1]; char* udp_read_head_; From 01f185dcb3df6bfc06d3472f9779ee3b79c87f19 Mon Sep 17 00:00:00 2001 From: v4hn Date: Wed, 13 Nov 2024 11:15:15 +0100 Subject: [PATCH 3/3] correct use of remove-erase pattern clang 16 notices the unused return value. --- industrial_robot_client/src/joint_trajectory_action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/industrial_robot_client/src/joint_trajectory_action.cpp b/industrial_robot_client/src/joint_trajectory_action.cpp index f73965b6..1d8c4132 100644 --- a/industrial_robot_client/src/joint_trajectory_action.cpp +++ b/industrial_robot_client/src/joint_trajectory_action.cpp @@ -56,7 +56,7 @@ JointTrajectoryAction::JointTrajectoryAction() : // The controller joint names parameter includes empty joint names for those joints not supported // by the controller. These are removed since the trajectory action should ignore these. - std::remove(joint_names_.begin(), joint_names_.end(), std::string()); + joint_names_.erase(std::remove(joint_names_.begin(), joint_names_.end(), std::string()), joint_names_.end()); ROS_INFO_STREAM_NAMED(name_, "Filtered joint names to " << joint_names_.size() << " joints"); pub_trajectory_command_ = node_.advertise("joint_path_command", 1);