Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Backport #2353 to humble (-Wpessimizing-move in intra_process_manager.hpp)

已关闭 适合新手
#3,308 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
backend

调研方向

检查 experimental/intra_process_manager.hpp 中第 465 行和第 507 行所标识的两个 std::move 调用,并将其与 rolling 上 #2353 中对应的更改进行比较。使用提供的 ROS Humble/GCC 命令重现该警告,然后验证该头文件在 -Wall 下构建时不会出现这两个 -Wpessimizing-move 警告。

由索引模型根据 Issue 内容生成。

描述

humble still has the two std::move(MessageUniquePtr(ptr, deleter)) calls in experimental/intra_process_manager.hpp (lines 465 and 507 in 16.0.19) that #2353 removed on rolling. Any package that calls Publisher::publish() and builds with -Wall on GCC 13 or newer gets two warnings from the header.

Repro with the ros:humble headers and GCC 15.3:

docker build -t rclcpp-humble-gcc15 - <<'EOF'
FROM ros:humble AS ros
FROM gcc:15
COPY --from=ros /opt/ros/humble /opt/ros/humble
EOF
docker run --rm rclcpp-humble-gcc15 bash -c '
  printf "%s\n" "#include <rclcpp/rclcpp.hpp>" "#include <std_msgs/msg/int32.hpp>" \
    "void f(rclcpp::Publisher<std_msgs::msg::Int32> & p) { p.publish(std_msgs::msg::Int32{}); }" > t.cpp
  g++ -std=c++17 -fsyntax-only -Wall t.cpp \
    $(find /opt/ros/humble/include -mindepth 1 -maxdepth 1 -type d -printf "-I%p ") 2>&1 | grep pessimizing'
intra_process_manager.hpp:465:51: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
intra_process_manager.hpp:507:68: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]

Dropping the two std::move calls the same way #2353 does silences both. Could it be backported to humble?

主要语言
C++
星标
814
派生
572
平均合并
5 天 3 小时
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ros2/rclcpp 的其他 Issue

查看 ros2/rclcpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。