diff options
author | Friedemann Kleint <[email protected]> | 2022-09-22 10:08:16 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2022-09-23 05:50:37 +0000 |
commit | f419206841764323c244bf91051b2878451c17b6 (patch) | |
tree | 136dfd9c4658b019f7da7196827de599865b3f65 /sources/shiboken6/tests | |
parent | 29775a7cdf032955f2f40ea3487f1ea634cc8500 (diff) |
shiboken6/test: Fix warnings about implicitly generated assignment operators
Fix warnings like:
warning: implicitly-declared constexpr Pen& Pen::operator=(const Pen&) is deprecated [-Wdeprecated-copy]
by removing definitions of copy constructors/assignment operators which
are equivalent to the default generated ones or spell out the special
methods were needed.
Pick-to: 6.3 6.2
Change-Id: Ie7cb335707f8bdd297b0ceea969909bc809016d7
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests')
-rw-r--r-- | sources/shiboken6/tests/libsample/bytearray.cpp | 7 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/bytearray.h | 1 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/filter.cpp | 10 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/filter.h | 6 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/list.h | 18 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/listuser.cpp | 7 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/listuser.h | 9 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/modelindex.h | 20 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/pen.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/pen.h | 5 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/str.cpp | 9 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/str.h | 2 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/strlist.h | 6 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsample/valueandvirtual.h | 1 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsmart/smart.cpp | 6 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsmart/smart_integer.h | 3 |
16 files changed, 58 insertions, 56 deletions
diff --git a/sources/shiboken6/tests/libsample/bytearray.cpp b/sources/shiboken6/tests/libsample/bytearray.cpp index 40f1ebc84..2ed80bf51 100644 --- a/sources/shiboken6/tests/libsample/bytearray.cpp +++ b/sources/shiboken6/tests/libsample/bytearray.cpp @@ -32,13 +32,6 @@ ByteArray::ByteArray(const char* data, int len) m_data[len] = '\0'; } -ByteArray::ByteArray(const ByteArray& other) -{ - m_data = std::vector<char>(other.size() + 1); - memcpy(&m_data[0], &other.m_data[0], other.size()); - m_data[other.size()] = '\0'; -} - int ByteArray::size() const { diff --git a/sources/shiboken6/tests/libsample/bytearray.h b/sources/shiboken6/tests/libsample/bytearray.h index 3e5d4b100..e4504d755 100644 --- a/sources/shiboken6/tests/libsample/bytearray.h +++ b/sources/shiboken6/tests/libsample/bytearray.h @@ -15,7 +15,6 @@ public: ByteArray(char data); ByteArray(const char* data); ByteArray(const char* data, int len); - ByteArray(const ByteArray& other); int size() const; char at(int i) const; diff --git a/sources/shiboken6/tests/libsample/filter.cpp b/sources/shiboken6/tests/libsample/filter.cpp index 3f2ac70b0..09c8c89ed 100644 --- a/sources/shiboken6/tests/libsample/filter.cpp +++ b/sources/shiboken6/tests/libsample/filter.cpp @@ -18,11 +18,6 @@ Union::Union(const Intersection& filter) m_filters.push_back(filter); } -Union::Union(const Union& filter) -{ - m_filters = filter.filters(); -} - Intersection::Intersection(const Data& filter) { m_filters.push_back(filter); @@ -33,11 +28,6 @@ Intersection::Intersection(const Union& filter) m_filters.push_back(filter); } -Intersection::Intersection(const Intersection& filter) -{ - m_filters = filter.filters(); -} - Intersection operator&(const Intersection& a, const Intersection& b) { Intersection filter; diff --git a/sources/shiboken6/tests/libsample/filter.h b/sources/shiboken6/tests/libsample/filter.h index 266785ad7..d778342ff 100644 --- a/sources/shiboken6/tests/libsample/filter.h +++ b/sources/shiboken6/tests/libsample/filter.h @@ -41,8 +41,7 @@ public: Union(const Data&); Union(const Intersection&); - Union() {}; - Union(const Union&); + Union() = default; std::list<Filter> filters() const { return m_filters; } void addFilter(const Filter& data) { m_filters.push_back(data); } @@ -57,8 +56,7 @@ public: Intersection(const Data&); Intersection(const Union&); - Intersection() {}; - Intersection(const Intersection&); + Intersection() = default; std::list<Filter> filters() const { return m_filters; } void addFilter(const Filter& data) { m_filters.push_back(data); } diff --git a/sources/shiboken6/tests/libsample/list.h b/sources/shiboken6/tests/libsample/list.h index 59a46960e..5b0eabb02 100644 --- a/sources/shiboken6/tests/libsample/list.h +++ b/sources/shiboken6/tests/libsample/list.h @@ -27,9 +27,13 @@ public: inline IntList() : m_ctorUsed(NoParamsCtor) {} inline explicit IntList(int val) : m_ctorUsed(IntCtor) { push_back(val); } - inline IntList(const IntList& lst) : List<int>(lst), m_ctorUsed(CopyCtor) {} inline IntList(const List<int>& lst) : List<int>(lst), m_ctorUsed(ListOfIntCtor) {} + inline IntList(const IntList& lst) : List<int>(lst), m_ctorUsed(CopyCtor) {} + IntList(IntList &&) = default; + IntList &operator=(const IntList &) = default; + IntList &operator=(IntList &&) = default; + inline void append(int v) { insert(end(), v); } CtorEnum constructorUsed() { return m_ctorUsed; } private: @@ -48,9 +52,13 @@ public: inline PointValueList() : m_ctorUsed(NoParamsCtor) {} inline explicit PointValueList(Point val) : m_ctorUsed(PointCtor) { push_back(val); } - inline PointValueList(const PointValueList& lst) : List<Point>(lst), m_ctorUsed(CopyCtor) {} inline PointValueList(const List<Point>& lst) : List<Point>(lst), m_ctorUsed(ListOfPointValuesCtor) {} + inline PointValueList(const PointValueList& lst) : List<Point>(lst), m_ctorUsed(CopyCtor) {} + PointValueList(PointValueList &&) = default; + PointValueList &operator=(const PointValueList &) = default; + PointValueList &operator=(PointValueList &&) = default; + inline void append(Point v) { insert(end(), v); } CtorEnum constructorUsed() { return m_ctorUsed; } private: @@ -69,9 +77,13 @@ public: inline ObjectTypePtrList() : m_ctorUsed(NoParamsCtor) {} inline explicit ObjectTypePtrList(ObjectType* val) : m_ctorUsed(ObjectTypeCtor) { push_back(val); } - inline ObjectTypePtrList(const ObjectTypePtrList& lst) : List<ObjectType*>(lst), m_ctorUsed(CopyCtor) {} inline ObjectTypePtrList(const List<ObjectType*>& lst) : List<ObjectType*>(lst), m_ctorUsed(ListOfObjectTypePtrCtor) {} + inline ObjectTypePtrList(const ObjectTypePtrList& lst) : List<ObjectType*>(lst), m_ctorUsed(CopyCtor) {} + ObjectTypePtrList(ObjectTypePtrList &&) = default; + ObjectTypePtrList &operator=(const ObjectTypePtrList &) = default; + ObjectTypePtrList &operator=(ObjectTypePtrList &&) = default; + inline void append(ObjectType* v) { insert(end(), v); } CtorEnum constructorUsed() { return m_ctorUsed; } private: diff --git a/sources/shiboken6/tests/libsample/listuser.cpp b/sources/shiboken6/tests/libsample/listuser.cpp index f68b82b5a..574644397 100644 --- a/sources/shiboken6/tests/libsample/listuser.cpp +++ b/sources/shiboken6/tests/libsample/listuser.cpp @@ -13,6 +13,13 @@ ListUser::callCreateList() return createList(); } +ListUser::ListUser() = default; +ListUser::ListUser(const ListUser &other) = default; +ListUser::ListUser(ListUser &&other) = default; +ListUser &ListUser::operator=(const ListUser &other) = default; +ListUser &ListUser::operator=(ListUser &&other) = default; +ListUser::~ListUser() = default; + std::list<int> ListUser::createList() { diff --git a/sources/shiboken6/tests/libsample/listuser.h b/sources/shiboken6/tests/libsample/listuser.h index 0f564f0e5..9351ffb7a 100644 --- a/sources/shiboken6/tests/libsample/listuser.h +++ b/sources/shiboken6/tests/libsample/listuser.h @@ -21,9 +21,12 @@ public: ListOfPointF }; - ListUser() {} - ListUser(const ListUser& other) : m_lst(other.m_lst) {} - virtual ~ListUser() {} + ListUser(); + ListUser(const ListUser &other); + ListUser(ListUser &&other); + ListUser &operator=(const ListUser &other); + ListUser &operator=(ListUser &&other); + virtual ~ListUser(); virtual std::list<int> createList(); std::list<int> callCreateList(); diff --git a/sources/shiboken6/tests/libsample/modelindex.h b/sources/shiboken6/tests/libsample/modelindex.h index 21980c887..6ed192329 100644 --- a/sources/shiboken6/tests/libsample/modelindex.h +++ b/sources/shiboken6/tests/libsample/modelindex.h @@ -9,21 +9,22 @@ class ModelIndex { public: - ModelIndex() : m_value(0) {} - ModelIndex(const ModelIndex& other) { m_value = other.m_value; } + ModelIndex() = default; + inline void setValue(int value) { m_value = value; } inline int value() const { return m_value; } static int getValue(const ModelIndex& index) { return index.value(); } private: - int m_value; + int m_value = 0; }; class ReferentModelIndex { public: - ReferentModelIndex() {} - ReferentModelIndex(const ModelIndex& index) : m_index(index) {} - ReferentModelIndex(const ReferentModelIndex& other) { m_index = other.m_index; } + ReferentModelIndex() = default; + + explicit ReferentModelIndex(const ModelIndex& index) : m_index(index) {} + inline void setValue(int value) { m_index.setValue(value); } inline int value() const { return m_index.value(); } operator const ModelIndex&() const { return m_index; } @@ -34,9 +35,10 @@ private: class PersistentModelIndex { public: - PersistentModelIndex() {} - PersistentModelIndex(const ModelIndex& index) : m_index(index) {} - PersistentModelIndex(const PersistentModelIndex& other) { m_index = other.m_index; } + PersistentModelIndex() = default; + + explicit PersistentModelIndex(const ModelIndex& index) : m_index(index) {} + inline void setValue(int value) { m_index.setValue(value); } inline int value() const { return m_index.value(); } operator ModelIndex() const { return m_index; } diff --git a/sources/shiboken6/tests/libsample/pen.cpp b/sources/shiboken6/tests/libsample/pen.cpp index 877246506..fd1fee877 100644 --- a/sources/shiboken6/tests/libsample/pen.cpp +++ b/sources/shiboken6/tests/libsample/pen.cpp @@ -61,6 +61,10 @@ Pen::Pen(const Pen& pen) : m_ctor(CopyCtor) { } +Pen::Pen(Pen &&) = default; +Pen &Pen::operator=(const Pen& pen) = default; +Pen &Pen::operator=(Pen &&) = default; + int Pen::ctorType() { return m_ctor; diff --git a/sources/shiboken6/tests/libsample/pen.h b/sources/shiboken6/tests/libsample/pen.h index 770623519..114810d25 100644 --- a/sources/shiboken6/tests/libsample/pen.h +++ b/sources/shiboken6/tests/libsample/pen.h @@ -49,7 +49,10 @@ public: Pen(); Pen(SampleNamespace::Option option); Pen(const Color& color); - Pen(const Pen& pen); + Pen(const Pen &pen); + Pen(Pen &&); + Pen &operator=(const Pen &pen); + Pen &operator=(Pen &&); // PYSIDE-1325, default initializer void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {}); diff --git a/sources/shiboken6/tests/libsample/str.cpp b/sources/shiboken6/tests/libsample/str.cpp index f8d1b726f..dd7909bef 100644 --- a/sources/shiboken6/tests/libsample/str.cpp +++ b/sources/shiboken6/tests/libsample/str.cpp @@ -9,11 +9,6 @@ using namespace std; -Str::Str(const Str& s) -{ - init(s.cstring()); -} - Str::Str(char c) { char str[2] = { c, 0 }; @@ -32,10 +27,6 @@ Str::init(const char* cstr) m_str = cstr; } -Str::~Str() -{ -} - Str Str::arg(const Str& s) const { diff --git a/sources/shiboken6/tests/libsample/str.h b/sources/shiboken6/tests/libsample/str.h index 0b75348c7..a58f34bdb 100644 --- a/sources/shiboken6/tests/libsample/str.h +++ b/sources/shiboken6/tests/libsample/str.h @@ -10,10 +10,8 @@ class LIBSAMPLE_API Str { public: - Str(const Str& s); Str(char c); Str(const char* cstr = ""); - ~Str(); Str arg(const Str& s) const; diff --git a/sources/shiboken6/tests/libsample/strlist.h b/sources/shiboken6/tests/libsample/strlist.h index 52b7e5951..eb89b4c58 100644 --- a/sources/shiboken6/tests/libsample/strlist.h +++ b/sources/shiboken6/tests/libsample/strlist.h @@ -21,9 +21,13 @@ public: inline StrList() : m_ctorUsed(NoParamsCtor) {} inline explicit StrList(const Str& str) : m_ctorUsed(StrCtor) { push_back(str); } - inline StrList(const StrList& lst) : std::list<Str>(lst), m_ctorUsed(CopyCtor) {} inline StrList(const std::list<Str>& lst) : std::list<Str>(lst), m_ctorUsed(ListOfStrCtor) {} + inline StrList(const StrList &lst) : std::list<Str>(lst), m_ctorUsed(CopyCtor) {} + StrList(StrList &&) = default; + StrList &operator=(const StrList &) = default; + StrList &operator=(StrList &&) = default; + inline void append(Str str) { push_back(str); } Str join(const Str& sep) const; diff --git a/sources/shiboken6/tests/libsample/valueandvirtual.h b/sources/shiboken6/tests/libsample/valueandvirtual.h index d5a9be6b5..25391cc0c 100644 --- a/sources/shiboken6/tests/libsample/valueandvirtual.h +++ b/sources/shiboken6/tests/libsample/valueandvirtual.h @@ -8,7 +8,6 @@ class ValueAndVirtual { public: ValueAndVirtual(int id) : m_id(id) {} - ValueAndVirtual(const ValueAndVirtual &other) { m_id = other.m_id; } bool operator()(int id, int id2) { return id == id2; } diff --git a/sources/shiboken6/tests/libsmart/smart.cpp b/sources/shiboken6/tests/libsmart/smart.cpp index 58f84474b..2273040f9 100644 --- a/sources/shiboken6/tests/libsmart/smart.cpp +++ b/sources/shiboken6/tests/libsmart/smart.cpp @@ -268,7 +268,5 @@ Smart::Integer2::Integer2() { } -Smart::Integer2::Integer2(const Smart::Integer2 &other) - : Integer (other) -{ -} +Smart::Integer2::Integer2(const Smart::Integer2 &) = default; +Smart::Integer2 &Smart::Integer2::operator=(const Integer2 &) = default; diff --git a/sources/shiboken6/tests/libsmart/smart_integer.h b/sources/shiboken6/tests/libsmart/smart_integer.h index 5135ec9e4..f2381cabb 100644 --- a/sources/shiboken6/tests/libsmart/smart_integer.h +++ b/sources/shiboken6/tests/libsmart/smart_integer.h @@ -56,7 +56,8 @@ namespace Smart { class LIB_SMART_API Integer2 : public Integer { public: Integer2(); - Integer2(const Integer2 &other); + Integer2(const Integer2 &); + Integer2 &operator=(const Integer2 &); }; } // namespace Smart |