From 01edc916d210238a06a043c1f8f9f44d69113ce2 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 19 Dec 2024 11:27:02 +0200 Subject: [PATCH] moc: fix GCC -Wextra-semi colon after member function definitions As pointed out by Thiago the QT_DECLARE_METATYPE calls are redundant, so remove them. Task-number: QTBUG-132101 Pick-to: 6.8 Change-Id: I73800e70d3f270fb87941d4e053aa7ac5ed1841c Reviewed-by: Thiago Macieira (cherry picked from commit 3bb4c4949fed9ccf8653151c78d5130b8db00716) Reviewed-by: Qt Cherry-pick Bot --- src/tools/moc/generator.h | 2 +- tests/auto/tools/moc/tst_moc.cpp | 33 +++++++++++++------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index 281ea092cde..0ee2ad23919 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -21,7 +21,7 @@ public: const QHash &knownGadgets, FILE *outfile = nullptr, bool requireCompleteTypes = false); void generateCode(); - qsizetype registeredStringsCount() { return strings.size(); }; + qsizetype registeredStringsCount() { return strings.size(); } private: bool registerableMetaType(const QByteArray &propertyType); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 8bad1965a1c..9dae77ea47f 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -107,8 +107,6 @@ enum FooItems Q_ENUM_NS(FooItems) } -Q_DECLARE_METATYPE(const QMetaObject*); - #define TESTEXPORTMACRO Q_DECL_EXPORT #if !defined(Q_MOC_RUN) && !defined(Q_NOREPLY) @@ -913,8 +911,8 @@ signals: void sigWithDefaultArg(int i = 12); private: - bool user1() { return true; }; - bool user2() { return false; }; + bool user1() { return true; } + bool user2() { return false; } template void revisions_T(); QString member2() const { return sMember; } void setMember3( const QString &sVal ) { sMember = sVal; } @@ -1320,8 +1318,6 @@ void tst_Moc::structQObject() #include "namespaced-flags.h" -Q_DECLARE_METATYPE(QList); - void tst_Moc::namespacedFlags() { Foo::Baz baz; @@ -2036,11 +2032,11 @@ struct const_ {}; class QTBUG9354_constInName: public QObject { Q_OBJECT public slots: - void slotChooseScientificConst0(science_constant const &) {}; - void foo(science_const const &) {}; - void foo(constconst const &) {}; - void foo(constconst *) {}; - void foo(const_ *) {}; + void slotChooseScientificConst0(science_constant const &) {} + void foo(science_const const &) {} + void foo(constconst const &) {} + void foo(constconst *) {} + void foo(const_ *) {} }; @@ -2157,7 +2153,7 @@ public: Q_INVOKABLE Q_REVISION(6, 0) void method60() {} enum TestEnum { One, Two }; - Q_ENUM(TestEnum); + Q_ENUM(TestEnum) public slots: @@ -2201,7 +2197,7 @@ public: Q_INVOKABLE Q_REVISION(6, 0) void method60() {} enum TestEnum { One, Two }; - Q_ENUM(TestEnum); + Q_ENUM(TestEnum) public slots: void slot1() {} @@ -3402,7 +3398,6 @@ public: Q_DECLARE_METATYPE(CustomQObject::Number) typedef CustomQObject* CustomQObjectStar; -Q_DECLARE_METATYPE(CustomQObjectStar); namespace SomeNamespace { @@ -3443,7 +3438,6 @@ public: Q_DECLARE_METATYPE(CustomQObject2::Number) typedef CustomQObject2* CustomQObject2Star; -Q_DECLARE_METATYPE(CustomQObject2Star); namespace SomeNamespace2 { @@ -3921,7 +3915,7 @@ namespace QTBUG32933_relatedObjectsDontIncludeItself { Q_PROPERTY(Obj::MyEnum p2 MEMBER member) Q_PROPERTY(NS::Obj::MyEnum p3 MEMBER member) Q_PROPERTY(QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::MyEnum p4 MEMBER member) - Q_ENUMS(MyEnum); + Q_ENUMS(MyEnum) public: enum MyEnum { Something, SomethingElse }; MyEnum member; @@ -4511,8 +4505,6 @@ void TestFwdProperties::setProp3(const FwdClass3 &v) } TestFwdProperties::~TestFwdProperties() {} -Q_DECLARE_METATYPE(FwdClass1); - void tst_Moc::mocInclude() { TestFwdProperties obj; @@ -4556,7 +4548,8 @@ signals: public: QBindable bindablePublicProperty() { return QBindable(&publicProperty); } - Q_OBJECT_BINDABLE_PROPERTY(ClassWithQPropertyMembers, int, publicProperty, &ClassWithQPropertyMembers::publicPropertyChanged); + Q_OBJECT_BINDABLE_PROPERTY(ClassWithQPropertyMembers, int, publicProperty, + &ClassWithQPropertyMembers::publicPropertyChanged) QProperty notExposed; @@ -4683,7 +4676,7 @@ public: ClassWithPrivateQPropertyShim *q = nullptr; void onTestPropertyChanged() { q->testPropertyChanged(); } - Q_OBJECT_BINDABLE_PROPERTY(Private, int, testProperty, &Private::onTestPropertyChanged); + Q_OBJECT_BINDABLE_PROPERTY(Private, int, testProperty, &Private::onTestPropertyChanged) QProperty testProperty2; }; Private priv{this};