Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 May 2018 10:24:24 +0000 (10:24 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 May 2018 10:24:24 +0000 (10:24 +0000)
<https://webkit.org/b/185621>

Reviewed by Youenn Fablet.

Fix warnings like the following:

    In file included from DerivedSources/WebCore/unified-sources/UnifiedSource139.cpp:5:
    ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: error: local variable 'sdp' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
            return sdp;
                   ^~~
    ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: note: call 'std::move' explicitly to avoid copying
            return sdp;
                   ^~~
                   std::move(sdp)
    1 error generated.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::filterSDP const):
* accessibility/AccessibilityObject.cpp:
(WebCore::rangeClosestToRange):
* bindings/js/JSDOMConvertSequences.h:
(WebCore::Detail::GenericSequenceConverter::convert):
(WebCore::Detail::NumericSequenceConverter::convertArray):
* bindings/js/JSDOMConvertStrings.cpp:
(WebCore::stringToByteString):
(WebCore::stringToUSVString):
- Use WTFMove() in return statements to fix the warnings.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231796 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/bindings/js/JSDOMConvertSequences.h
Source/WebCore/bindings/js/JSDOMConvertStrings.cpp

index b959a4f..018ac36 100644 (file)
@@ -1,3 +1,34 @@
+2018-05-15  David Kilzer  <ddkilzer@apple.com>
+
+        Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
+        <https://webkit.org/b/185621>
+
+        Reviewed by Youenn Fablet.
+
+        Fix warnings like the following:
+
+            In file included from DerivedSources/WebCore/unified-sources/UnifiedSource139.cpp:5:
+            ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: error: local variable 'sdp' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
+                    return sdp;
+                           ^~~
+            ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: note: call 'std::move' explicitly to avoid copying
+                    return sdp;
+                           ^~~
+                           std::move(sdp)
+            1 error generated.
+
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::filterSDP const):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::rangeClosestToRange):
+        * bindings/js/JSDOMConvertSequences.h:
+        (WebCore::Detail::GenericSequenceConverter::convert):
+        (WebCore::Detail::NumericSequenceConverter::convertArray):
+        * bindings/js/JSDOMConvertStrings.cpp:
+        (WebCore::stringToByteString):
+        (WebCore::stringToUSVString):
+        - Use WTFMove() in return statements to fix the warnings.
+
 2018-05-14  Dean Jackson  <dino@apple.com>
 
         Download and present System Preview
index dc51bb5..e12a086 100644 (file)
@@ -409,7 +409,7 @@ static String filterICECandidate(String&& sdp)
 String PeerConnectionBackend::filterSDP(String&& sdp) const
 {
     if (!m_shouldFilterICECandidates)
-        return sdp;
+        return WTFMove(sdp);
 
     StringBuilder filteredSDP;
     sdp.split('\n', false, [&filteredSDP](StringView line) {
index 6f2e198..f6d6022 100644 (file)
@@ -731,9 +731,9 @@ static RefPtr<Range> rangeClosestToRange(Range* referenceRange, RefPtr<Range>&&
     if (!afterRange && !beforeRange)
         return nullptr;
     if (afterRange && !beforeRange)
-        return afterRange;
+        return WTFMove(afterRange);
     if (!afterRange && beforeRange)
-        return beforeRange;
+        return WTFMove(beforeRange);
     
     unsigned positionsToAfterRange = Position::positionCountBetweenPositions(afterRange->startPosition(), referenceRange->endPosition());
     unsigned positionsToBeforeRange = Position::positionCountBetweenPositions(beforeRange->endPosition(), referenceRange->startPosition());
index 2b3da22..b071802 100644 (file)
@@ -57,7 +57,7 @@ struct GenericSequenceConverter {
                 return;
             result.append(WTFMove(convertedValue));
         });
-        return result;
+        return WTFMove(result);
     }
 
     static ReturnType convert(JSC::ExecState& state, JSC::JSObject* object, JSC::JSValue method)
@@ -75,7 +75,7 @@ struct GenericSequenceConverter {
                 return;
             result.append(WTFMove(convertedValue));
         });
-        return result;
+        return WTFMove(result);
     }
 };
 
@@ -99,7 +99,7 @@ struct NumericSequenceConverter {
                 else
                     result.uncheckedAppend(indexValue.asInt32());
             }
-            return result;
+            return WTFMove(result);
         }
 
         ASSERT(indexingType == JSC::DoubleShape);
@@ -114,7 +114,7 @@ struct NumericSequenceConverter {
                 result.uncheckedAppend(convertedValue);
             }
         }
-        return result;
+        return WTFMove(result);
     }
 
     static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
index 7d2de18..1ca1ce3 100644 (file)
@@ -39,7 +39,7 @@ static inline String stringToByteString(ExecState& state, JSC::ThrowScope& scope
         return { };
     }
 
-    return string;
+    return WTFMove(string);
 }
 
 String identifierToByteString(ExecState& state, const Identifier& identifier)
@@ -78,7 +78,7 @@ static inline String stringToUSVString(String&& string)
 {
     // Fast path for the case where there are no unpaired surrogates.
     if (!hasUnpairedSurrogate(string))
-        return string;
+        return WTFMove(string);
 
     // Slow path: http://heycam.github.io/webidl/#dfn-obtain-unicode
     // Replaces unpaired surrogates with the replacement character.