[webkit-dev] -Wpessimizing-move and -Wredundant-move

Michael Catanzaro mcatanzaro at igalia.com
Mon Mar 18 16:56:15 PDT 2019

On Mon, Mar 18, 2019 at 4:43 PM, Andy Estes <aestes at apple.com> wrote:
> FWIW, Apple’s ports use the equivalent clang warning for 
> pessimizing and redundant moves, and we cleaned up a bunch of these 
> mistakes in our ports a few years ago. Hopefully you aren’t finding 
> any of these mistakes in shared code.

There are a lot, actually. Maybe clang only has -Wpessimizing-move 
(which caused relatively few warnings) and not -Wredundant-move (which 
caused very many). I'm not actually sure what the difference is; in 
both cases, a local variable is cast to rvalue reference via std::move 
before it is returned.

Anyway: patch in https://bugs.webkit.org/show_bug.cgi?id=195920, review 
appreciated. That patch also fixes several -Wdeprecated-copy warnings 
and a couple -Wclass-memaccess, but the vast majority is just removing 

> (WTFMove was written to accommodate these warnings, in fact.)
> Really glad you’re turning these warnings on!

Note we actually haven't changed our warning flags, they're just new 
warnings enabled by -Wextra, and we've always used -Wextra. So let's 
thank the GCC developers. Each new GCC is a ruined day for me whenever 
I try to make WebKit build cleanly, but the warnings are worth it.


More information about the webkit-dev mailing list