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

Avoid range-loop-construct in TopicManager #2983

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

Karsten1987
Copy link
Contributor

Clang (on OSX) issues a warning at the TopicManager:

/usr/local/Cellar/gazebo11/11.3.0/include/gazebo-11/gazebo/transport/TopicManager.hh:131:37: error: loop variable 'liter' of type 'const boost::shared_ptr<gazebo::transport::Node>' creates a copy from type 'const boost::shared_ptr<gazebo::transport::Node>' [-Werror,-Wrange-loop-construct]
                    for (const auto liter : iter2.second)
                                    ^
/usr/local/Cellar/gazebo11/11.3.0/include/gazebo-11/gazebo/transport/TopicManager.hh:131:26: note: use reference type 'const boost::shared_ptr<gazebo::transport::Node> &' to prevent copying
                    for (const auto liter : iter2.second)
                         ^~~~~~~~~~~~~~~~~~
                                    &
1 error generated.

As proposed, using it as a reference silences the warning.

Clang (on OSX) issues a warning at the TopicManager:
```
/usr/local/Cellar/gazebo11/11.3.0/include/gazebo-11/gazebo/transport/TopicManager.hh:131:37: error: loop variable 'liter' of type 'const boost::shared_ptr<gazebo::transport::Node>' creates a copy from type 'const boost::shared_ptr<gazebo::transport::Node>' [-Werror,-Wrange-loop-construct]
                    for (const auto liter : iter2.second)
                                    ^
/usr/local/Cellar/gazebo11/11.3.0/include/gazebo-11/gazebo/transport/TopicManager.hh:131:26: note: use reference type 'const boost::shared_ptr<gazebo::transport::Node> &' to prevent copying
                    for (const auto liter : iter2.second)
                         ^~~~~~~~~~~~~~~~~~
                                    &
1 error generated.
```

As proposed, using it as a reference silences the warning.
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

looks reasonable

out of curiosity, which version of macOS are you using?

@Karsten1987
Copy link
Contributor Author

using OSX: 10.14.6

 ➭ clang --version
clang version 10.0.1
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

@j-rivero j-rivero merged commit 5f17068 into gazebosim:gazebo11 Apr 30, 2021
@Karsten1987 Karsten1987 deleted the patch-1 branch April 30, 2021 18:24
@Karsten1987
Copy link
Contributor Author

Thank you for merging. Is there any chance this can land in a new homebrew version?

@j-rivero
Copy link
Contributor

Thank you for merging. Is there any chance this can land in a new homebrew version?

I probably need to release a new gazebo11 patch version during the next week, is that good enough for you sir? or do you want it sooner? :p

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