Closed Bug 1373625 Opened 8 years ago Closed 8 years ago

warning: lambda capture 'this' is not used [-Wunused-lambda-capture]

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

Details

Attachments

(1 file)

In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/layout/generic/Unified_cpp_layout_generic1.cpp:74: /home/sylvestre/dev/mozilla/mozilla-central.hg/layout/generic/nsContainerFrame.cpp:336:24: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] mProperties.ForEach([this, aLists] (const T& aProp, void* aValue) { ^
It's needed for the IsFrameOfType() call in the MOZ_ASSERT, so I don't think we can just remove it.
Perhaps we could make an exception and do a "capture all you need" in this case? [=] I guess since they are both pointers.
Comment on attachment 8878457 [details] Bug 1373625 - Silence a -Wunused-lambda-capture warning in nsContainerFrame.cpp https://reviewboard.mozilla.org/r/149808/#review154564 r- on current patch, since (as mats notes) it won't compile with ac_add_options --enable-debug, due to the MOZ_ASSERT usage of "this". If we really want to silence the warning, we could maybe just do... Unused << this; // silence clang -Wunused-lambda-capture in opt builds ...right after the MOZ_ASSERT? *shrug*
Attachment #8878457 - Flags: review?(dholbert) → review-
Sure, "Unused << this" works for me.
Flags: needinfo?(sledru)
voila!
Flags: needinfo?(sledru)
Comment on attachment 8878457 [details] Bug 1373625 - Silence a -Wunused-lambda-capture warning in nsContainerFrame.cpp https://reviewboard.mozilla.org/r/149808/#review156344 r=me with two nits: ::: commit-message-fe809:1 (Diff revision 2) > +Bug 1373625 - Silent a -Wunused-lambda-capture warning in nsContainerFrame.cpp r?dholbert s/Silent/Silence/ ::: layout/generic/nsContainerFrame.cpp:351 (Diff revision 2) > "found unexpected ExcessOverflowContainersProperty"); > L(aValue)->AppendIfNonempty(aLists, kExcessOverflowContainersList); > } else if (aProp == BackdropProperty()) { > L(aValue)->AppendIfNonempty(aLists, kBackdropList); > } > + Unused << this; // silence clang -Wunused-lambda-capture in opt builds Please put this new line *directly after* the MOZ_ASSERT, so that the debug-build-usage & the opt-build-hackaround are more clearly associated. (And if we happen to remove the MOZ_ASSERT someday, we'll be more likely to realize that we should drop the Unused<< as well, and then the compiler can help us figure out to drop the [this] lambda capture.)
Attachment #8878457 - Flags: review?(dholbert) → review+
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/85c7a1f9a5b4 Silence a -Wunused-lambda-capture warning in nsContainerFrame.cpp r=dholbert
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: