Browse Source

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 <dpldobrev@protonmail.com>
pull/1272/head
Dimitar Dobrev 6 years ago
parent
commit
be54a8b695
  1. 24
      tests/CSharp/CSharp.cpp
  2. 9
      tests/CSharp/CSharp.h
  3. 31
      tests/Common/Common.cpp
  4. 32
      tests/Common/Common.h

24
tests/CSharp/CSharp.cpp

@ -326,6 +326,10 @@ void Baz::setMethod(ProtectedNestedEnum value) @@ -326,6 +326,10 @@ void Baz::setMethod(ProtectedNestedEnum value)
{
}
AbstractProprietor::~AbstractProprietor()
{
}
int AbstractProprietor::getValue()
{
return m_value;
@ -802,6 +806,10 @@ int MethodsWithDefaultValues::getA() @@ -802,6 +806,10 @@ int MethodsWithDefaultValues::getA()
return m_foo.A;
}
HasPureVirtualWithDefaultArg::~HasPureVirtualWithDefaultArg()
{
}
HasOverridesWithChangedAccessBase::HasOverridesWithChangedAccessBase()
{
}
@ -850,6 +858,10 @@ void HasOverridesWithIncreasedAccess::differentIncreasedAccessOverride() @@ -850,6 +858,10 @@ void HasOverridesWithIncreasedAccess::differentIncreasedAccessOverride()
{
}
AbstractWithProperty::~AbstractWithProperty()
{
}
IgnoredType PropertyWithIgnoredType::ignoredType()
{
return _ignoredType;
@ -1150,6 +1162,10 @@ OverridePropertyFromIndirectPrimaryBaseBase::OverridePropertyFromIndirectPrimary @@ -1150,6 +1162,10 @@ OverridePropertyFromIndirectPrimaryBaseBase::OverridePropertyFromIndirectPrimary
{
}
OverridePropertyFromIndirectPrimaryBaseBase::~OverridePropertyFromIndirectPrimaryBaseBase()
{
}
OverridePropertyFromDirectPrimaryBase::OverridePropertyFromDirectPrimaryBase()
{
}
@ -1171,6 +1187,10 @@ AbstractOverrideFromSecondaryBase::AbstractOverrideFromSecondaryBase() @@ -1171,6 +1187,10 @@ AbstractOverrideFromSecondaryBase::AbstractOverrideFromSecondaryBase()
{
}
AbstractOverrideFromSecondaryBase::~AbstractOverrideFromSecondaryBase()
{
}
QObject::QObject()
{
}
@ -1243,6 +1263,10 @@ InheritsFromHasSamePropertyInDerivedAbstractType::InheritsFromHasSamePropertyInD @@ -1243,6 +1263,10 @@ InheritsFromHasSamePropertyInDerivedAbstractType::InheritsFromHasSamePropertyInD
{
}
InheritsFromHasSamePropertyInDerivedAbstractType::~InheritsFromHasSamePropertyInDerivedAbstractType()
{
}
MultipleInheritanceFieldOffsetsSecondaryBase::MultipleInheritanceFieldOffsetsSecondaryBase() : secondary(2)
{
}

9
tests/CSharp/CSharp.h

@ -181,6 +181,7 @@ struct QByteArrayDataPtr @@ -181,6 +181,7 @@ struct QByteArrayDataPtr
class DLL_API AbstractProprietor
{
public:
virtual ~AbstractProprietor();
virtual int getValue();
virtual void setValue(int newValue) = 0;
@ -480,6 +481,7 @@ private: @@ -480,6 +481,7 @@ private:
class DLL_API HasPureVirtualWithDefaultArg
{
public:
virtual ~HasPureVirtualWithDefaultArg();
virtual void pureVirtualWithDefaultArg(Foo* foo = nullptr) = 0;
};
@ -522,6 +524,7 @@ public: @@ -522,6 +524,7 @@ public:
class DLL_API AbstractWithProperty
{
public:
virtual ~AbstractWithProperty();
virtual int property() = 0;
};
@ -860,6 +863,7 @@ class DLL_API OverridePropertyFromIndirectPrimaryBaseBase @@ -860,6 +863,7 @@ class DLL_API OverridePropertyFromIndirectPrimaryBaseBase
{
public:
OverridePropertyFromIndirectPrimaryBaseBase();
virtual ~OverridePropertyFromIndirectPrimaryBaseBase();
virtual int property() = 0;
virtual void setProperty(int value) = 0;
};
@ -882,6 +886,7 @@ class DLL_API AbstractOverrideFromSecondaryBase : public Foo, public OverridePro @@ -882,6 +886,7 @@ class DLL_API AbstractOverrideFromSecondaryBase : public Foo, public OverridePro
{
public:
AbstractOverrideFromSecondaryBase();
virtual ~AbstractOverrideFromSecondaryBase();
virtual void setProperty(int value) = 0;
};
@ -938,6 +943,7 @@ class InheritsFromHasSamePropertyInDerivedAbstractType : public HasSamePropertyI @@ -938,6 +943,7 @@ class InheritsFromHasSamePropertyInDerivedAbstractType : public HasSamePropertyI
{
public:
InheritsFromHasSamePropertyInDerivedAbstractType();
virtual ~InheritsFromHasSamePropertyInDerivedAbstractType();
virtual int property() = 0;
};
@ -993,6 +999,8 @@ namespace NamespaceB @@ -993,6 +999,8 @@ namespace NamespaceB
class HasPrivateVirtualProperty
{
public:
virtual ~HasPrivateVirtualProperty();
private:
virtual int property();
virtual void protectedAbstractMethod() = 0;
@ -1026,6 +1034,7 @@ struct iterator_category_with_traversal : Category, Traversal @@ -1026,6 +1034,7 @@ struct iterator_category_with_traversal : Category, Traversal
class HasConflictWithAbstractProperty
{
public:
virtual ~HasConflictWithAbstractProperty();
int conflictWithProperty();
virtual int getConflictWithProperty() = 0;
};

31
tests/Common/Common.cpp

@ -37,6 +37,10 @@ TestPacking8::~TestPacking8() @@ -37,6 +37,10 @@ TestPacking8::~TestPacking8()
{
}
Foo::NestedAbstract::~NestedAbstract()
{
}
Foo::Foo()
{
auto p = new int[4];
@ -355,6 +359,10 @@ int TestDelegates::CDecl(DelegateCDecl del) @@ -355,6 +359,10 @@ int TestDelegates::CDecl(DelegateCDecl del)
return del(1);
}
AbstractFoo::~AbstractFoo()
{
}
int ImplementsAbstractFoo::pureFunction(typedefInOverride i)
{
return 5;
@ -377,6 +385,10 @@ const AbstractFoo& ReturnsAbstractFoo::getFoo() @@ -377,6 +385,10 @@ const AbstractFoo& ReturnsAbstractFoo::getFoo()
return i;
}
Exception::~Exception()
{
}
Ex2* DerivedException::clone()
{
return 0;
@ -522,6 +534,10 @@ std::string& HasStdString::getStdString() @@ -522,6 +534,10 @@ std::string& HasStdString::getStdString()
return s;
}
SomeNamespace::AbstractClass::~AbstractClass()
{
}
TestProperties::TestProperties() : Field(0), _refToPrimitiveInSetter(0),
_getterAndSetterWithTheSameName(0), _setterReturnsBoolean(0), _virtualSetterReturnsBoolean(0)
{
@ -855,6 +871,10 @@ int DerivedClassVirtual::retInt(const Foo2& foo) @@ -855,6 +871,10 @@ int DerivedClassVirtual::retInt(const Foo2& foo)
return 2;
}
DerivedClassAbstractVirtual::~DerivedClassAbstractVirtual()
{
}
DerivedClassOverrideAbstractVirtual::DerivedClassOverrideAbstractVirtual()
{
}
@ -921,7 +941,10 @@ void FuncWithTypeAlias(custom_int_t i) @@ -921,7 +941,10 @@ void FuncWithTypeAlias(custom_int_t i)
void FuncWithTemplateTypeAlias(TypeAliasTemplate<int> i)
{
}
HasAbstractOperator::~HasAbstractOperator()
{
}
HasOverloadsWithDifferentPointerKindsToSameType::HasOverloadsWithDifferentPointerKindsToSameType()
@ -1136,3 +1159,11 @@ uint16_t TestStructWithCopyCtorByValue(StructWithCopyCtor s) @@ -1136,3 +1159,11 @@ uint16_t TestStructWithCopyCtorByValue(StructWithCopyCtor s)
{
return s.mBits;
}
BaseCovariant::~BaseCovariant()
{
}
DerivedCovariant::~DerivedCovariant()
{
}

32
tests/Common/Common.h

@ -79,6 +79,7 @@ public: @@ -79,6 +79,7 @@ public:
class NestedAbstract
{
public:
virtual ~NestedAbstract();
virtual int* abstractFunctionInNestedClass() = 0;
};
@ -253,6 +254,7 @@ public: @@ -253,6 +254,7 @@ public:
class DLL_API AbstractFoo
{
public:
virtual ~AbstractFoo();
virtual int pureFunction(int i = 0) = 0;
virtual int pureFunction1() = 0;
virtual int pureFunction2(bool* ok = 0) = 0;
@ -291,6 +293,7 @@ typedef DerivedException Ex2; @@ -291,6 +293,7 @@ typedef DerivedException Ex2;
struct DLL_API Exception : public Foo
{
virtual ~Exception();
virtual Ex1* clone() = 0;
};
@ -540,11 +543,12 @@ class DLL_API SomeClassExtendingTheStruct : public SomeStruct @@ -540,11 +543,12 @@ class DLL_API SomeClassExtendingTheStruct : public SomeStruct
namespace SomeNamespace
{
class DLL_API AbstractClass
{
public:
virtual void AbstractMethod() = 0;
};
class DLL_API AbstractClass
{
public:
~AbstractClass();
virtual void AbstractMethod() = 0;
};
}
// Test operator overloads
@ -553,11 +557,11 @@ class DLL_API ClassWithOverloadedOperators @@ -553,11 +557,11 @@ class DLL_API ClassWithOverloadedOperators
public:
ClassWithOverloadedOperators();
operator char();
operator int();
operator short();
operator char();
operator int();
operator short();
virtual bool operator<(const ClassWithOverloadedOperators &other) const;
virtual bool operator<(const ClassWithOverloadedOperators &other) const;
};
ClassWithOverloadedOperators::ClassWithOverloadedOperators() {}
@ -1022,6 +1026,7 @@ public: @@ -1022,6 +1026,7 @@ public:
class DLL_API DerivedClassAbstractVirtual : public DerivedClassVirtual
{
public:
~DerivedClassAbstractVirtual();
virtual int retInt(const Foo& foo) = 0;
};
@ -1262,6 +1267,7 @@ private: @@ -1262,6 +1267,7 @@ private:
class DLL_API HasAbstractOperator
{
public:
~HasAbstractOperator();
virtual bool operator==(const HasAbstractOperator& other) = 0;
};
@ -1528,11 +1534,13 @@ uint16_t DLL_API TestStructWithCopyCtorByValue(StructWithCopyCtor s); @@ -1528,11 +1534,13 @@ uint16_t DLL_API TestStructWithCopyCtorByValue(StructWithCopyCtor s);
struct BaseCovariant;
typedef std::unique_ptr<BaseCovariant> PtrCovariant;
struct BaseCovariant {
virtual PtrCovariant clone() const = 0;
struct DLL_API BaseCovariant {
virtual ~BaseCovariant();
virtual PtrCovariant clone() const = 0;
};
struct DerivedCovariant: public BaseCovariant {
struct DLL_API DerivedCovariant: public BaseCovariant {
virtual ~DerivedCovariant();
std::unique_ptr<BaseCovariant> clone() const override {
return PtrCovariant(new DerivedCovariant());
}

Loading…
Cancel
Save