diff options
author | Friedemann Kleint <[email protected]> | 2023-10-05 13:10:06 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2023-10-06 11:32:18 +0200 |
commit | 92a4a2a0ed7a8a391406030d1db813de7dd31429 (patch) | |
tree | c601d58eb97099c343f2c496aced18f9d0988530 /sources/shiboken6/tests | |
parent | dc11b2d45959ebd4a088dcd7dbcc24a1753a62b3 (diff) |
shiboken tests: Fix special functions (simple cases)
Introduce convenience macros similar to the Qt macros
and specify the special functions where missing.
Pick-to: 6.6
Task-number: PYSIDE-2479
Change-Id: I761a08e3e3c9393e1f2bb0514e2ad4de52cd99a0
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Shyamnath Premnadh <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests')
35 files changed, 159 insertions, 60 deletions
diff --git a/sources/shiboken6/tests/libminimal/libminimalmacros.h b/sources/shiboken6/tests/libminimal/libminimalmacros.h index e0dfdd196..099c1f1de 100644 --- a/sources/shiboken6/tests/libminimal/libminimalmacros.h +++ b/sources/shiboken6/tests/libminimal/libminimalmacros.h @@ -22,4 +22,28 @@ # define LIBMINIMAL_API LIBMINIMAL_IMPORT #endif +#define LIBMINIMAL_DEFAULT_COPY(Class) \ + Class(const Class &) noexcept = default; \ + Class &operator=(const Class &) noexcept = default; + +#define LIBMINIMAL_DISABLE_COPY(Class) \ + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; + +#define LIBMINIMAL_DEFAULT_MOVE(Class) \ + Class(Class &&) noexcept = default; \ + Class &operator=(Class &&) noexcept = default; + +#define LIBMINIMAL_DEFAULT_COPY_MOVE(Class) \ + LIBMINIMAL_DEFAULT_COPY(Class) \ + LIBMINIMAL_DEFAULT_MOVE(Class) + +#define LIBMINIMAL_DISABLE_MOVE(Class) \ + Class(Class &&) = delete; \ + Class &operator=(Class &&) = delete; + +#define LIBMINIMAL_DISABLE_COPY_MOVE(Class) \ + LIBMINIMAL_DISABLE_COPY(Class) \ + LIBMINIMAL_DISABLE_MOVE(Class) + #endif // LIBMINIMALMACROS_H diff --git a/sources/shiboken6/tests/libminimal/listuser.h b/sources/shiboken6/tests/libminimal/listuser.h index e11f7638b..9904ef27d 100644 --- a/sources/shiboken6/tests/libminimal/listuser.h +++ b/sources/shiboken6/tests/libminimal/listuser.h @@ -14,6 +14,10 @@ struct LIBMINIMAL_API ListUser { + LIBMINIMAL_DEFAULT_COPY(ListUser) + LIBMINIMAL_DISABLE_MOVE(ListUser) + + ListUser() noexcept = default; virtual ~ListUser() = default; // List of C++ primitive type items diff --git a/sources/shiboken6/tests/libminimal/minbool.h b/sources/shiboken6/tests/libminimal/minbool.h index 168ca4863..e460f466b 100644 --- a/sources/shiboken6/tests/libminimal/minbool.h +++ b/sources/shiboken6/tests/libminimal/minbool.h @@ -31,7 +31,10 @@ inline bool operator!=(MinBool b1, MinBool b2) { return (!b1).value() != (!b2).v class LIBMINIMAL_API MinBoolUser { public: - MinBoolUser() : m_minbool(MinBool(false)) {} + LIBMINIMAL_DEFAULT_COPY(MinBoolUser) + LIBMINIMAL_DISABLE_MOVE(MinBoolUser) + + MinBoolUser() noexcept : m_minbool(MinBool(false)) {} virtual ~MinBoolUser() = default; inline MinBool minBool() { return m_minbool; } inline void setMinBool(MinBool minBool) { m_minbool = minBool; } diff --git a/sources/shiboken6/tests/libminimal/obj.cpp b/sources/shiboken6/tests/libminimal/obj.cpp index f21fb5454..a63a9c3c9 100644 --- a/sources/shiboken6/tests/libminimal/obj.cpp +++ b/sources/shiboken6/tests/libminimal/obj.cpp @@ -3,7 +3,7 @@ #include "obj.h" -Obj::Obj(int objId) : m_objId(objId) +Obj::Obj(int objId) noexcept : m_objId(objId) { } diff --git a/sources/shiboken6/tests/libminimal/obj.h b/sources/shiboken6/tests/libminimal/obj.h index 55a798c02..be0bfb52b 100644 --- a/sources/shiboken6/tests/libminimal/obj.h +++ b/sources/shiboken6/tests/libminimal/obj.h @@ -9,7 +9,9 @@ class LIBMINIMAL_API Obj { public: - explicit Obj(int objId); + LIBMINIMAL_DISABLE_COPY_MOVE(Obj) + + explicit Obj(int objId) noexcept; virtual ~Obj(); int objId() const { return m_objId; } @@ -25,8 +27,6 @@ public: Obj* callPassObjectTypeReference(Obj& obj) { return passObjectTypeReference(obj); } private: - Obj(const Obj&); - Obj& operator=(const Obj&); int m_objId; }; diff --git a/sources/shiboken6/tests/libminimal/val.h b/sources/shiboken6/tests/libminimal/val.h index f6a19c166..50f090a7d 100644 --- a/sources/shiboken6/tests/libminimal/val.h +++ b/sources/shiboken6/tests/libminimal/val.h @@ -9,7 +9,9 @@ class LIBMINIMAL_API Val { public: - explicit Val(int valId) : m_valId(valId) {} + explicit Val(int valId) noexcept : m_valId(valId) {} + LIBMINIMAL_DEFAULT_COPY_MOVE(Val) + virtual ~Val() = default; int valId() const { return m_valId; } diff --git a/sources/shiboken6/tests/libsample/abstract.cpp b/sources/shiboken6/tests/libsample/abstract.cpp index 89e7336ad..648cedcd0 100644 --- a/sources/shiboken6/tests/libsample/abstract.cpp +++ b/sources/shiboken6/tests/libsample/abstract.cpp @@ -7,7 +7,7 @@ const int Abstract::staticPrimitiveField = 0; -Abstract::Abstract(int id) : m_id(id) +Abstract::Abstract(int id) noexcept : m_id(id) { bitField = 0; } diff --git a/sources/shiboken6/tests/libsample/abstract.h b/sources/shiboken6/tests/libsample/abstract.h index bc63e3fd1..1e62a9c51 100644 --- a/sources/shiboken6/tests/libsample/abstract.h +++ b/sources/shiboken6/tests/libsample/abstract.h @@ -24,6 +24,8 @@ private: PrivValue2 = PrivValue1 + 2 }; public: + LIBMINIMAL_DISABLE_COPY_MOVE(Abstract) + enum PrintFormat { Short, Verbose, @@ -45,7 +47,7 @@ public: int toBeRenamedField = 123; int readOnlyField = 123; - Abstract(int id = -1); + explicit Abstract(int id = -1) noexcept; virtual ~Abstract(); inline int id() const { return m_id; } diff --git a/sources/shiboken6/tests/libsample/blackbox.h b/sources/shiboken6/tests/libsample/blackbox.h index 2cc8c66bd..9d32670dd 100644 --- a/sources/shiboken6/tests/libsample/blackbox.h +++ b/sources/shiboken6/tests/libsample/blackbox.h @@ -17,7 +17,8 @@ public: using ObjectTypeMap = std::map<int, ObjectType*>; using PointMap = std::map<int, Point*>; - BlackBox() = default; + LIBMINIMAL_DEFAULT_COPY_MOVE(BlackBox) + BlackBox() noexcept = default; ~BlackBox(); int keepObjectType(ObjectType *object); diff --git a/sources/shiboken6/tests/libsample/collector.h b/sources/shiboken6/tests/libsample/collector.h index 1322cdeff..26766847a 100644 --- a/sources/shiboken6/tests/libsample/collector.h +++ b/sources/shiboken6/tests/libsample/collector.h @@ -13,10 +13,9 @@ class LIBSAMPLE_API Collector { public: - Collector() = default; + Collector() noexcept = default; virtual ~Collector() = default; - Collector(const Collector &) = delete; - Collector &operator=(const Collector &) = delete; + LIBMINIMAL_DISABLE_COPY_MOVE(Collector) void clear(); diff --git a/sources/shiboken6/tests/libsample/complex.cpp b/sources/shiboken6/tests/libsample/complex.cpp index 36ac19389..e3bec9aae 100644 --- a/sources/shiboken6/tests/libsample/complex.cpp +++ b/sources/shiboken6/tests/libsample/complex.cpp @@ -5,7 +5,7 @@ #include <iostream> -Complex::Complex(double real, double imag) +Complex::Complex(double real, double imag) noexcept : m_real(real), m_imag(imag) { } diff --git a/sources/shiboken6/tests/libsample/complex.h b/sources/shiboken6/tests/libsample/complex.h index 16be1facc..168fe5c44 100644 --- a/sources/shiboken6/tests/libsample/complex.h +++ b/sources/shiboken6/tests/libsample/complex.h @@ -9,7 +9,9 @@ class LIBSAMPLE_API Complex { public: - Complex(double real = 0.0, double imag = 0.0); + LIBMINIMAL_DEFAULT_COPY_MOVE(Complex) + + explicit Complex(double real = 0.0, double imag = 0.0) noexcept; ~Complex() = default; inline double real() const { return m_real; } diff --git a/sources/shiboken6/tests/libsample/ctorconvrule.h b/sources/shiboken6/tests/libsample/ctorconvrule.h index 96862288a..a5411b749 100644 --- a/sources/shiboken6/tests/libsample/ctorconvrule.h +++ b/sources/shiboken6/tests/libsample/ctorconvrule.h @@ -9,7 +9,9 @@ class CtorConvRule { public: - explicit CtorConvRule(long value) : m_value(value) {} + LIBMINIMAL_DEFAULT_COPY_MOVE(CtorConvRule) + + explicit CtorConvRule(long value) noexcept : m_value(value) {} virtual ~CtorConvRule() = default; virtual void dummyVirtualMethod() {} long value() { return m_value; } diff --git a/sources/shiboken6/tests/libsample/derived.cpp b/sources/shiboken6/tests/libsample/derived.cpp index e7a30f311..d20880431 100644 --- a/sources/shiboken6/tests/libsample/derived.cpp +++ b/sources/shiboken6/tests/libsample/derived.cpp @@ -5,7 +5,7 @@ #include <iostream> -Derived::Derived(int id) : Abstract(id) +Derived::Derived(int id) noexcept : Abstract(id) { } diff --git a/sources/shiboken6/tests/libsample/derived.h b/sources/shiboken6/tests/libsample/derived.h index 2f1caf2c7..b7736c37a 100644 --- a/sources/shiboken6/tests/libsample/derived.h +++ b/sources/shiboken6/tests/libsample/derived.h @@ -15,6 +15,8 @@ enum OverloadedFuncEnum { class LIBSAMPLE_API Derived : public Abstract { public: + LIBMINIMAL_DISABLE_COPY_MOVE(Derived) + enum OtherOverloadedFuncEnum { OtherOverloadedFunc_iibd, OtherOverloadedFunc_id @@ -27,7 +29,7 @@ public: bool operator==(const SomeInnerClass &) { return true; } }; - explicit Derived(int id = -1); + explicit Derived(int id = -1) noexcept; ~Derived() override; void pureVirtual() override; void *pureVirtualReturningVoidPtr() override; diff --git a/sources/shiboken6/tests/libsample/echo.h b/sources/shiboken6/tests/libsample/echo.h index 688bdf45d..01b11a4a6 100644 --- a/sources/shiboken6/tests/libsample/echo.h +++ b/sources/shiboken6/tests/libsample/echo.h @@ -12,7 +12,9 @@ class ObjectType; class Echo { public: - Echo() = default; + LIBMINIMAL_DEFAULT_COPY_MOVE(Echo) + + Echo() noexcept = default; ~Echo() = default; void doNothingWithConstBool(const bool hi); diff --git a/sources/shiboken6/tests/libsample/implicitconv.h b/sources/shiboken6/tests/libsample/implicitconv.h index 97fe9ad4c..5d69eb487 100644 --- a/sources/shiboken6/tests/libsample/implicitconv.h +++ b/sources/shiboken6/tests/libsample/implicitconv.h @@ -12,6 +12,8 @@ class ObjectType; class LIBSAMPLE_API ImplicitConv { public: + LIBMINIMAL_DEFAULT_COPY_MOVE(ImplicitConv) + enum CtorEnum { CtorNone, CtorOne, @@ -28,8 +30,8 @@ public: OverFunc_C }; - ImplicitConv() = default; - ImplicitConv(int objId) : m_ctorEnum(CtorOne), m_objId(objId) {} + ImplicitConv() noexcept = default; + ImplicitConv(int objId) noexcept : m_ctorEnum(CtorOne), m_objId(objId) {} ImplicitConv(CtorEnum ctorEnum) : m_ctorEnum(ctorEnum) {} ImplicitConv(ObjectType&) : m_ctorEnum(CtorObjectTypeReference) {} ImplicitConv(double value, bool=true) : m_ctorEnum(CtorNone), m_value(value) {} diff --git a/sources/shiboken6/tests/libsample/injectcode.cpp b/sources/shiboken6/tests/libsample/injectcode.cpp index 1c723c44f..707d14ed8 100644 --- a/sources/shiboken6/tests/libsample/injectcode.cpp +++ b/sources/shiboken6/tests/libsample/injectcode.cpp @@ -5,7 +5,7 @@ #include <sstream> -InjectCode::InjectCode() = default; +InjectCode::InjectCode() noexcept = default; InjectCode::~InjectCode() = default; diff --git a/sources/shiboken6/tests/libsample/injectcode.h b/sources/shiboken6/tests/libsample/injectcode.h index d079aee09..74046dad5 100644 --- a/sources/shiboken6/tests/libsample/injectcode.h +++ b/sources/shiboken6/tests/libsample/injectcode.h @@ -12,7 +12,9 @@ class LIBSAMPLE_API InjectCode { public: - InjectCode(); + LIBMINIMAL_DEFAULT_COPY_MOVE(InjectCode) + + InjectCode() noexcept; virtual ~InjectCode(); const char *simpleMethod1(int arg0, int arg1); diff --git a/sources/shiboken6/tests/libsample/list.h b/sources/shiboken6/tests/libsample/list.h index b6e2ffde1..5e06d2a66 100644 --- a/sources/shiboken6/tests/libsample/list.h +++ b/sources/shiboken6/tests/libsample/list.h @@ -18,6 +18,8 @@ class List : public std::list<T> class IntList : public List<int> { public: + LIBMINIMAL_DEFAULT_MOVE(IntList) + enum CtorEnum { NoParamsCtor, IntCtor, @@ -25,14 +27,13 @@ public: ListOfIntCtor }; - inline IntList() : m_ctorUsed(NoParamsCtor) {} + inline IntList() noexcept : m_ctorUsed(NoParamsCtor) {} inline explicit IntList(int val) : m_ctorUsed(IntCtor) { push_back(val); } inline IntList(const List<int> &lst) : List<int>(lst), m_ctorUsed(ListOfIntCtor) {} + ~IntList() = default; 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; } @@ -43,6 +44,8 @@ private: class PointValueList : public List<Point> { public: + LIBMINIMAL_DEFAULT_MOVE(PointValueList) + enum CtorEnum { NoParamsCtor, PointCtor, @@ -50,14 +53,13 @@ public: ListOfPointValuesCtor }; - inline PointValueList() : m_ctorUsed(NoParamsCtor) {} + inline PointValueList() noexcept : m_ctorUsed(NoParamsCtor) {} inline explicit PointValueList(Point val) : m_ctorUsed(PointCtor) { push_back(val); } 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; + ~PointValueList() = default; inline void append(Point v) { insert(end(), v); } CtorEnum constructorUsed() { return m_ctorUsed; } @@ -68,6 +70,8 @@ private: class ObjectTypePtrList : public List<ObjectType*> { public: + LIBMINIMAL_DEFAULT_MOVE(ObjectTypePtrList) + enum CtorEnum { NoParamsCtor, ObjectTypeCtor, @@ -82,10 +86,9 @@ public: m_ctorUsed(ObjectTypeCtor) { push_back(val); } inline ObjectTypePtrList(const List<ObjectType*> &lst) : List<ObjectType*>(lst), m_ctorUsed(ListOfObjectTypePtrCtor) {} + ~ObjectTypePtrList() = default; - 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; } diff --git a/sources/shiboken6/tests/libsample/mapuser.h b/sources/shiboken6/tests/libsample/mapuser.h index a6de0b427..1677a4bfb 100644 --- a/sources/shiboken6/tests/libsample/mapuser.h +++ b/sources/shiboken6/tests/libsample/mapuser.h @@ -17,6 +17,8 @@ class LIBSAMPLE_API MapUser { public: + LIBMINIMAL_DEFAULT_COPY_MOVE(MapUser) + MapUser() noexcept = default; virtual ~MapUser() = default; diff --git a/sources/shiboken6/tests/libsample/modifications.h b/sources/shiboken6/tests/libsample/modifications.h index 1cc8153b5..5bd1bac47 100644 --- a/sources/shiboken6/tests/libsample/modifications.h +++ b/sources/shiboken6/tests/libsample/modifications.h @@ -15,6 +15,8 @@ class ObjectType; class LIBSAMPLE_API Modifications { public: + LIBMINIMAL_DISABLE_COPY_MOVE(Modifications) + Modifications(); virtual ~Modifications(); @@ -129,6 +131,8 @@ private: class LIBSAMPLE_API AbstractModifications : public Modifications { public: + LIBMINIMAL_DISABLE_COPY_MOVE(AbstractModifications) + AbstractModifications() noexcept = default; ~AbstractModifications() override = default; diff --git a/sources/shiboken6/tests/libsample/multiple_derived.cpp b/sources/shiboken6/tests/libsample/multiple_derived.cpp index 18aa14611..be535c62f 100644 --- a/sources/shiboken6/tests/libsample/multiple_derived.cpp +++ b/sources/shiboken6/tests/libsample/multiple_derived.cpp @@ -3,15 +3,15 @@ #include "multiple_derived.h" -MDerived1::MDerived1() = default; +MDerived1::MDerived1() noexcept = default; -MDerived2::MDerived2() = default; +MDerived2::MDerived2() noexcept = default; -MDerived3::MDerived3() = default; +MDerived3::MDerived3() noexcept = default; -MDerived4::MDerived4() = default; +MDerived4::MDerived4() noexcept = default; -MDerived5::MDerived5() = default; +MDerived5::MDerived5() noexcept = default; MDerived1 *MDerived1::transformFromBase1(Base1 *self) { diff --git a/sources/shiboken6/tests/libsample/multiple_derived.h b/sources/shiboken6/tests/libsample/multiple_derived.h index 5a7cd932e..8c2143ed6 100644 --- a/sources/shiboken6/tests/libsample/multiple_derived.h +++ b/sources/shiboken6/tests/libsample/multiple_derived.h @@ -11,7 +11,9 @@ class Base1 { public: - Base1() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(Base1) + + Base1() noexcept = default; virtual ~Base1() = default; virtual int base1Method() { return m_value; } @@ -25,7 +27,9 @@ private: class Base2 { public: - Base2() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(Base2) + + Base2() noexcept = default; virtual ~Base2() = default; virtual int base2Method() { return m_value; } @@ -36,7 +40,9 @@ private: class LIBSAMPLE_API MDerived1 : public Base1, public Base2 { public: - MDerived1(); + LIBMINIMAL_DISABLE_COPY_MOVE(MDerived1) + + MDerived1() noexcept; ~MDerived1() override = default; int mderived1Method() { return m_value; } @@ -57,7 +63,9 @@ private: class SonOfMDerived1 : public MDerived1 { public: - SonOfMDerived1() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(SonOfMDerived1) + + SonOfMDerived1() noexcept = default; ~SonOfMDerived1() = default; inline MDerived1 *castToMDerived1() { return this; } @@ -71,7 +79,9 @@ private: class Base3 { public: - explicit Base3(int val = 3) : m_value(val) {} + LIBMINIMAL_DISABLE_COPY_MOVE(Base3) + + explicit Base3(int val = 3) noexcept : m_value(val) {} virtual ~Base3() = default; int base3Method() { return m_value; } @@ -82,7 +92,9 @@ private: class Base4 { public: - Base4() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(Base4) + + Base4() noexcept = default; virtual ~Base4() = default; int base4Method() { return m_value; } @@ -93,7 +105,9 @@ private: class Base5 { public: - Base5() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(Base5) + + Base5() noexcept = default; virtual ~Base5() = default; virtual int base5Method() { return m_value; } @@ -104,7 +118,9 @@ private: class Base6 { public: - Base6() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(Base6) + + Base6() noexcept = default; virtual ~Base6() = default; virtual int base6Method() { return m_value; } @@ -115,7 +131,9 @@ private: class LIBSAMPLE_API MDerived2 : public Base3, public Base4, public Base5, public Base6 { public: - MDerived2(); + LIBMINIMAL_DISABLE_COPY_MOVE(MDerived2) + + MDerived2() noexcept; virtual ~MDerived2() = default; inline int base4Method() { return Base3::base3Method() * 10; } @@ -133,7 +151,9 @@ private: class LIBSAMPLE_API MDerived3 : public MDerived1, public MDerived2 { public: - MDerived3(); + LIBMINIMAL_DISABLE_COPY_MOVE(MDerived3) + + MDerived3() noexcept; virtual ~MDerived3() = default; inline virtual int mderived3Method() { return m_value; } @@ -150,7 +170,9 @@ private: class LIBSAMPLE_API MDerived4 : public Base3, public Base4 { public: - MDerived4(); + LIBMINIMAL_DISABLE_COPY_MOVE(MDerived4) + + MDerived4() noexcept; ~MDerived4() = default; inline int mderived4Method() { return 0; } @@ -166,7 +188,9 @@ private: class LIBSAMPLE_API MDerived5 : public Base3, public Base4 { public: - MDerived5(); + LIBMINIMAL_DISABLE_COPY_MOVE(MDerived5) + + MDerived5() noexcept; virtual ~MDerived5() = default; virtual int mderived5Method() { return 0; } diff --git a/sources/shiboken6/tests/libsample/nondefaultctor.h b/sources/shiboken6/tests/libsample/nondefaultctor.h index ec682f0fb..fa97b8859 100644 --- a/sources/shiboken6/tests/libsample/nondefaultctor.h +++ b/sources/shiboken6/tests/libsample/nondefaultctor.h @@ -9,7 +9,9 @@ class NonDefaultCtor { public: - NonDefaultCtor(int value) : m_value(value) + LIBMINIMAL_DEFAULT_COPY_MOVE(NonDefaultCtor) + + explicit NonDefaultCtor(int value) noexcept : m_value(value) { } diff --git a/sources/shiboken6/tests/libsample/objecttype.h b/sources/shiboken6/tests/libsample/objecttype.h index 08128be49..737f22a0a 100644 --- a/sources/shiboken6/tests/libsample/objecttype.h +++ b/sources/shiboken6/tests/libsample/objecttype.h @@ -149,13 +149,17 @@ LIBSAMPLE_API unsigned int objectTypeHash(const ObjectType *objectType); class LIBSAMPLE_API OtherBase { public: - OtherBase() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(OtherBase) + + OtherBase() noexcept = default; virtual ~OtherBase(); }; class LIBSAMPLE_API ObjectTypeDerived: public ObjectType, public OtherBase { public: - ObjectTypeDerived() = default; + LIBMINIMAL_DISABLE_COPY_MOVE(ObjectTypeDerived) + + ObjectTypeDerived() noexcept = default; bool event(Event *event) override; ~ObjectTypeDerived() override; diff --git a/sources/shiboken6/tests/libsample/objecttypeoperators.h b/sources/shiboken6/tests/libsample/objecttypeoperators.h index 062ec9a79..6144952ca 100644 --- a/sources/shiboken6/tests/libsample/objecttypeoperators.h +++ b/sources/shiboken6/tests/libsample/objecttypeoperators.h @@ -11,10 +11,10 @@ class LIBSAMPLE_API ObjectTypeOperators { public: + LIBMINIMAL_DISABLE_COPY_MOVE(ObjectTypeOperators) + explicit ObjectTypeOperators(const std::string key); virtual ~ObjectTypeOperators() = default; - ObjectTypeOperators(ObjectTypeOperators &) = delete; - ObjectTypeOperators &operator=(ObjectTypeOperators &) = delete; bool operator==(const ObjectTypeOperators &other) const; const ObjectTypeOperators &operator<(const ObjectTypeOperators &other) const; diff --git a/sources/shiboken6/tests/libsample/oddbool.h b/sources/shiboken6/tests/libsample/oddbool.h index b91f37e0a..dd2d32604 100644 --- a/sources/shiboken6/tests/libsample/oddbool.h +++ b/sources/shiboken6/tests/libsample/oddbool.h @@ -16,7 +16,7 @@ class OddBool { public: - inline explicit OddBool(bool b) : m_value(b) {} + inline explicit OddBool(bool b) noexcept : m_value(b) {} bool value() const { return m_value; } inline OddBool operator!() const { return OddBool(!m_value); } @@ -35,7 +35,9 @@ inline bool operator!=(OddBool b1, OddBool b2) { return (!b1).value() != (!b2).v class OddBoolUser { public: - OddBoolUser() : m_oddbool(OddBool(false)) {} + LIBMINIMAL_DEFAULT_COPY_MOVE(OddBoolUser) + + OddBoolUser() noexcept : m_oddbool(OddBool(false)) {} OddBoolUser(const OddBool &oddBool) : m_oddbool(oddBool) {} virtual ~OddBoolUser() = default; diff --git a/sources/shiboken6/tests/libsample/overload.h b/sources/shiboken6/tests/libsample/overload.h index 08d841ee6..b640bf7c7 100644 --- a/sources/shiboken6/tests/libsample/overload.h +++ b/sources/shiboken6/tests/libsample/overload.h @@ -17,6 +17,8 @@ class LIBSAMPLE_API Overload { public: + LIBMINIMAL_DISABLE_COPY_MOVE(Overload) + enum FunctionEnum { Function0, Function1, diff --git a/sources/shiboken6/tests/libsample/pairuser.h b/sources/shiboken6/tests/libsample/pairuser.h index 595b3fe7e..ee51d818e 100644 --- a/sources/shiboken6/tests/libsample/pairuser.h +++ b/sources/shiboken6/tests/libsample/pairuser.h @@ -12,7 +12,9 @@ class LIBSAMPLE_API PairUser { public: - PairUser() = default; + LIBMINIMAL_DEFAULT_COPY_MOVE(PairUser) + + PairUser() noexcept = default; virtual ~PairUser() = default; virtual std::pair<int, int> createPair(); diff --git a/sources/shiboken6/tests/libsample/pen.h b/sources/shiboken6/tests/libsample/pen.h index 90a8aa584..6f528f0f9 100644 --- a/sources/shiboken6/tests/libsample/pen.h +++ b/sources/shiboken6/tests/libsample/pen.h @@ -54,6 +54,7 @@ public: Pen(Pen &&) noexcept; Pen &operator=(const Pen &pen); Pen &operator=(Pen &&) noexcept; + ~Pen() = default; // PYSIDE-1325, default initializer void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {}); diff --git a/sources/shiboken6/tests/libsample/photon.h b/sources/shiboken6/tests/libsample/photon.h index 1144f17dc..2debe47d1 100644 --- a/sources/shiboken6/tests/libsample/photon.h +++ b/sources/shiboken6/tests/libsample/photon.h @@ -23,7 +23,9 @@ enum ClassType { class LIBSAMPLE_API Base { public: - explicit Base(int value) : m_value(value) {} + LIBMINIMAL_DEFAULT_COPY_MOVE(Base) + + explicit Base(int value) noexcept : m_value(value) {} virtual ~Base() = default; inline void setValue(int value) { m_value = value; } diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp index d0fa83295..b8630eb1e 100644 --- a/sources/shiboken6/tests/libsample/point.cpp +++ b/sources/shiboken6/tests/libsample/point.cpp @@ -5,11 +5,11 @@ #include <iostream> -Point::Point(int x, int y) : m_x(x), m_y(y) +Point::Point(int x, int y) noexcept : m_x(x), m_y(y) { } -Point::Point(double x, double y) : m_x(x), m_y(y) +Point::Point(double x, double y) noexcept : m_x(x), m_y(y) { } diff --git a/sources/shiboken6/tests/libsample/point.h b/sources/shiboken6/tests/libsample/point.h index 52a9b1bf3..59e0236d5 100644 --- a/sources/shiboken6/tests/libsample/point.h +++ b/sources/shiboken6/tests/libsample/point.h @@ -12,8 +12,10 @@ class LIBSAMPLE_API Point { public: - Point(int x = 0, int y = 0); - Point(double x, double y); + LIBMINIMAL_DEFAULT_COPY_MOVE(Point) + + Point(int x = 0, int y = 0) noexcept; + Point(double x, double y) noexcept; ~Point() = default; inline double x() const { return m_x; } diff --git a/sources/shiboken6/tests/libsmart/smart_sharedptr.h b/sources/shiboken6/tests/libsmart/smart_sharedptr.h index bc2b071c1..dc665810a 100644 --- a/sources/shiboken6/tests/libsmart/smart_sharedptr.h +++ b/sources/shiboken6/tests/libsmart/smart_sharedptr.h @@ -20,6 +20,8 @@ struct SharedPtrBase template <class T> class SharedPtr : public SharedPtrBase { public: + LIBMINIMAL_DEFAULT_MOVE(SharedPtr) + SharedPtr() { logDefaultConstructor(typeid(T).name(), this); } SharedPtr(T *v) : mPtr(v) |