summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMårten Nordheim <[email protected]>2024-09-03 08:52:34 +0200
committerMårten Nordheim <[email protected]>2024-09-06 13:38:55 +0200
commite54ee29862bd97749d547330a739416768088986 (patch)
treeaefcfc7ab7d951553dbad91ea53467df34ece4b5
parent271bfe4a5405309dc8d48807d6f28d174efb2cc2 (diff)
Tests: suppress has_denorm deprecation
Deprecated in C++23: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2614r2.pdf Pick-to: 6.8 6.7 6.5 Task-number: QTBUG-128584 Change-Id: I43fb045dfa78b1f0ba5bd52886ca1bf89869d91d Reviewed-by: Marc Mutz <[email protected]>
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp4
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp6
-rw-r--r--tests/auto/corelib/serialization/json/tst_qtjson.cpp9
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp3
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp6
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp3
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp3
7 files changed, 24 insertions, 10 deletions
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
index f4f27185998..37fefd68d50 100644
--- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
+++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
@@ -729,12 +729,16 @@ void tst_qfloat16::properties()
#if QT_CONFIG(signaling_nan)
QVERIFY(Bounds::has_signaling_NaN);
#endif
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_DEPRECATED // has_denorm is deprecated in C++23
#if !defined(Q_CC_GHS)
QCOMPARE(Bounds::has_denorm, std::denorm_present);
#else
// For GHS compiler the "denorm_indeterminite" is the expected return value.
QCOMPARE(Bounds::has_denorm, std::denorm_indeterminate);
#endif // Q_CC_GHS
+ QT_WARNING_POP
+
QCOMPARE(Bounds::round_style, std::round_to_nearest);
QCOMPARE(Bounds::radix, 2);
// Untested: has_denorm_loss
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index d7a2ded57a6..37127b4ce09 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -334,7 +334,8 @@ void tst_QNumeric::classifyfp()
QCOMPARE(qFpClassify(-huge), FP_NORMAL);
QCOMPARE(qFpClassify(tiny), FP_NORMAL);
QCOMPARE(qFpClassify(-tiny), FP_NORMAL);
- if (Bounds::has_denorm == std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(const bool has_denorm = Bounds::has_denorm == std::denorm_present;)
+ if (has_denorm) {
QCOMPARE(qFpClassify(tiny / two), FP_SUBNORMAL);
QCOMPARE(qFpClassify(tiny / -two), FP_SUBNORMAL);
}
@@ -396,7 +397,8 @@ void tst_QNumeric::distance()
QFETCH(F, from);
QFETCH(F, stop);
QFETCH(Count, expectedDistance);
- if constexpr (std::numeric_limits<F>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<F>::has_denorm != std::denorm_present;)
+ if constexpr (has_denorm) {
if (qstrcmp(QTest::currentDataTag(), "denormal") == 0) {
QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
}
diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
index 2fa584afa5a..e6c8f90e8f9 100644
--- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
@@ -407,7 +407,8 @@ void tst_QtJson::testNumbers_2()
// Validate the last actual value is min denorm
QVERIFY2(floatValues_1[1074] == 4.9406564584124654417656879286822e-324, QString("Min denorm value is incorrect: %1").arg(floatValues_1[1074]).toLatin1());
- if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm == std::denorm_present;)
+ if constexpr (has_denorm) {
// Validate that every value is half the value before it up to 1
for (int index = 1074; index > 0; index--) {
QVERIFY2(floatValues_1[index] != 0, QString("2**- %1 should not be 0").arg(index).toLatin1());
@@ -2070,7 +2071,8 @@ void tst_QtJson::toJsonLargeNumericValues()
void tst_QtJson::toJsonDenormalValues()
{
- if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm == std::denorm_present;)
+ if constexpr (has_denorm) {
QJsonObject object;
QJsonArray array;
array.append(QJsonValue(5e-324)); // JS Number.MIN_VALUE
@@ -2468,7 +2470,8 @@ void tst_QtJson::parseNumbers()
QCOMPARE(val.toDouble(), numbers[i].n);
}
}
- if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm == std::denorm_present;)
+ if constexpr (has_denorm) {
Numbers numbers [] = {
{ "1.1e-308", 1.1e-308 },
{ "-1.1e-308", -1.1e-308 }
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index e057d9c78f0..029f33954b2 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -1551,7 +1551,8 @@ void tst_QByteArray::number_double()
QFETCH(char, format);
QFETCH(int, precision);
- if constexpr (std::numeric_limits<double>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm != std::denorm_present;)
+ if constexpr (has_denorm) {
if (::qstrcmp(QTest::currentDataTag(), "Very small number, very high precision, format 'f', precision 350") == 0) {
QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
}
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 185f3b97695..f9846a22e37 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -1145,7 +1145,8 @@ void tst_QLocale::stringToFloat()
QLocale locale(locale_name);
QCOMPARE(locale.name(), locale_name);
- if constexpr (std::numeric_limits<float>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool float_has_denorm = std::numeric_limits<float>::has_denorm != std::denorm_present;)
+ if constexpr (float_has_denorm) {
if (qstrcmp(QTest::currentDataTag(), "C float -min") == 0
|| qstrcmp(QTest::currentDataTag(), "C float min") == 0)
QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
@@ -1154,7 +1155,8 @@ void tst_QLocale::stringToFloat()
float f = locale.toFloat(num_str, &ok);
QCOMPARE(ok, good);
- if constexpr (std::numeric_limits<double>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool double_has_denorm = std::numeric_limits<double>::has_denorm != std::denorm_present;)
+ if constexpr (double_has_denorm) {
if (qstrcmp(QTest::currentDataTag(), "C double min") == 0
|| qstrcmp(QTest::currentDataTag(), "C double -min") == 0
|| qstrcmp(QTest::currentDataTag(), "C tiny") == 0
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 5038c97d7f3..d54f40f114d 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -6861,7 +6861,8 @@ void tst_QString::number_double()
QFETCH(double, value);
QFETCH(char, format);
QFETCH(int, precision);
- if constexpr (std::numeric_limits<double>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm != std::denorm_present;)
+ if constexpr (has_denorm) {
if (::qstrcmp(QTest::currentDataTag(), "Very small number, very high precision, format 'f', precision 350") == 0) {
QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
}
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp
index 10069e821ba..8ff003ce986 100644
--- a/tests/auto/corelib/tools/qline/tst_qline.cpp
+++ b/tests/auto/corelib/tools/qline/tst_qline.cpp
@@ -375,7 +375,8 @@ void tst_QLine::testLength()
l.setLength(lengthToSet);
- if constexpr (std::numeric_limits<double>::has_denorm != std::denorm_present) {
+ QT_IGNORE_DEPRECATIONS(constexpr bool has_denorm = std::numeric_limits<double>::has_denorm != std::denorm_present;)
+ if constexpr (has_denorm) {
if (qstrcmp(QTest::currentDataTag(), "[tiny,tiny]->|2| (-tiny/2,-tiny/2)") == 0
|| qstrcmp(QTest::currentDataTag(), "[4e-323,5e-324]|1892|") == 0) {
QSKIP("Skipping 'denorm' as this type lacks denormals on this system");