Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed clang issues #55

Merged
merged 5 commits into from
Feb 19, 2024
Merged

Fixed clang issues #55

merged 5 commits into from
Feb 19, 2024

Conversation

ahcorde
Copy link
Collaborator

@ahcorde ahcorde commented Feb 14, 2024

According with this log https://ci.ros2.org/view/nightly/job/nightly_linux_clang_libcxx/1797/console there are some issue with clang. This PR try to fix them

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
@ahcorde ahcorde requested a review from clalancette February 14, 2024 14:47
@ahcorde ahcorde self-assigned this Feb 14, 2024
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a few things to think about.

@@ -264,25 +264,25 @@ class PointCloudTransport : public PointCloudTransportLoader
const std::string & base_topic, rmw_qos_profile_t custom_qos,
void (T::* fp)(const sensor_msgs::msg::PointCloud2::ConstSharedPtr &) const, T * obj,
const point_cloud_transport::TransportHints * transport_hints = nullptr,
bool allow_concurrent_callbacks = false)
bool /*allow_concurrent_callbacks*/ = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to suggest that instead of doing this, we actually just remove this parameter completely. As far as I can tell, it is never used by any callers or callees.

}

template<class T>
point_cloud_transport::Subscriber subscribe(
const std::string & base_topic, uint32_t queue_size,
void (T::* fp)(const sensor_msgs::msg::PointCloud2::ConstSharedPtr &) const, T * obj,
const point_cloud_transport::TransportHints * transport_hints = nullptr,
bool allow_concurrent_callbacks = false)
bool /*allow_concurrent_callbacks*/ = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -92,7 +94,7 @@ class PublisherPlugin

//! Publish a point cloud using the transport associated with this PublisherPlugin.
POINT_CLOUD_TRANSPORT_PUBLIC
virtual void publish(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & message) const;
virtual void publishPtr(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & message) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why rename this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two main reasons:

  • I was getting this warning
hidden overloaded virtual function 'point_cloud_transport::PublisherPlugin::publish' declared here: different number of parameters (1 vs 2)
  • To have the same API as image_Transport

Comment on lines 44 to 45
// TODO(ahcorde): Review this, infinite recursion
// return this->encode(raw);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is concerning, we should probably understand what is happening here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting this error message:

 warning: all paths through this function will call itself [-Winfinite-recursion]

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
@ahcorde ahcorde requested a review from clalancette February 16, 2024 12:28
@clalancette clalancette mentioned this pull request Feb 16, 2024
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now, with green CI.

I'll suggest merging in #57 first, then rebasing and running CI on this one (including Clang CI).

Comment on lines -41 to -46
PublisherPlugin::EncodeResult PublisherPlugin::encode(const sensor_msgs::msg::PointCloud2 & raw)
const
{
return this->encode(raw);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Yeah, clang is totally right about the old code; any call to this function will just have it call itself. What we really wanted is to have this as a pure virtual function, which this change now does. So I think this is good now.

@ahcorde
Copy link
Collaborator Author

ahcorde commented Feb 19, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit af0790f into rolling Feb 19, 2024
4 checks passed
@ahcorde ahcorde deleted the ahcorde/rolling/clang_warnings branch February 19, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants