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

Remove warnings due to some captured variables #2575

Merged

Conversation

atrantan
Copy link

This patch tries to remove some warnings related to unused captured variables detected by Clang 5.0. Because most of those variables are copied via lambda capture for lifetime purpose, HPX_UNUSED() has been used. Also warnings are generated when local const variables are captured by value; some of those variables are then declared non-const in place of const.

@@ -32,7 +32,7 @@ void test_reduce1(ExPolicy policy, IteratorTag)
std::vector<std::size_t> c(10007);
std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Member

Choose a reason for hiding this comment

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

What's the rationale of this change?

Copy link
Author

Choose a reason for hiding this comment

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

Got this strange error from clang 5.0 although the variable is used inside the lambda : warning: lambda capture 'val' is not required to be captured for this use [-Wunused-lambda-capture]

@@ -55,7 +55,7 @@ void test_reduce1_async(ExPolicy p, IteratorTag)
std::vector<std::size_t> c(10007);
std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Member

Choose a reason for hiding this comment

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

What's the rationale of this change?

Copy link
Author

Choose a reason for hiding this comment

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

Same issue

@@ -79,7 +79,7 @@ void test_transform_reduce_async(ExPolicy p, IteratorTag)
std::vector<std::size_t> c(10007);
std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Member

Choose a reason for hiding this comment

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

What's the rationale of this change?

Copy link
Author

Choose a reason for hiding this comment

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

Same issue

@atrantan atrantan force-pushed the Remove_captured_variable_warnings branch from 397b55a to 219279f Compare March 31, 2017 21:00
@atrantan atrantan force-pushed the Remove_captured_variable_warnings branch from 219279f to 2687e9f Compare April 1, 2017 00:15
@hkaiser hkaiser merged commit a65d2c4 into STEllAR-GROUP:master Apr 1, 2017
@atrantan atrantan deleted the Remove_captured_variable_warnings branch May 16, 2017 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants