Skip to content

Remove warnings due to some captured variables#2575

Merged
hkaiser merged 2 commits into
TheHPXProject:masterfrom
atrantan:Remove_captured_variable_warnings
Apr 1, 2017
Merged

Remove warnings due to some captured variables#2575
hkaiser merged 2 commits into
TheHPXProject:masterfrom
atrantan:Remove_captured_variable_warnings

Conversation

@atrantan
Copy link
Copy Markdown

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.

std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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]

std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same issue

std::iota(boost::begin(c), boost::end(c), std::rand());

std::size_t const val(42);
std::size_t val(42);
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 TheHPXProject: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.

2 participants