Bug 212421

Summary: -Wdeprecated-copy caused by Bitmap copy assignment operator
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: Web Template FrameworkAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, mark.lam, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch none

Description Michael Catanzaro 2020-05-27 11:26:37 PDT
Continued from bug #212190, r262030 introduced a warning spam with GCC:

introduced a nice GCC warning spam:

In file included from DerivedSources/JavaScriptCore/unified-sources/UnifiedSource-f0a787a9-2.cpp:5:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp:194:16: warning: implicitly-declared ‘constexpr WTF::Bitmap<4>::Bitmap(const WTF::Bitmap<4>&)’ is deprecated [-Wdeprecated-copy]
  194 |         return result;
      |                ^~~~~~

because:

DerivedSources/ForwardingHeaders/wtf/Bitmap.h:480:13: note: because ‘WTF::Bitmap<4>’ has user-provided ‘void WTF::Bitmap<bitmapSize, WordType>::operator=(const WTF::Bitmap<bitmapSize, WordType>&) [with long unsigned int bitmapSize = 4; WordType = unsigned int]’
  480 | inline void Bitmap<bitmapSize, WordType>::operator=(const Bitmap& other)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

To avoid the warning, we should either (a) remove the copy assignment operator, or (b) add a copy constructor. Either way would be fine, but in this case I'd prefer (a) because I don't think the new copy assignment operator is needed. It uses a loop to manually copy the bits of the sole member variable, a std::array, but a default copy of the array should be equivalent (and possibly also a bit faster).
Comment 1 Michael Catanzaro 2020-05-27 11:31:46 PDT
Created attachment 400356 [details]
Patch
Comment 2 Mark Lam 2020-05-27 11:34:39 PDT
Comment on attachment 400356 [details]
Patch

Removal of the assignment operator is not an option.  This was added as a step for upcoming work.  I'll need to take a closer look at what the GCC complaint is and decide what the best solution is.
Comment 3 Mark Lam 2020-05-27 11:45:36 PDT
Comment on attachment 400356 [details]
Patch

I stand corrected.  Michael pointed out on slack that the default assignment operator would take care of the job.  There's no need for my hand written one.

r=me if theAPI test bots are green.
Comment 4 Mark Lam 2020-05-27 12:51:57 PDT
Comment on attachment 400356 [details]
Patch

API bots are green.  Landing this.
Comment 5 EWS 2020-05-27 13:15:52 PDT
Committed r262211: <https://trac.webkit.org/changeset/262211>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400356 [details].
Comment 6 Radar WebKit Bug Importer 2020-05-27 13:16:18 PDT
<rdar://problem/63687389>