Bug 212421 - -Wdeprecated-copy caused by Bitmap copy assignment operator
Summary: -Wdeprecated-copy caused by Bitmap copy assignment operator
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
Keywords: InRadar
Depends on:
Reported: 2020-05-27 11:26 PDT by Michael Catanzaro
Modified: 2020-05-27 13:16 PDT (History)
7 users (show)

See Also:

Patch (1.81 KB, patch)
2020-05-27 11:31 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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;
      |                ^~~~~~


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]
Comment 2 Mark Lam 2020-05-27 11:34:39 PDT
Comment on attachment 400356 [details]

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]

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]

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