Changeset 260431 in webkit


Ignore:
Timestamp:
Apr 21, 2020 9:21:31 AM (4 years ago)
Author:
cturner@igalia.com
Message:

[Clang 10] Fix warning: definition of implicit copy assignment operator for 'PageBlock' is deprecated because it has a user-declared copy constructor
https://bugs.webkit.org/show_bug.cgi?id=210748

Reviewed by Adrian Perez de Castro.

Recent Clang's will issue a warning if you declare an explicit
copy construction, but leave the compiler to fill in an implicit
assignment operator. I think this is to catch cases where you do
something exciting in an assignment operator/copy constructor and
forget to do the same exciting thing in the other.

  • wtf/PageAllocation.h: Import the base's constructor to avoid

defining our own identical one.

  • wtf/PageBlock.h: Remove trivial constructor and replace with

member initializers. Remove copy constructor. This looks identical
to what the compiler would generate anyway.

Location:
trunk/Source/WTF
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r260425 r260431  
     12020-04-21  Charlie Turner  <cturner@igalia.com>
     2
     3        [Clang 10] Fix warning: definition of implicit copy assignment operator for 'PageBlock' is deprecated because it has a user-declared copy constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=210748
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Recent Clang's will issue a warning if you declare an explicit
     9        copy construction, but leave the compiler to fill in an implicit
     10        assignment operator. I think this is to catch cases where you do
     11        something exciting in an assignment operator/copy constructor and
     12        forget to do the same exciting thing in the other.
     13
     14        * wtf/PageAllocation.h: Import the base's constructor to avoid
     15        defining our own identical one.
     16        * wtf/PageBlock.h: Remove trivial constructor and replace with
     17        member initializers. Remove copy constructor. This looks identical
     18        to what the compiler would generate anyway.
     19
    1202020-04-21  Claudio Saavedra  <csaavedra@igalia.com>
    221
  • trunk/Source/WTF/wtf/PageAllocation.h

    r237099 r260431  
    7070class PageAllocation : private PageBlock {
    7171public:
    72     PageAllocation()
    73     {
    74     }
    75 
     72    using PageBlock::PageBlock;
    7673    using PageBlock::size;
    7774    using PageBlock::base;
  • trunk/Source/WTF/wtf/PageBlock.h

    r260179 r260431  
    6767    WTF_MAKE_FAST_ALLOCATED;
    6868public:
    69     PageBlock();
    70     PageBlock(const PageBlock&);
     69    PageBlock() = default;
    7170    PageBlock(void*, size_t, bool hasGuardPages);
    7271   
     
    8382
    8483private:
    85     void* m_realBase;
    86     void* m_base;
    87     size_t m_size;
     84    void* m_realBase { nullptr };
     85    void* m_base { nullptr };
     86    size_t m_size { 0 };
    8887};
    89 
    90 inline PageBlock::PageBlock()
    91     : m_realBase(0)
    92     , m_base(0)
    93     , m_size(0)
    94 {
    95 }
    96 
    97 inline PageBlock::PageBlock(const PageBlock& other)
    98     : m_realBase(other.m_realBase)
    99     , m_base(other.m_base)
    100     , m_size(other.m_size)
    101 {
    102 }
    10388
    10489inline PageBlock::PageBlock(void* base, size_t size, bool hasGuardPages)
Note: See TracChangeset for help on using the changeset viewer.