From 5a4787dca01c302dd462a76222dfbf28c8951a8d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 9 Feb 2018 14:29:21 +0100 Subject: Modernize the "regularexpression" feature Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen --- src/testlib/qtestcase.cpp | 4 ++-- src/testlib/qtestcase.h | 2 +- src/testlib/qtestlog.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 7e9c03dbd4..d53530dadd 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1971,7 +1971,7 @@ void QTest::ignoreMessage(QtMsgType type, const char *message) QTestLog::ignoreMessage(type, message); } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \overload @@ -1991,7 +1991,7 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte { QTestLog::ignoreMessage(type, messagePattern); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index f38f7ed4df..cc666c365a 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -290,7 +290,7 @@ namespace QTest const char *file, int line); Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0); Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message); -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); #endif diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 4964c6538e..6260b9e3fd 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -55,7 +55,9 @@ #include #include #include +#if QT_CONFIG(regularexpression) #include +#endif #include #include @@ -139,7 +141,7 @@ namespace QTest { return tp == type && (pattern.type() == QVariant::String ? stringsMatch(pattern.toString(), message) : -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) pattern.toRegularExpression().match(message).hasMatch()); #else false); @@ -364,7 +366,7 @@ void QTestLog::printUnhandledIgnoreMessages() if (list->pattern.type() == QVariant::String) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); #endif } @@ -548,14 +550,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression) { QTEST_ASSERT(expression.isValid()); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) void QTestLog::setMaxWarnings(int m) { -- cgit v1.2.3