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

Fix clang compile error - [-Werror,-Wunused-lambda-capture] #1972

Closed
wants to merge 1 commit into from
Closed

Fix clang compile error - [-Werror,-Wunused-lambda-capture] #1972

wants to merge 1 commit into from

Conversation

grooverdan
Copy link
Contributor

Errors where:

db/version_set.cc:1535:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
[this](const Fsize& f1, const Fsize& f2) -> bool {
^
db/version_set.cc:1541:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
[this](const Fsize& f1, const Fsize& f2) -> bool {
^
db/db_test.cc:2983:27: error: lambda capture 'kNumPutsBeforeWaitForFlush' is not required to be captured for this use [-Werror,-Wunused-lambda-capture]
auto gen_l0_kb = [this, kNumPutsBeforeWaitForFlush](int size) {
^

Errors where:

db/version_set.cc:1535:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
                  [this](const Fsize& f1, const Fsize& f2) -> bool {
                   ^
db/version_set.cc:1541:20: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
                  [this](const Fsize& f1, const Fsize& f2) -> bool {
                   ^
db/db_test.cc:2983:27: error: lambda capture 'kNumPutsBeforeWaitForFlush' is not required to be captured for this use [-Werror,-Wunused-lambda-capture]
  auto gen_l0_kb = [this, kNumPutsBeforeWaitForFlush](int size) {
                          ^
clang version 5.0.0 (llvm-clang.git 79a6eca386d468058b31e2d4f54b1b736a12f558)
                    (llvm.git 31f450353208e4d108fff264a2eba433758a0709)

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
@facebook-github-bot
Copy link
Contributor

@siying has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@siying
Copy link
Contributor

siying commented Mar 23, 2017

Thank you for your contribution!

@grooverdan
Copy link
Contributor Author

thanks for reviewing/merging. Have a nice day.

@grooverdan grooverdan deleted the clang-compile-errors branch March 23, 2017 01:09
@siying
Copy link
Contributor

siying commented Mar 23, 2017

@grooverdan sorry I didn't realized that it broke the Windows build: https://ci.appveyor.com/project/Facebook/rocksdb/build/1.0.3679

c:\projects\rocksdb\db\db_test.cc(2993): error C3493: 'kNumPutsBeforeWaitForFlush' cannot be implicitly captured because no default capture mode has been specified [C:\projects\rocksdb\build\db_test.vcxproj]

This warning is directly contradicting with what you have fixed. Can you figure out what's going on?

@siying
Copy link
Contributor

siying commented Mar 23, 2017

@grooverdan Maybe I can move kNumPutsBeforeWaitForFlush into the lambda function to resolve the problem. Let me give it a try.

siying added a commit to siying/rocksdb that referenced this pull request Mar 23, 2017
@siying
Copy link
Contributor

siying commented Mar 23, 2017

#2032

@grooverdan
Copy link
Contributor Author

Looks like a good fix. Apologies for not checking the Windows CI either. I guess we'll see soon if Windows is happy with that.

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

3 participants