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

Suppress boost warnings about global placeholders #3147

Closed
wants to merge 1 commit into from

Conversation

alexdewar
Copy link
Contributor

@alexdewar alexdewar commented Dec 14, 2021

When building Gazebo, my build log is spammed with messages like the following:

[981/1131] Building CXX object plugins/CMakeFiles/FlashLightPlugin.dir/FlashLightPlugin.cc.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /home/alex/code/gazebo/gazebo/common/CommonTypes.hh:24,
                 from /home/alex/code/gazebo/gazebo/common/Plugin.hh:36,
                 from /home/alex/code/gazebo/plugins/FlashLightPlugin.cc:24:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’

Though it might make sense to follow the suggestion in the error message and not have these symbols in the global namespace, for now suppress this warning by defining BOOST_GLOBAL_PLACEHOLDERS so the build log is actually readable.

When building Gazebo, my build log is spammed with messages like the following:
```
[981/1131] Building CXX object plugins/CMakeFiles/FlashLightPlugin.dir/FlashLightPlugin.cc.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /home/alex/code/gazebo/gazebo/common/CommonTypes.hh:24,
                 from /home/alex/code/gazebo/gazebo/common/Plugin.hh:36,
                 from /home/alex/code/gazebo/plugins/FlashLightPlugin.cc:24:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
```

Though it might make sense to follow the suggestion in the error message and *not* have these symbols in the global namespace, for now suppress this warning by defining ``BOOST_GLOBAL_PLACEHOLDERS`` so the build log is actually readable.

Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
@alexdewar
Copy link
Contributor Author

The CI appears to be failing because of #2867, so it's not related to my changes.

@scpeters
Copy link
Member

scpeters commented Jan 5, 2022

what OS and version of boost are you using?

@scpeters
Copy link
Member

scpeters commented Jan 6, 2022

what OS and version of boost are you using?

We used to see these warnings in our CI, as reported in #2757. This was supposedly fixed for gazebo9 in #2809 and merged forward to gazebo11 in #2923. I don't see these warnings in our macOS CI, which is using a rather recent version of boost from homebrew. Can you provide details about how to reproduce these warnings?

@scpeters
Copy link
Member

scpeters commented Jan 6, 2022

would it be better to change all our includes of boost/bind.hpp to boost/bind/bind.hpp?

@scpeters
Copy link
Member

scpeters commented Jan 8, 2022

would it be better to change all our includes of boost/bind.hpp to boost/bind/bind.hpp?

I've opened an alternate pull request in #3156. @alexdewar can you confirm if that resolves the compiler warnings for you?

@scpeters
Copy link
Member

the fix was implemented in #3156. thanks again for raising the issue and submitting a fix

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.

None yet

3 participants