Tests: disable various compiler warnings

The build on Android with clang results in a bunch of irrelevant
warnings. Disable them for the offending lines of test code.

Pick-to: 6.8
Change-Id: Ica5d867e3a2b1215dc526cc5f945a39ac908ac23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Volker Hilsheimer 2024-07-10 12:42:12 +02:00
parent 2339cb3ea2
commit 8d523a098c
3 changed files with 20 additions and 0 deletions

View File

@ -503,6 +503,9 @@ void tst_QtJson::testNumberComparisons()
QJsonValue llMinPlus1(Q_INT64_C(-9223372036854775806));
QCOMPARE(llMin == llMinPlus1, Q_INT64_C(-9223372036854775807) == Q_INT64_C(-9223372036854775806)); // false
QT_WARNING_PUSH
// Android clang complains about implicit conversion from 'long long' to 'double'
QT_WARNING_DISABLE_CLANG("-Wimplicit-const-int-float-conversion")
// The different storage formats should be able to compare as their C++ versions (all true)
QCOMPARE(llMin == llMinDbl, Q_INT64_C(-9223372036854775807) == -9223372036854775807.0);
QCOMPARE(llMinDbl == llMin, -9223372036854775807.0 == Q_INT64_C(-9223372036854775807));
@ -510,6 +513,7 @@ void tst_QtJson::testNumberComparisons()
QCOMPARE(llMinPlus1Dbl == llMinPlus1, -9223372036854775806.0 == Q_INT64_C(-9223372036854775806));
QCOMPARE(llMinPlus1 == llMinDbl, Q_INT64_C(-9223372036854775806) == -9223372036854775807.0);
QCOMPARE(llMinPlus1Dbl == llMin, -9223372036854775806.0 == Q_INT64_C(-9223372036854775807));
QT_WARNING_POP
}
void tst_QtJson::testObjectSimple()

View File

@ -1652,12 +1652,16 @@ void tst_QString::asprintfS()
// Check utf8 conversion for %s
QCOMPARE(QString::asprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305"));
QT_WARNING_PUSH
// Android clang emits warning: '%n' specifier not supported on this platform
QT_WARNING_DISABLE_CLANG("-Wformat")
int n1;
QCOMPARE(QString::asprintf("%s%n%s", "hello", &n1, "goodbye"), u"hellogoodbye");
QCOMPARE(n1, 5);
qlonglong n2;
QCOMPARE(QString::asprintf("%s%s%lln%s", "foo", "bar", &n2, "whiz"), u"foobarwhiz");
QCOMPARE((int)n2, 6);
QT_WARNING_POP
{ // %ls
@ -1681,7 +1685,11 @@ void tst_QString::asprintfS()
QLatin1String("\366\344\374\326\304\334\370\346\345\330\306\305"));
int n;
QT_WARNING_PUSH
// Android clang emits warning: '%n' specifier not supported on this platform
QT_WARNING_DISABLE_CLANG("-Wformat")
QCOMPARE(QString::asprintf("%ls%n%s", qUtf16Printable(u"hello"_s), &n, "goodbye"), "hellogoodbye"_L1);
QT_WARNING_POP
QCOMPARE(n, 5);
}
}

View File

@ -409,6 +409,9 @@ void tst_QBitArray::operator_andeq()
result &= detached(input1);
COMPARE_BITARRAY_EQ(result, res);
QT_WARNING_PUSH
// Android clang emits warning: explicitly assigning value of variable of type 'QBitArray' to itself
QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded")
// operation is idempotent
result &= result;
COMPARE_BITARRAY_EQ(result, res);
@ -416,6 +419,7 @@ void tst_QBitArray::operator_andeq()
COMPARE_BITARRAY_EQ(result, res);
result &= detached(result);
COMPARE_BITARRAY_EQ(result, res);
QT_WARNING_POP
}
void tst_QBitArray::operator_and()
@ -515,6 +519,9 @@ void tst_QBitArray::operator_oreq()
result |= detached(input1);
COMPARE_BITARRAY_EQ(result, res);
QT_WARNING_PUSH
// Android clang emits warning: explicitly assigning value of variable of type 'QBitArray' to itself
QT_WARNING_DISABLE_CLANG("-Wself-assign-overloaded")
// operation is idempotent
result |= result;
COMPARE_BITARRAY_EQ(result, res);
@ -522,6 +529,7 @@ void tst_QBitArray::operator_oreq()
COMPARE_BITARRAY_EQ(result, res);
result |= detached(result);
COMPARE_BITARRAY_EQ(result, res);
QT_WARNING_POP
}
void tst_QBitArray::operator_or()