Bug 185621 - Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
Summary: Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
Keywords: InRadar
Depends on:
Reported: 2018-05-14 12:39 PDT by David Kilzer (:ddkilzer)
Modified: 2018-05-15 03:24 PDT (History)
10 users (show)

See Also:

Patch v1 (5.74 KB, patch)
2018-05-14 12:42 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.78 MB, application/zip)
2018-05-14 16:47 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2018-05-14 12:39:49 PDT
Building WebKit with a newer clang compiler enables a -Wreturn-std-move warning that catches cases where a parameter is passed by rvalue reference (T&& t), but then gets copied when returning that reference by value from the function (return t).

For example, this method:

    String PeerConnectionBackend::filterSDP(String&& sdp) const

generates a warning like this:

    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;
    1 error generated.
Comment 1 David Kilzer (:ddkilzer) 2018-05-14 12:42:58 PDT
Created attachment 340343 [details]
Patch v1
Comment 2 Radar WebKit Bug Importer 2018-05-14 14:07:44 PDT
Comment 3 EWS Watchlist 2018-05-14 16:47:22 PDT
Comment on attachment 340343 [details]
Patch v1

Attachment 340343 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/7682747

New failing tests:
Comment 4 EWS Watchlist 2018-05-14 16:47:33 PDT
Created attachment 340377 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 5 WebKit Commit Bot 2018-05-15 03:24:29 PDT
Comment on attachment 340343 [details]
Patch v1

Clearing flags on attachment: 340343

Committed r231796: <https://trac.webkit.org/changeset/231796>
Comment 6 WebKit Commit Bot 2018-05-15 03:24:31 PDT
All reviewed patches have been landed.  Closing bug.