From 5925daf969c8f271458ca81e49f0e675a4c5c912 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 29 Mar 2021 14:01:50 +0200 Subject: Silence a bunch of gcc warnings for the moc test We deliberately expose moc to warning-worthy C++, but we don't want the compiler warnings coming from those. Change-Id: I09c36d7c8bfbb88f7bde61fa7bcc52a5adde81da Reviewed-by: Fabian Kosmale --- tests/auto/tools/moc/cxx-attributes.h | 1 + tests/auto/tools/moc/cxx11-explicit-override-control.h | 5 +++++ tests/auto/tools/moc/tst_moc.cpp | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/auto/tools') diff --git a/tests/auto/tools/moc/cxx-attributes.h b/tests/auto/tools/moc/cxx-attributes.h index abd75afe98..c4f27eb8c4 100644 --- a/tests/auto/tools/moc/cxx-attributes.h +++ b/tests/auto/tools/moc/cxx-attributes.h @@ -33,6 +33,7 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wunknown-attributes") +QT_WARNING_DISABLE_GCC("-Wattributes") class CppAttribute : public QObject { diff --git a/tests/auto/tools/moc/cxx11-explicit-override-control.h b/tests/auto/tools/moc/cxx11-explicit-override-control.h index 961d7c47c2..2fcf0fdb2d 100644 --- a/tests/auto/tools/moc/cxx11-explicit-override-control.h +++ b/tests/auto/tools/moc/cxx11-explicit-override-control.h @@ -36,6 +36,9 @@ # define sealed #endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wsuggest-override") + class ExplicitOverrideControlBase : public QObject { Q_OBJECT @@ -234,6 +237,8 @@ private Q_SLOTS: #endif }; +QT_WARNING_POP + #ifndef Q_MOC_RUN # undef final # undef sealed diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 8ce2382600..110b6b2d05 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -322,6 +322,8 @@ public: void foo(struct ForwardDeclaredStruct *); }; +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wunused-variable") void StructQObject::foo(struct ForwardDeclaredStruct *) { struct Inner { @@ -330,10 +332,11 @@ void StructQObject::foo(struct ForwardDeclaredStruct *) Q_DECL_UNUSED_MEMBER struct Inner unusedVariable; } - +QT_WARNING_POP QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers") +QT_WARNING_DISABLE_GCC("-Wignored-qualifiers") class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct), public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored) @@ -1764,6 +1767,7 @@ void tst_Moc::QTBUG5590_dummyProperty() QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers") +QT_WARNING_DISABLE_GCC("-Wignored-qualifiers") class QTBUG7421_ReturnConstTemplate: public QObject { Q_OBJECT public slots: -- cgit v1.2.3