diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-26 17:11:19 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-26 18:06:34 +0200 |
commit | f418a96f9b7f003738894d0c19e176b2abc457df (patch) | |
tree | 01c5f37ed6cd4079f296ae066ae0bc82b0f62392 /tests | |
parent | d1fd2ff11f53be850eeb7f5f4699ea4a8966f164 (diff) |
Disable warning about self-move and self-assign-overload
Change-Id: I1d20d3f424eced5cc5787934663b9d243f75d46e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
7 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index da0accad69..f6f558dcd3 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -147,6 +147,9 @@ void tst_QRandomGenerator::basics() // default constructible QRandomGenerator rng; +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-move") +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") // copyable && movable rng = rng; rng = std::move(rng); @@ -155,6 +158,7 @@ void tst_QRandomGenerator::basics() QRandomGenerator64 rng64; rng64 = rng64; rng64 = std::move(rng64); +QT_WARNING_POP // 32- and 64-bit should be interchangeable: rng = rng64; diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 16f0ffdb79..304020d1f3 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1653,7 +1653,10 @@ void tst_QDir::dirName() void tst_QDir::operator_eq() { QDir dir1("."); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") dir1 = dir1; +QT_WARNING_POP dir1.setPath(".."); } diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp index 011a44d405..0ab86652d6 100644 --- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp +++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp @@ -468,9 +468,12 @@ void tst_QCborValue::copyCompare() QFETCH(QCborValue, v); QCborValue other = v; +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-move") // self-moving v = std::move(v); QCOMPARE(v, other); // make sure it's still valid +QT_WARNING_POP // moving v = std::move(other); diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp index 71f4d367fe..58275e0372 100644 --- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp @@ -840,9 +840,12 @@ void tst_QAtomicInt::operators() QCOMPARE(int(atomic), x); QCOMPARE(int(atomic), 0x13); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") x = (atomic ^= atomic); QCOMPARE(int(atomic), x); QCOMPARE(int(atomic), 0); +QT_WARNING_POP } void tst_QAtomicInt::testAndSet_loop() diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 23a734f428..748b32fb30 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -455,7 +455,10 @@ void tst_Collections::list() { QList<int> list; list.append(1); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") list = list; +QT_WARNING_POP QVERIFY(list.size() == 1); } } @@ -1143,6 +1146,8 @@ void tst_Collections::hash() QVERIFY(hash.size() == 2); QVERIFY(!hash.isEmpty()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") { Hash hash2 = hash; hash2 = hash; @@ -1155,6 +1160,7 @@ void tst_Collections::hash() QVERIFY(hash2.isEmpty()); } QVERIFY(hash.size() == 2); +QT_WARNING_POP { Hash hash2 = hash; @@ -1366,6 +1372,8 @@ void tst_Collections::map() QVERIFY(map.size() == 2); QVERIFY(!map.isEmpty()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") { Map map2 = map; map2 = map; @@ -1378,6 +1386,7 @@ void tst_Collections::map() QVERIFY(map2.isEmpty()); } QVERIFY(map.size() == 2); +QT_WARNING_POP { Map map2 = map; diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index b1067e9a83..d5a8db7553 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -331,6 +331,8 @@ void tst_QHash::insert1() QVERIFY(hash.size() == 2); QVERIFY(!hash.isEmpty()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded") { Hash hash2 = hash; hash2 = hash; @@ -343,6 +345,7 @@ void tst_QHash::insert1() QVERIFY(hash2.isEmpty()); } QVERIFY(hash.size() == 2); +QT_WARNING_POP { Hash hash2 = hash; diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index 435bd42faf..10d91894b7 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -1224,8 +1224,11 @@ void tst_Compiler::cxx11_rvalue_refs() #else // we require std::move: { +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wself-move") int i = 1; i = std::move(i); +QT_WARNING_POP MoveDefinedQString s("Hello"); MoveDefinedQString t = std::move(s); |