-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 3.1.3
-
Component/s: Internal Code
-
None
-
Fully Compatible
-
ALL
-
Platform 8 08/28/15
clang-3.7 introduces a -Wpessimizing-move warning that "warns when a call to std::move would prevent copy elision if the argument was not wrapped in a call."
These are the current warnings with non-enterprise master (6ff771d5e):
src/mongo/client/dbclient.cpp:336:16: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] info = std::move(commandReply->getCommandReply().getOwned()); ^ src/mongo/client/dbclient.cpp:336:16: note: remove std::move call here info = std::move(commandReply->getCommandReply().getOwned()); ^~~~~~~~~~ ~
src/mongo/rpc/legacy_reply_builder.cpp:97:16: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] return std::move(message); ^ src/mongo/rpc/legacy_reply_builder.cpp:97:16: note: remove std::move call here return std::move(message); ^~~~~~~~~~ ~
src/mongo/rpc/metadata.cpp:54:57: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] return std::make_tuple(std::move(legacyCmdObj), std::move(metadataBob.obj())); ^ src/mongo/rpc/metadata.cpp:54:57: note: remove std::move call here return std::make_tuple(std::move(legacyCmdObj), std::move(metadataBob.obj()));
src/third_party/s2/base/logging.cc:33:51: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] LogMessageInfo::LogMessageInfo() : LogMessageBase(std::move(mongo::log())) { } ^ src/third_party/s2/base/logging.cc:33:51: note: remove std::move call here LogMessageInfo::LogMessageInfo() : LogMessageBase(std::move(mongo::log())) { }
src/mongo/util/decoration_registry.h:66:21: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] std::move(declareDecoration(sizeof(T), ^ src/mongo/util/decorable.h:105:49: note: in instantiation of function template specialization 'mongo::DecorationRegistry::declareDecoration<std::unique_ptr<mongo::AuthenticationSession, std::default_delete<mongo::AuthenticationSession> > >' requested here return Decoration<T>(getRegistry()->declareDecoration<T>()); ^ src/mongo/db/auth/auth_decorations.cpp:63:22: note: in instantiation of function template specialization 'mongo::Decorable<mongo::ClientBasic>::declareDecoration<std::unique_ptr<mongo::AuthenticationSession, std::default_delete<mongo::AuthenticationSession> > >' requested here ClientBasic::declareDecoration<std::unique_ptr<AuthenticationSession>>(); ^ src/mongo/util/decoration_registry.h:66:21: note: remove std::move call here std::move(declareDecoration(sizeof(T), ^~~~~~~~~~ src/mongo/util/decoration_registry.h:66:21: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] std::move(declareDecoration(sizeof(T), ^ src/mongo/util/decorable.h:105:49: note: in instantiation of function template specialization 'mongo::DecorationRegistry::declareDecoration<std::unique_ptr<mongo::AuthorizationManager, std::default_delete<mongo::AuthorizationManager> > >' requested here return Decoration<T>(getRegistry()->declareDecoration<T>()); ^ src/mongo/db/auth/auth_decorations.cpp:66:25: note: in instantiation of function template specialization 'mongo::Decorable<mongo::ServiceContext>::declareDecoration<std::unique_ptr<mongo::AuthorizationManager, std::default_delete<mongo::AuthorizationManager> > >' requested here ServiceContext::declareDecoration<std::unique_ptr<AuthorizationManager>>(); ^ src/mongo/util/decoration_registry.h:66:21: note: remove std::move call here std::move(declareDecoration(sizeof(T), ^~~~~~~~~~ src/mongo/util/decoration_registry.h:66:21: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] std::move(declareDecoration(sizeof(T), ^ src/mongo/util/decorable.h:105:49: note: in instantiation of function template specialization 'mongo::DecorationRegistry::declareDecoration<std::unique_ptr<mongo::AuthorizationSession, std::default_delete<mongo::AuthorizationSession> > >' requested here return Decoration<T>(getRegistry()->declareDecoration<T>()); ^ src/mongo/db/auth/auth_decorations.cpp:69:22: note: in instantiation of function template specialization 'mongo::Decorable<mongo::ClientBasic>::declareDecoration<std::unique_ptr<mongo::AuthorizationSession, std::default_delete<mongo::AuthorizationSession> > >' requested here ClientBasic::declareDecoration<std::unique_ptr<AuthorizationSession>>(); ^ src/mongo/util/decoration_registry.h:66:21: note: remove std::move call here std::move(declareDecoration(sizeof(T), ^~~~~~~~~~
src/mongo/s/balance.cpp:573:40: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] writeConcern = std::move(balancerConfig.getWriteConcern()); ^ src/mongo/s/balance.cpp:573:40: note: remove std::move call here writeConcern = std::move(balancerConfig.getWriteConcern());