summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-08-12 18:00:53 +0100
committerMarc Mutz <marc.mutz@kdab.com>2014-08-13 08:48:01 +0200
commit10b9e1b6b4deadfa35caefb0c8fdc5b69c63fe0d (patch)
tree1fb0e173be0f123fb83bf3b9df9b08449c7c1be2 /src
parentbf9a4ef8b4210bd1f434828911361008ea2350ec (diff)
Fix QT_NO_REGULAREXPRESSION build
Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qregularexpression.cpp4
-rw-r--r--src/testlib/qtestcase.cpp2
-rw-r--r--src/testlib/qtestcase.h2
-rw-r--r--src/testlib/qtestlog.cpp8
-rw-r--r--src/testlib/qtestlog_p.h2
5 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index e1cf82bb8c..257141efdc 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -43,6 +43,8 @@
#include "qregularexpression.h"
+#ifndef QT_NO_REGULAREXPRESSION
+
#include <QtCore/qcoreapplication.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
@@ -2495,3 +2497,5 @@ static const char *pcreCompileErrorCodes[] =
#endif // #if 0
QT_END_NAMESPACE
+
+#endif // QT_NO_REGULAREXPRESSION
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 5d2014b0c5..83cba0d672 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2617,10 +2617,12 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
\since 5.3
*/
+#ifndef QT_NO_REGULAREXPRESSION
void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern)
{
QTestLog::ignoreMessage(type, messagePattern);
}
+#endif
/*! \internal
*/
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index d9c8a43a2a..2b9acabf95 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -248,7 +248,9 @@ namespace QTest
const char *file, int line);
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = 0, int line = 0);
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
+#ifndef QT_NO_REGULAREXPRESSION
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
+#endif
Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = 0, int line = 0, const char* builddir = 0);
Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = 0, int line = 0, const char* builddir = 0);
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 8cca892a4d..4ef1113641 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -133,7 +133,11 @@ namespace QTest {
return tp == type
&& (pattern.type() == QVariant::String ?
stringsMatch(pattern.toString(), message) :
+#ifndef QT_NO_REGULAREXPRESSION
pattern.toRegularExpression().match(message).hasMatch());
+#else
+ false);
+#endif
}
QtMsgType type;
@@ -359,7 +363,9 @@ void QTestLog::printUnhandledIgnoreMessages()
if (list->pattern.type() == QVariant::String) {
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
} else {
+#ifndef QT_NO_REGULAREXPRESSION
message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');
+#endif
}
QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message);
@@ -512,12 +518,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg)
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg));
}
+#ifndef QT_NO_REGULAREXPRESSION
void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)
{
QTEST_ASSERT(expression.isValid());
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));
}
+#endif
void QTestLog::setMaxWarnings(int m)
{
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index a987c45806..0ed6750f63 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -76,7 +76,9 @@ public:
static void addBenchmarkResult(const QBenchmarkResult &result);
static void ignoreMessage(QtMsgType type, const char *msg);
+#ifndef QT_NO_REGULAREXPRESSION
static void ignoreMessage(QtMsgType type, const QRegularExpression &expression);
+#endif
static int unhandledIgnoreMessages();
static void printUnhandledIgnoreMessages();
static void clearIgnoreMessages();