Bug 1572639 - Use std::move to avoid -Wreturn-std-move warning. r=dragana
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 14 Aug 2019 19:38:23 +0000
changeset 488171 68712754591070fdc3188d57f501b1c4a19a71ff
parent 488170 15849d06fab7a070e56badc4664fb945313f0ed9
child 488172 9468a3143e3826ad7a4a00341a7fca8c5b2d9c77
push id36437
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:33:18 +0000
treeherdermozilla-central@44aac6fc3352 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1572639
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1572639 - Use std::move to avoid -Wreturn-std-move warning. r=dragana Actually, compiler outputs the following warning for android build. ``` 35:44.69 warning: netwerk/protocol/http/nsHttpHandler.cpp:165:12 [-Wreturn-std-move] local variable 'deviceString' will be copied despite being returned by name 35:44.69 warning: netwerk/protocol/http/nsHttpHandler.cpp:167:10 [-Wreturn-std-move] local variable 'deviceModelId' will be copied despite being returned by name ``` We should use std::move to fix this. Differential Revision: https://phabricator.services.mozilla.com/D41327
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -157,19 +157,19 @@ static nsCString GetDeviceModelId() {
     deviceModelId = NS_LossyConvertUTF16toASCII(androidDevice);
   }
   nsAutoCString deviceString;
   rv = Preferences::GetCString(UA_PREF("device_string"), deviceString);
   if (NS_SUCCEEDED(rv)) {
     deviceString.Trim(" ", true, true);
     deviceString.ReplaceSubstring(NS_LITERAL_CSTRING("%DEVICEID%"),
                                   deviceModelId);
-    return deviceString;
+    return std::move(deviceString);
   }
-  return deviceModelId;
+  return std::move(deviceModelId);
 }
 #endif
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler <public>
 //-----------------------------------------------------------------------------
 
 StaticRefPtr<nsHttpHandler> gHttpHandler;