Skip to content

Fix incorrect macro usage#2037

Merged
vooon merged 1 commit intomavlink:ros2from
mishmetall:pr/fix_make_unique
May 6, 2025
Merged

Fix incorrect macro usage#2037
vooon merged 1 commit intomavlink:ros2from
mishmetall:pr/fix_make_unique

Conversation

@mishmetall
Copy link
Contributor

RCLCPP_SMART_PTR_DEFINITIONS eventually is expanding to:

#define __RCLCPP_MAKE_UNIQUE_DEFINITION(...)
template<typename ... Args>
static std::unique_ptr<VA_ARGS>
make_unique(Args && ... args)
{
return std::unique_ptr<VA_ARGS>(new VA_ARGS(std::forward(args) ...));
}

which is incorrect for abstract classes like Endpoint or Plugin

RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE is used instead excluding make_unique functionality

This allows to use clang compiler to build mavros

RCLCPP_SMART_PTR_DEFINITIONS eventually is expanding to:

\#define __RCLCPP_MAKE_UNIQUE_DEFINITION(...) \
  template<typename ... Args> \
  static std::unique_ptr<__VA_ARGS__> \
  make_unique(Args && ... args) \
  { \
    return std::unique_ptr<__VA_ARGS__>(new __VA_ARGS__(std::forward<Args>(args) ...)); \
  }

which is incorrect for abstract classes like Endpoint or Plugin

RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE is used instead excluding make_unique functionality
Copy link
Member

@vooon vooon left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@vooon vooon merged commit aa534f1 into mavlink:ros2 May 6, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments