[SERVER-21290] remove pessimizing moves Created: 04/Nov/15  Updated: 31/Mar/16  Resolved: 17/Nov/15

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.2.0-rc4

Type: Improvement Priority: Major - P3
Reporter: Eric Milkie Assignee: Kaloian Manassiev
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-23444 Pessimizing moves break compile on cl... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding C (11/20/15)
Participants:

 Comments   
Comment by Githook User [ 17/Nov/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-21290 Fix pessimizing move warning in shard_registry.cpp
Branch: master
https://github.com/mongodb/mongo/commit/01548b4ee7484dfb1f3d59f3b48cd52653b9239f

Comment by Eric Milkie [ 11/Nov/15 ]

src/mongo/s/client/shard_registry.cpp:506:21: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
            return {std::move(result)};
                    ^
src/mongo/s/client/shard_registry.cpp:506:21: note: remove std::move call here
            return {std::move(result)};
                    ^~~~~~~~~~      ~
src/mongo/s/client/shard_registry.cpp:655:21: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
            return {std::move(response)};
                    ^
src/mongo/s/client/shard_registry.cpp:655:21: note: remove std::move call here
            return {std::move(response)};
                    ^~~~~~~~~~        ~

Comment by Eric Milkie [ 04/Nov/15 ]

Clang 3.7 is now the default version on Fedora 23, so I expect we'll be adding such a compiler to our build armada soon.

Comment by Mathias Stearn [ 04/Nov/15 ]

Clang 3.7 catches it. At the moment that is (was) the only one. We did a pass and scrubbed the others a while ago. The only reason this one remained is that it is in a unittest so isn't picked up when compiling core.

Comment by Spencer Brody (Inactive) [ 04/Nov/15 ]

Is this something coverity could be catching?

Comment by Githook User [ 04/Nov/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-21290 remove pessimizing move
Branch: master
https://github.com/mongodb/mongo/commit/71e4c39d173c849a705b8eb0b29769a45a59d8a0

Generated at Thu Feb 08 03:56:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.