diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-01 10:24:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-02 12:06:05 +0100 |
commit | bde773ec6a0d9319bd8cebf138513afd79c2eef7 (patch) | |
tree | 9cfb89a31d66b6f8849ad0e37d2aee9572cf6a67 /tests/benchmarks | |
parent | fce101913313f7705831bb5de10dbbab46e5b3a0 (diff) |
Fix a few compiler warnings in tests
Change-Id: I22f6ac8ed02dd4ef4083ce3c781552623a0b08da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/benchmarks')
6 files changed, 26 insertions, 32 deletions
diff --git a/tests/benchmarks/corelib/kernel/events/main.cpp b/tests/benchmarks/corelib/kernel/events/main.cpp index 9998eeee4e..973d96261c 100644 --- a/tests/benchmarks/corelib/kernel/events/main.cpp +++ b/tests/benchmarks/corelib/kernel/events/main.cpp @@ -37,7 +37,7 @@ public: void resetCounter() {m_counter = 100;} protected: - bool event(QEvent *e); + bool event(QEvent *e) override; private: QObject *m_peer; @@ -68,7 +68,7 @@ public: int foo(int bar); protected: - bool event(QEvent *e); + bool event(QEvent *e) override; }; bool EventTester::event(QEvent *e) diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index f010b05e54..9cea995433 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -260,7 +260,8 @@ public: NativeMutexThread(NativeMutexType *mutex1, NativeMutexType *mutex2, int iterations, int msleepDuration, bool use2mutexes) : mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false) { } - void run() { + void run() override + { forever { tst_QMutex::semaphore1.release(); tst_QMutex::semaphore2.acquire(); @@ -329,7 +330,8 @@ public: QMutexThread(QMutex *mutex1, QMutex *mutex2, int iterations, int msleepDuration, bool use2mutexes) : mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false) { } - void run() { + void run() override + { forever { tst_QMutex::semaphore1.release(); tst_QMutex::semaphore2.acquire(); @@ -393,7 +395,8 @@ public: QMutexLockerThread(QMutex *mutex1, QMutex *mutex2, int iterations, int msleepDuration, bool use2mutexes) : mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false) { } - void run() { + void run() override + { forever { tst_QMutex::semaphore1.release(); tst_QMutex::semaphore2.acquire(); diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp index 4e31dd4009..b87da463dc 100644 --- a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp @@ -61,7 +61,7 @@ public: int m_threadid; int timeout; - void run() + void run() override { for (int count = 0; count < 5000; ++count) { diff --git a/tests/benchmarks/dbus/qdbusperformance/serverobject.h b/tests/benchmarks/dbus/qdbusperformance/serverobject.h index b7ef2991c2..ea499f32ec 100644 --- a/tests/benchmarks/dbus/qdbusperformance/serverobject.h +++ b/tests/benchmarks/dbus/qdbusperformance/serverobject.h @@ -70,13 +70,12 @@ public slots: int size(const QDBusVariant &data) { QVariant v = data.variant(); - switch (v.type()) - { - case QVariant::ByteArray: + switch (v.typeId()) { + case QMetaType::QByteArray: return v.toByteArray().size(); - case QVariant::StringList: + case QMetaType::QStringList: return v.toStringList().size(); - case QVariant::String: + case QMetaType::QString: default: return v.toString().size(); } diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.h b/tests/benchmarks/gui/animation/qanimation/rectanimation.h index 8d7de89eaa..9528b6c16d 100644 --- a/tests/benchmarks/gui/animation/qanimation/rectanimation.h +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.h @@ -43,9 +43,9 @@ public: void setStartValue(const QRect &rect); void setDuration(int d); - int duration() const; + int duration() const override; - virtual void updateCurrentTime(int currentTime); + void updateCurrentTime(int currentTime) override; private: DummyObject *m_object; diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 6d55cb4306..5e590c7d13 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -81,7 +81,7 @@ private slots: } protected: - void run() + void run() override { QTcpServer server; server.listen(); @@ -176,7 +176,7 @@ public: inline int serverPort() const { return port; } protected: - void run() + void run() override { QTcpServer server; server.listen(); @@ -216,7 +216,7 @@ public slots: void stop() { state = Stopped; emit readyRead(); } protected: - virtual qint64 readData(char *data, qint64 maxlen) + qint64 readData(char *data, qint64 maxlen) override { if (state == Stopped) return -1; // EOF @@ -225,8 +225,7 @@ protected: memset(data, '@', maxlen); return maxlen; } - virtual qint64 writeData(const char *, qint64) - { return -1; } + qint64 writeData(const char *, qint64) override { return -1; } }; class ThreadedDataReaderHttpServer: public QThread @@ -248,7 +247,7 @@ public: inline int serverPort() const { return port; } protected: - void run() + void run() override { QTcpServer server; server.listen(); @@ -303,28 +302,22 @@ public: toBeGeneratedTotalCount = toBeGeneratedCount = size; } - virtual qint64 bytesAvailable() const + qint64 bytesAvailable() const override { return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0; } - virtual bool isSequential() const{ - return false; - } + bool isSequential() const override { return false; } - virtual bool reset() { - return false; - } + bool reset() override { return false; } - qint64 size() const { - return toBeGeneratedTotalCount; - } + qint64 size() const override { return toBeGeneratedTotalCount; } public slots: void start() { state = Started; emit readyRead(); } protected: - virtual qint64 readData(char *data, qint64 maxlen) + qint64 readData(char *data, qint64 maxlen) override { memset(data, '@', maxlen); @@ -342,8 +335,7 @@ protected: return n; } - virtual qint64 writeData(const char *, qint64) - { return -1; } + qint64 writeData(const char *, qint64) override { return -1; } qint64 toBeGeneratedCount; qint64 toBeGeneratedTotalCount; |