Chromium Code Reviews
DescriptionReenable -Wunused-lambda-capture warning.
This warning has been recently introduced into Clang,
and a lot of Clang ToT bots went red because Chromium
had a number of cases where lambdas had unused lambdas.
Note: there is an annoying bug in MSVC++ regarding to
capturing const values. Consider the code like:
const int N = 3;
auto g = [N](){ printf("%d\n", N); };
g();
Clang will issue a warning that N capture is unused. Okay, we remove it:
const int N = 3;
auto g = [](){ printf("%d\n", N); };
g();
but then MSVC++ is unhappy. And that's a bug in MSVC++, see
https://social.msdn.microsoft.com/Forums/SqlServer/4abf18bd-4ae4-4c72-ba3e-3b...
http://connect.microsoft.com/VisualStudio/feedback/details/725780/lambda-expr...
(will require to sign in, and might not show its contents anyway)
http://wap.cpp.forum24.ru/?1-3-0-00000034-000-0-0 (in Russian; by the author of
the original bug report to Microsoft, Сыроежка)
The workaround is to have such constants static:
static const int N = 3;
auto g = [](){ printf("%d\n", N); };
g();
The cleanup is now complete, and it's time to reenable
the warning. I have tested it on Linux x86-64 by building
All targets. They succeeded.
Theoretically, some platform-specific code might still
have issues like that, but it should be trivial to fix
them, when they are detected by Clang ToT bots.
BUG=681136
Patch Set 1 #
Messages
Total messages: 14 (8 generated)
|
|||||||||||||||||||