[Webkit-unassigned] [Bug 225205] New: -Wpessimizing-move warnings in LocaleICU.cpp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 29 13:04:32 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225205

            Bug ID: 225205
           Summary: -Wpessimizing-move warnings in LocaleICU.cpp
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at gnome.org

It looks like GCC 11 has improved its -Wpessimizing-move warning:

[2866/5471] Building CXX object Source/WebCore/CMakeFiles...edSources/unified-sources/UnifiedSource-3c72abbe-58.cpp.o
In file included from WTF/Headers/wtf/FastMalloc.h:26,
                 from ../../Source/WebCore/config.h:56,
                 from ../../Source/WebCore/platform/text/TextEncodingRegistry.cpp:27,
                 from WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-58.cpp:1:
../../Source/WebCore/platform/text/LocaleICU.cpp: In member function ‘std::unique_ptr<WTF::Vector<WTF::String> > WebCore::LocaleICU::createLabelVector(void* const*, UDateFormatSymbolType, int32_t, int32_t)’:
WTF/Headers/wtf/StdLibExtras.h:563:58: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:185:12: note: in expansion of macro ‘WTFMove’
  185 |     return WTFMove(labels);
      |            ^~~~~~~
WTF/Headers/wtf/StdLibExtras.h:563:58: note: remove ‘std::move’ call
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:185:12: note: in expansion of macro ‘WTFMove’
  185 |     return WTFMove(labels);
      |            ^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp: In function ‘std::unique_ptr<WTF::Vector<WTF::String> > WebCore::createFallbackMonthLabels()’:
WTF/Headers/wtf/StdLibExtras.h:563:58: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:194:12: note: in expansion of macro ‘WTFMove’
  194 |     return WTFMove(labels);
      |            ^~~~~~~
WTF/Headers/wtf/StdLibExtras.h:563:58: note: remove ‘std::move’ call
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:194:12: note: in expansion of macro ‘WTFMove’
  194 |     return WTFMove(labels);
      |            ^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp: In function ‘std::unique_ptr<WTF::Vector<WTF::String> > WebCore::createFallbackAMPMLabels()’:
WTF/Headers/wtf/StdLibExtras.h:563:58: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:216:12: note: in expansion of macro ‘WTFMove’
  216 |     return WTFMove(labels);
      |            ^~~~~~~
WTF/Headers/wtf/StdLibExtras.h:563:58: note: remove ‘std::move’ call
  563 | #define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/WebCore/platform/text/LocaleICU.cpp:216:12: note: in expansion of macro ‘WTFMove’
  216 |     return WTFMove(labels);
      |            ^~~~~~~

This case is a little interesting because the return value is a std::unique_ptr, which is noncopyable. I can see why using WTFMove for that would be tempting. But it's not needed for a return value.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210429/f62d7f33/attachment-0001.htm>


More information about the webkit-unassigned mailing list