Skip to content

Fix clang warning: bugprone-use-after-move#2116

Merged
clalancette merged 1 commit intoros2:rollingfrom
mauropasse:mauro/fix-clang-warning
Mar 5, 2023
Merged

Fix clang warning: bugprone-use-after-move#2116
clalancette merged 1 commit intoros2:rollingfrom
mauropasse:mauro/fix-clang-warning

Conversation

@mauropasse
Copy link
Copy Markdown
Collaborator

@mauropasse mauropasse commented Mar 3, 2023

Fix clang warning: bugprone-use-after-move
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html

The fix is explicitly break from a for loop after the final message has been delivered.
Even if it we know we will exit the for loop,since we check

if (std::next(it) == subscription_ids.end()) {

this is not enough for clang-tidy and it complains.

Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Copy link
Copy Markdown
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.

Yeah, this is a good idea. I'll kick off CI for it.

@clalancette
Copy link
Copy Markdown
Contributor

CI:

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

@clalancette clalancette merged commit 1a9b117 into ros2:rolling Mar 5, 2023
@mauropasse mauropasse deleted the mauro/fix-clang-warning branch March 6, 2023 13:15
alsora pushed a commit to irobot-ros/rclcpp that referenced this pull request Apr 28, 2023
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
alsora pushed a commit to irobot-ros/rclcpp that referenced this pull request Apr 29, 2023
otamachan pushed a commit to otamachan/rclcpp that referenced this pull request Mar 20, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
otamachan pushed a commit to otamachan/rclcpp that referenced this pull request Mar 20, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
otamachan pushed a commit to otamachan/rclcpp that referenced this pull request Mar 20, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
Signed-off-by: Tamaki Nishino <otamachan@gmail.com>
mjcarroll pushed a commit that referenced this pull request Mar 29, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Signed-off-by: Tamaki Nishino <otamachan@gmail.com>
Co-authored-by: mauropasse <mauropasse@hotmail.com>
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
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.

4 participants