Skip to content

Directives: remove parens to silence gcc8 warning #844

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

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

coneiric
Copy link

Fixes -Wparentheses warning from gcc8 builds.

Example build output:

cpp-netlib/boost/network/protocol/http/message/directives/status_message.hpp:17:1: note: in expansion of macro 'BOO
ST_NETWORK_STRING_DIRECTIVE'                                                                                                                
 BOOST_NETWORK_STRING_DIRECTIVE(status_message, status_message_,                                                                            
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                             
cpp-netlib/boost/network/message/directives/detail/string_directive.hpp:37:21: warning: unnecessary parentheses in 
declaration of 'uri_' [-Wparentheses]                                                                                                       
     ValueType const&((value));

@anonimal
Copy link

Can you also PR this to branch 0.13-release?

@coneiric
Copy link
Author

Absolutely, will PR now.

@@ -34,7 +34,7 @@
#define BOOST_NETWORK_STRING_DIRECTIVE(name, value, body, pod_body) \
template <class ValueType> \
struct name##_directive { \
ValueType const&((value)); \
ValueType const& value; \
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this change. I think, though, a better way to go about this might be to use a different name for the member variable, and use the token concatenation to do this properly. Say, something like:

ValueType const& value##_;
explicit name##_directive(ValueType const& v) : value##_(v) {}

Then also change all the occurences of just value to use the member variable value##_ instead?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for this change. I think, though, a better way to go about this might be to use a different name for the member variable, and use the token concatenation to do this properly.

You're welcome. I can make the changes to the member variable using token concatenation. I'm not very familiar with macro black magic, so wanted to make the most conservative changes possible.

Just so I understand you correctly, the changes would be:

... : value##_(value_) {}
... : value##_(other.value) {}

in addition to your example above? Or would other.value also need to become other.value##_?

@ghost
Copy link

ghost commented May 30, 2018 via email

@coneiric coneiric force-pushed the fix-gcc8-paren-warning branch from 70fdea7 to 1848435 Compare May 31, 2018 03:35
@coneiric
Copy link
Author

I've made the changes to get a working build in the 0.13-release version of this pull request.

I would like to add the same changes to this PR, but there appears to be a missing commit for the _ext/breathe submodule:

error: Server does not allow request for unadvertised object 853385ef4f0c3dd126887750e20d5f7456065998
Fetched in submodule path 'libs/network/doc/_ext/breathe', but it did not contain 853385ef4f0c3dd126887750e20d5f7456065998. Direct fetching of that commit failed.

Rebasing on the current master did not work either, as it also fails to build:

cpp-netlib/deps/uri/src/boost/mpl/assert.hpp:188:21: error: unnecessary parentheses in declaration of 'assert_arg' [-Werror=p$
rentheses]                                                                                                                                  
 failed ************ (Pred::************

Several errors like the one above are issued. Please advise, and thank you for your time.

@deanberris
Copy link
Member

I've just merged a couple of PRs that were meant to address this. You're probably going to have to update the submodules after your rebase:

https://git-scm.com/docs/git-submodule#git-submodule-update--init--remote-N--no-fetch--no-recommend-shallow-f--force--checkout--rebase--merge--referenceltrepositorygt--depthltdepthgt--recursive--jobsltngt--ltpathgt82308203

Does that work?

@coneiric
Copy link
Author

You're probably going to have to update the submodules

I've updated my submodules before and after your post, no change. Master does not build with the error messages posted above.

While we are working on this issue, would you please merge the change for the 0.13-release branch, since this issue does not exist there?

@deanberris
Copy link
Member

Okay, I thought #847 did that for the master branch but it actually did it for the 0.13-release branch -- my bad. Yes, I'll cherry-pick that and attempt to push.

@deanberris
Copy link
Member

Alright, please rebase past 604d611 on master. Let me know if that works.

@coneiric
Copy link
Author

Alright, please rebase past 604d611 on master. Let me know if that works.

Unfortunately, still broken... Same errors.

@deanberris
Copy link
Member

Try:

# after rebasing your branch onto master
git submodule update --remote
git submodule update

You should see that the submodule definitions have been updated.

@coneiric
Copy link
Author

I understand that you updated the submodules. However, the master build is still borked:

In file included from cpp-netlib/deps/uri/src/boost/mpl/aux_/na_assert.hpp:23,
                 from cpp-netlib/deps/uri/src/boost/mpl/arg.hpp:25,                                                                            from cpp-netlib/deps/uri/src/boost/mpl/placeholders.hpp:24,
                 from cpp-netlib/deps/uri/src/boost/iterator/iterator_categories.hpp:17,                                     
                 from cpp-netlib/deps/uri/src/boost/iterator/iterator_facade.hpp:14,
                 from cpp-netlib/deps/uri/src/boost/range/iterator_range_core.hpp:27,
                 from cpp-netlib/deps/uri/src/detail/../boost/algorithm/string/find.hpp:16,
                 from cpp-netlib/deps/uri/src/detail/uri_resolve.cpp:16:
cpp-netlib/deps/uri/src/boost/mpl/assert.hpp:188:21: error: unnecessary parentheses in declaration of 'assert_arg' [-Werror=pa
rentheses]                                                                                                                                   failed ************ (Pred::************
                     ^                                            
cpp-netlib/deps/uri/src/boost/mpl/assert.hpp:193:21: error: unnecessary parentheses in declaration of 'assert_not_arg' [-Werro
r=parentheses]                                                  
 failed ************ (network_boost::mpl::not_<Pred>::************
                     ^                                         
In file included from cpp-netlib/deps/uri/src/boost/mpl/aux_/na_assert.hpp:23,                                                                 from cpp-netlib/deps/uri/src/boost/mpl/arg.hpp:25,
                 from cpp-netlib/deps/uri/src/boost/mpl/placeholders.hpp:24,                                                                   from cpp-netlib/deps/uri/src/boost/iterator/iterator_categories.hpp:17,
                 from cpp-netlib/deps/uri/src/boost/iterator/iterator_adaptor.hpp:14,                                        
                 from cpp-netlib/deps/uri/src/boost/iterator/transform_iterator.hpp:12,
                 from cpp-netlib/deps/uri/src/boost/algorithm/string/iter_find.hpp:17,
                 from cpp-netlib/deps/uri/src/detail/../boost/algorithm/string/split.hpp:16,
                 from cpp-netlib/deps/uri/src/detail/uri_normalize.cpp:14:
cpp-netlib/deps/uri/src/boost/mpl/assert.hpp:188:21: error: unnecessary parentheses in declaration of 'assert_arg' [-Werror=pa
rentheses]                   
 failed ************ (Pred::************
                     ^
cpp-netlib/deps/uri/src/boost/mpl/assert.hpp:193:21: error: unnecessary parentheses in declaration of 'assert_not_arg' [-Werro
r=parentheses]
 failed ************ (network_boost::mpl::not_<Pred>::************

This occurs with both versions of the submodules.

@coneiric coneiric force-pushed the fix-gcc8-paren-warning branch from 1848435 to cdf7613 Compare June 21, 2018 22:07
@deanberris
Copy link
Member

LGTM

That's now an issue with the URI library, probably want to either get @glynos to update the implementation of Boost things in there or consider turning off that warning in the URI builds. I'm happy to merge now.

@coneiric
Copy link
Author

I'm happy to merge now.

Thank you @deanberris. Hopefully, @glynos will be able to help with the URI issue.

@deanberris deanberris merged commit b284b14 into cpp-netlib:master Jun 21, 2018
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.

3 participants