r236075 - Add -Wpessimizing-move and -Wredundant-move warnings.

David Blaikie dblaikie at gmail.com
Mon May 4 10:38:51 PDT 2015


On Sat, May 2, 2015 at 11:47 AM, Nico Weber <thakis at chromium.org> wrote:

> On Wed, Apr 29, 2015 at 2:41 AM, Benjamin Kramer <benny.kra at gmail.com>
> wrote:
>
>> On Wed, Apr 29, 2015 at 5:59 AM, Richard Trieu <rtrieu at google.com> wrote:
>> > Since this warning did not exist when std::move was first introduced,
>> and
>> > many people are not familiar with copy elision rules, there have been a
>> lot
>> > of uses of the pessimizing move pattern.  In relative numbers, the
>> > pessimizing move warning is over 5x more common than either the range
>> loop
>> > warning (-Wrange-loop-analysis) or the proposed comma warning (-Wcomma).
>> > With such a high occurrence, it seemed better not to have it on by
>> default.
>>
>> And every single occurence is a potential performance issue and easy
>> to fix. While this may be too noisy for default, it's definitely a
>> candidate for -Wall imho.
>>
>
> +1. As-is, nobody will find this warning. And in general, the bar for
> warnings is "useful enough to be in -Wall, or it shouldn't be there",
> right? (Which this warning definitely is.)
>

I think the bar at least used to be "useful enough to be on by default or
it shouldn't be there" (the big exception in any analysis based warning
because building the CFG costs some non-trivial % - so we keep /all/ of
those off by default). Doug particularly espoused this notion & I've mostly
been promoting it since then on the assumption that that was still the goal
- though I don't agree with it entirely myself.

- David


>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150504/aa9f2e49/attachment.html>


More information about the cfe-commits mailing list