Skip to content

Commit c8e9f62

Browse files
committed
Make destructors virtual in abstract classes for tests
This fixes annoying warnings when compiling the generated code for additional symbols. Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 249578f commit c8e9f62

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

tests/CSharp/CSharp.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ void Baz::setMethod(ProtectedNestedEnum value)
326326
{
327327
}
328328

329+
AbstractProprietor::~AbstractProprietor()
330+
{
331+
}
332+
329333
int AbstractProprietor::getValue()
330334
{
331335
return m_value;
@@ -802,6 +806,10 @@ int MethodsWithDefaultValues::getA()
802806
return m_foo.A;
803807
}
804808

809+
HasPureVirtualWithDefaultArg::~HasPureVirtualWithDefaultArg()
810+
{
811+
}
812+
805813
HasOverridesWithChangedAccessBase::HasOverridesWithChangedAccessBase()
806814
{
807815
}
@@ -850,6 +858,10 @@ void HasOverridesWithIncreasedAccess::differentIncreasedAccessOverride()
850858
{
851859
}
852860

861+
AbstractWithProperty::~AbstractWithProperty()
862+
{
863+
}
864+
853865
IgnoredType PropertyWithIgnoredType::ignoredType()
854866
{
855867
return _ignoredType;
@@ -1150,6 +1162,10 @@ OverridePropertyFromIndirectPrimaryBaseBase::OverridePropertyFromIndirectPrimary
11501162
{
11511163
}
11521164

1165+
OverridePropertyFromIndirectPrimaryBaseBase::~OverridePropertyFromIndirectPrimaryBaseBase()
1166+
{
1167+
}
1168+
11531169
OverridePropertyFromDirectPrimaryBase::OverridePropertyFromDirectPrimaryBase()
11541170
{
11551171
}
@@ -1171,6 +1187,10 @@ AbstractOverrideFromSecondaryBase::AbstractOverrideFromSecondaryBase()
11711187
{
11721188
}
11731189

1190+
AbstractOverrideFromSecondaryBase::~AbstractOverrideFromSecondaryBase()
1191+
{
1192+
}
1193+
11741194
QObject::QObject()
11751195
{
11761196
}
@@ -1243,6 +1263,10 @@ InheritsFromHasSamePropertyInDerivedAbstractType::InheritsFromHasSamePropertyInD
12431263
{
12441264
}
12451265

1266+
InheritsFromHasSamePropertyInDerivedAbstractType::~InheritsFromHasSamePropertyInDerivedAbstractType()
1267+
{
1268+
}
1269+
12461270
MultipleInheritanceFieldOffsetsSecondaryBase::MultipleInheritanceFieldOffsetsSecondaryBase() : secondary(2)
12471271
{
12481272
}

tests/CSharp/CSharp.h

+9
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ struct QByteArrayDataPtr
181181
class DLL_API AbstractProprietor
182182
{
183183
public:
184+
virtual ~AbstractProprietor();
184185
virtual int getValue();
185186
virtual void setValue(int newValue) = 0;
186187

@@ -480,6 +481,7 @@ class DLL_API MethodsWithDefaultValues : public Quux
480481
class DLL_API HasPureVirtualWithDefaultArg
481482
{
482483
public:
484+
virtual ~HasPureVirtualWithDefaultArg();
483485
virtual void pureVirtualWithDefaultArg(Foo* foo = nullptr) = 0;
484486
};
485487

@@ -522,6 +524,7 @@ class DLL_API HasOverridesWithIncreasedAccess : public HasOverridesWithChangedAc
522524
class DLL_API AbstractWithProperty
523525
{
524526
public:
527+
virtual ~AbstractWithProperty();
525528
virtual int property() = 0;
526529
};
527530

@@ -860,6 +863,7 @@ class DLL_API OverridePropertyFromIndirectPrimaryBaseBase
860863
{
861864
public:
862865
OverridePropertyFromIndirectPrimaryBaseBase();
866+
virtual ~OverridePropertyFromIndirectPrimaryBaseBase();
863867
virtual int property() = 0;
864868
virtual void setProperty(int value) = 0;
865869
};
@@ -882,6 +886,7 @@ class DLL_API AbstractOverrideFromSecondaryBase : public Foo, public OverridePro
882886
{
883887
public:
884888
AbstractOverrideFromSecondaryBase();
889+
virtual ~AbstractOverrideFromSecondaryBase();
885890
virtual void setProperty(int value) = 0;
886891
};
887892

@@ -938,6 +943,7 @@ class InheritsFromHasSamePropertyInDerivedAbstractType : public HasSamePropertyI
938943
{
939944
public:
940945
InheritsFromHasSamePropertyInDerivedAbstractType();
946+
virtual ~InheritsFromHasSamePropertyInDerivedAbstractType();
941947
virtual int property() = 0;
942948
};
943949

@@ -993,6 +999,8 @@ namespace NamespaceB
993999

9941000
class HasPrivateVirtualProperty
9951001
{
1002+
public:
1003+
virtual ~HasPrivateVirtualProperty();
9961004
private:
9971005
virtual int property();
9981006
virtual void protectedAbstractMethod() = 0;
@@ -1026,6 +1034,7 @@ struct iterator_category_with_traversal : Category, Traversal
10261034
class HasConflictWithAbstractProperty
10271035
{
10281036
public:
1037+
virtual ~HasConflictWithAbstractProperty();
10291038
int conflictWithProperty();
10301039
virtual int getConflictWithProperty() = 0;
10311040
};

tests/Common/Common.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ TestPacking8::~TestPacking8()
3737
{
3838
}
3939

40+
Foo::NestedAbstract::~NestedAbstract()
41+
{
42+
}
43+
4044
Foo::Foo()
4145
{
4246
auto p = new int[4];
@@ -355,6 +359,10 @@ int TestDelegates::CDecl(DelegateCDecl del)
355359
return del(1);
356360
}
357361

362+
AbstractFoo::~AbstractFoo()
363+
{
364+
}
365+
358366
int ImplementsAbstractFoo::pureFunction(typedefInOverride i)
359367
{
360368
return 5;
@@ -377,6 +385,10 @@ const AbstractFoo& ReturnsAbstractFoo::getFoo()
377385
return i;
378386
}
379387

388+
Exception::~Exception()
389+
{
390+
}
391+
380392
Ex2* DerivedException::clone()
381393
{
382394
return 0;
@@ -522,6 +534,10 @@ std::string& HasStdString::getStdString()
522534
return s;
523535
}
524536

537+
SomeNamespace::AbstractClass::~AbstractClass()
538+
{
539+
}
540+
525541
TestProperties::TestProperties() : Field(0), _refToPrimitiveInSetter(0),
526542
_getterAndSetterWithTheSameName(0), _setterReturnsBoolean(0), _virtualSetterReturnsBoolean(0)
527543
{
@@ -855,6 +871,10 @@ int DerivedClassVirtual::retInt(const Foo2& foo)
855871
return 2;
856872
}
857873

874+
DerivedClassAbstractVirtual::~DerivedClassAbstractVirtual()
875+
{
876+
}
877+
858878
DerivedClassOverrideAbstractVirtual::DerivedClassOverrideAbstractVirtual()
859879
{
860880
}
@@ -921,7 +941,10 @@ void FuncWithTypeAlias(custom_int_t i)
921941

922942
void FuncWithTemplateTypeAlias(TypeAliasTemplate<int> i)
923943
{
944+
}
924945

946+
HasAbstractOperator::~HasAbstractOperator()
947+
{
925948
}
926949

927950
HasOverloadsWithDifferentPointerKindsToSameType::HasOverloadsWithDifferentPointerKindsToSameType()
@@ -1136,3 +1159,11 @@ uint16_t TestStructWithCopyCtorByValue(StructWithCopyCtor s)
11361159
{
11371160
return s.mBits;
11381161
}
1162+
1163+
BaseCovariant::~BaseCovariant()
1164+
{
1165+
}
1166+
1167+
DerivedCovariant::~DerivedCovariant()
1168+
{
1169+
}

tests/Common/Common.h

+18-10
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class DLL_API Foo
7979
class NestedAbstract
8080
{
8181
public:
82+
~NestedAbstract();
8283
virtual int* abstractFunctionInNestedClass() = 0;
8384
};
8485

@@ -253,6 +254,7 @@ class DLL_API Hello
253254
class DLL_API AbstractFoo
254255
{
255256
public:
257+
virtual ~AbstractFoo();
256258
virtual int pureFunction(int i = 0) = 0;
257259
virtual int pureFunction1() = 0;
258260
virtual int pureFunction2(bool* ok = 0) = 0;
@@ -291,6 +293,7 @@ typedef DerivedException Ex2;
291293

292294
struct DLL_API Exception : public Foo
293295
{
296+
virtual ~Exception();
294297
virtual Ex1* clone() = 0;
295298
};
296299

@@ -540,11 +543,12 @@ class DLL_API SomeClassExtendingTheStruct : public SomeStruct
540543

541544
namespace SomeNamespace
542545
{
543-
class DLL_API AbstractClass
544-
{
545-
public:
546-
virtual void AbstractMethod() = 0;
547-
};
546+
class DLL_API AbstractClass
547+
{
548+
public:
549+
~AbstractClass();
550+
virtual void AbstractMethod() = 0;
551+
};
548552
}
549553

550554
// Test operator overloads
@@ -553,11 +557,11 @@ class DLL_API ClassWithOverloadedOperators
553557
public:
554558
ClassWithOverloadedOperators();
555559

556-
operator char();
557-
operator int();
558-
operator short();
560+
operator char();
561+
operator int();
562+
operator short();
559563

560-
virtual bool operator<(const ClassWithOverloadedOperators &other) const;
564+
virtual bool operator<(const ClassWithOverloadedOperators &other) const;
561565
};
562566

563567
ClassWithOverloadedOperators::ClassWithOverloadedOperators() {}
@@ -1022,6 +1026,7 @@ class DLL_API DerivedClassVirtual : public BaseClassVirtual
10221026
class DLL_API DerivedClassAbstractVirtual : public DerivedClassVirtual
10231027
{
10241028
public:
1029+
~DerivedClassAbstractVirtual();
10251030
virtual int retInt(const Foo& foo) = 0;
10261031
};
10271032

@@ -1262,6 +1267,7 @@ class UsesSpecialisationOfVoid
12621267
class DLL_API HasAbstractOperator
12631268
{
12641269
public:
1270+
~HasAbstractOperator();
12651271
virtual bool operator==(const HasAbstractOperator& other) = 0;
12661272
};
12671273

@@ -1529,10 +1535,12 @@ struct BaseCovariant;
15291535
typedef std::unique_ptr<BaseCovariant> PtrCovariant;
15301536

15311537
struct BaseCovariant {
1532-
virtual PtrCovariant clone() const = 0;
1538+
virtual ~BaseCovariant();
1539+
virtual PtrCovariant clone() const = 0;
15331540
};
15341541

15351542
struct DerivedCovariant: public BaseCovariant {
1543+
virtual ~DerivedCovariant();
15361544
std::unique_ptr<BaseCovariant> clone() const override {
15371545
return PtrCovariant(new DerivedCovariant());
15381546
}

0 commit comments

Comments
 (0)