From 466d32160a23e6848fe0a42e74085c79071d7dec Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 3 Mar 2020 08:01:05 +0100 Subject: [PATCH] Suppress warnings where QString and its tests use SplitBehavior This is a follow-up to commit 895939c7f91d0c8424a0638c42d05cb42293a142 to fix deprecation warnings it added. Change-Id: I3d86655ec2c84c1bdcac9c70436075fc78f2f781 Reviewed-by: Volker Hilsheimer --- src/corelib/text/qstring.cpp | 3 +++ tests/auto/corelib/text/qstring/tst_qstring.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index a2c603c7768..68dec7cfff8 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -7748,7 +7748,10 @@ static ResultList splitString(const StringSource &source, const QChar *sep, #if QT_DEPRECATED_SINCE(5, 15) Qt::SplitBehavior mapSplitBehavior(QString::SplitBehavior sb) { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return sb & QString::SkipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts; +QT_WARNING_POP } #endif diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 7072cb9516d..bc2b19125a8 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -5824,6 +5824,8 @@ void tst_QString::split(const QString &string, const QString &sep, QStringList r QVERIFY(list == result); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED list = str.split(sep, QString::KeepEmptyParts); QVERIFY(list == result); list = str.split(rx, QString::KeepEmptyParts); @@ -5846,6 +5848,7 @@ void tst_QString::split(const QString &string, const QString &sep, QStringList r list = str.split(sep.at(0), QString::SkipEmptyParts); QVERIFY(list == result); } +QT_WARNING_POP } void tst_QString::split()