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

Michael Catanzaro mcatanzaro at igalia.com
Mon Mar 18 14:35:57 PDT 2019


GCC 9 has new -Wpessimizing-move ("warning: moving a local object in a 
return statement prevents copy elision") and -Wredundant-move 
("warning: redundant move in return statement") warnings. These are 
enabled by -Wextra (which we use) and will be triggered by code like:

return WTFMove(foo);

when foo is a copyable type. This idiom is only appropriate if foo is a 
noncopyable (move-only) type. We have many, many instances of such 
code. I'm trying to fix them. Please don't add more! (It's easy enough 
to disable the warnings, but they're there for a reason.)



More information about the webkit-dev mailing list