summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-21 17:22:03 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-23 01:18:13 +0200
commit6ece7dd09ac8897b70b062507d2bff69e5e4115a (patch)
tree1677ce41d18d51554e897626abc16526adef19a9 /tests/auto/tools
parent2e7f11246e8b5bd0952c3b498da04ae4fc14f264 (diff)
Fix warnings in tst_moc
Change-Id: I4cbc851e59febdc533c02fb4b95d2924348086b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/backslash-newlines.h7
-rw-r--r--tests/auto/tools/moc/cxx-attributes.h10
-rw-r--r--tests/auto/tools/moc/no-keywords.h4
-rw-r--r--tests/auto/tools/moc/single_function_keyword.h6
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp12
5 files changed, 34 insertions, 5 deletions
diff --git a/tests/auto/tools/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h
index 081d80dc7a..cb2a7f6558 100644
--- a/tests/auto/tools/moc/backslash-newlines.h
+++ b/tests/auto/tools/moc/backslash-newlines.h
@@ -53,4 +53,9 @@ public slots:
#endif // BACKSLASH_NEWLINES_H
-// ends with \\\r should not make moc crash (QTBUG-53441) (no new lines on purpose!!) \ \ No newline at end of file
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wcomment")
+
+// ends with \\\r should not make moc crash (QTBUG-53441) (no new lines on purpose!!) \
+
+QT_WARNING_POP
diff --git a/tests/auto/tools/moc/cxx-attributes.h b/tests/auto/tools/moc/cxx-attributes.h
index eff6a3ec41..abd75afe98 100644
--- a/tests/auto/tools/moc/cxx-attributes.h
+++ b/tests/auto/tools/moc/cxx-attributes.h
@@ -31,6 +31,9 @@
#include <QtCore/QObject>
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wunknown-attributes")
+
class CppAttribute : public QObject
{
Q_OBJECT
@@ -57,6 +60,8 @@ public slots:
#endif
};
+QT_WARNING_POP
+
#ifdef Q_MOC_RUN
# define TEST_COMPILER_DEPRECATION [[deprecated]]
# define TEST_COMPILER_DEPRECATION_X(x) [[deprecated(x)]]
@@ -65,6 +70,9 @@ public slots:
# define TEST_COMPILER_DEPRECATION_X(x) Q_DECL_ENUMERATOR_DEPRECATED_X(x)
#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
namespace TestQNamespaceDeprecated {
Q_NAMESPACE
enum class TestEnum1 {
@@ -100,4 +108,6 @@ namespace TestQNamespaceDeprecated {
Q_FLAG_NS(TestFlag1)
}
+QT_WARNING_POP
+
#endif // CXXATTRIBUTE_H
diff --git a/tests/auto/tools/moc/no-keywords.h b/tests/auto/tools/moc/no-keywords.h
index ca77056503..cb0bca7a19 100644
--- a/tests/auto/tools/moc/no-keywords.h
+++ b/tests/auto/tools/moc/no-keywords.h
@@ -69,8 +69,8 @@ public Q_SLOTS:
inline void mySlot() { mySignal(); }
private:
- int signals;
- double slots;
+ Q_DECL_UNUSED_MEMBER int signals;
+ Q_DECL_UNUSED_MEMBER double slots;
};
#define signals Q_SIGNALS
diff --git a/tests/auto/tools/moc/single_function_keyword.h b/tests/auto/tools/moc/single_function_keyword.h
index ec1a0ac628..6abcc42a04 100644
--- a/tests/auto/tools/moc/single_function_keyword.h
+++ b/tests/auto/tools/moc/single_function_keyword.h
@@ -47,7 +47,10 @@ class SingleFunctionKeywordBeforeInline : public QObject
public:
inline SingleFunctionKeywordBeforeInline() {}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wundefined-inline")
Q_SIGNAL inline void mySignal();
+QT_WARNING_POP
Q_SLOT inline void mySlot() { emit mySignal(); }
};
@@ -58,7 +61,10 @@ class SingleFunctionKeywordAfterInline : public QObject
public:
inline SingleFunctionKeywordAfterInline() {}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wundefined-inline")
inline Q_SIGNAL void mySignal();
+QT_WARNING_POP
inline Q_SLOT void mySlot() { emit mySignal(); }
};
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index c866fcd903..f0f8523f19 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -327,9 +327,13 @@ void StructQObject::foo(struct ForwardDeclaredStruct *)
bool field;
};
- struct Inner unusedVariable;
+ Q_DECL_UNUSED_MEMBER struct Inner unusedVariable;
}
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers")
+
class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct),
public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored)
{
@@ -551,6 +555,8 @@ private slots:
virtual inline void blub2() {}
};
+QT_WARNING_POP
+
class PropertyTestClass : public QObject
{
Q_OBJECT
@@ -1757,6 +1763,8 @@ void tst_Moc::QTBUG5590_dummyProperty()
QCOMPARE(o.value2(), 82);
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers")
class QTBUG7421_ReturnConstTemplate: public QObject
{ Q_OBJECT
public slots:
@@ -1766,7 +1774,7 @@ public slots:
const QString returnConstString(const QString s) { return s; }
QString const returnConstString2( QString const s) { return s; }
};
-
+QT_WARNING_POP
struct science_constant {};
struct science_const {};