Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng Phù hợp với người mới
#3,308 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend

Hướng nghiên cứu

Kiểm tra experimental/intra_process_manager.hpp tại hai lệnh gọi std::move được xác định ở dòng 465 và 507, rồi so sánh thay đổi tương ứng trong #2353 trên rolling. Tái hiện cảnh báo bằng lệnh ROS Humble/GCC được cung cấp, sau đó xác minh rằng header build được mà không có hai cảnh báo -Wpessimizing-move khi dùng -Wall.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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?

Ngôn ngữ chính
C++
Star
814
Fork
572
Merge trung bình
4 ngày 8 giờ
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ros2/rclcpp

Tất cả issue của ros2/rclcpp

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.