diff options
author | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2019-01-04 16:01:46 +0100 |
---|---|---|
committer | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2019-01-27 21:01:53 +0000 |
commit | 3b514f853595c686d4ed8830567c1f27ea533faf (patch) | |
tree | d37c83df1382ed9060cb561f4272e54b65988c18 | |
parent | fc585d38219bf7f0b26146519d590b65e204ea55 (diff) |
qtlite: Fix build libs with -no-feature-regularexpression
Change-Id: I427ff1f8f4986fbf466aba60a9d3de614c1e006f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 4 | ||||
-rw-r--r-- | src/corelib/serialization/qcborvalue.cpp | 12 | ||||
-rw-r--r-- | src/corelib/serialization/qcborvalue.h | 10 | ||||
-rw-r--r-- | src/corelib/serialization/qjsoncbor.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 6 | ||||
-rw-r--r-- | src/testlib/qtaptestlogger.cpp | 11 |
7 files changed, 50 insertions, 4 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 6541b97595..090436a3c7 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1052,11 +1052,13 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) return false; #ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) case QMetaType::QRegularExpression: if (d->type != QMetaType::QCborValue || !v_cast<QCborValue>(d)->isRegularExpression()) return false; *static_cast<QRegularExpression *>(result) = v_cast<QCborValue>(d)->toRegularExpression(); break; +#endif case QMetaType::QJsonValue: switch (d->type) { case QMetaType::Nullptr: @@ -1232,9 +1234,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::Url: *static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUrl>(d)); break; +#if QT_CONFIG(regularexpression) case QVariant::RegularExpression: *static_cast<QCborValue *>(result) = QCborValue(*v_cast<QRegularExpression>(d)); break; +#endif case QVariant::Uuid: *static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUuid>(d)); break; diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index e53b6a0326..80ef515fd2 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -1771,6 +1771,7 @@ QCborValue::QCborValue(const QUrl &url) container->elements[1].type = String; } +#if QT_CONFIG(regularexpression) /*! Creates a QCborValue object of the regular expression pattern extended type and containing the value represented by \a rx. The value can later be retrieved @@ -1789,6 +1790,7 @@ QCborValue::QCborValue(const QRegularExpression &rx) // change type t = RegularExpression; } +#endif // QT_CONFIG(regularexpression) /*! Creates a QCborValue object of the UUID extended type and containing the @@ -1942,6 +1944,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const return QUrl::fromEncoded(byteData->asByteArrayView()); } +#if QT_CONFIG(regularexpression) /*! Returns the regular expression value stored in this QCborValue, if it is of the regular expression pattern extended type. Otherwise, it returns \a @@ -1960,6 +1963,7 @@ QRegularExpression QCborValue::toRegularExpression(const QRegularExpression &def Q_ASSERT(n == -1); return QRegularExpression(container->stringAt(1)); } +#endif // QT_CONFIG(regularexpression) /*! Returns the UUID value stored in this QCborValue, if it is of the UUID @@ -2400,12 +2404,16 @@ uint qHash(const QCborValue &value, uint seed) return qHash(value.toDateTime(), seed); case QCborValue::Url: return qHash(value.toUrl(), seed); +#if QT_CONFIG(regularexpression) case QCborValue::RegularExpression: return qHash(value.toRegularExpression(), seed); +#endif case QCborValue::Uuid: return qHash(value.toUuid(), seed); case QCborValue::Invalid: return seed; + default: + break; } Q_ASSERT(value.isSimpleType()); @@ -2450,12 +2458,16 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v) return dbg << v.toDateTime(); case QCborValue::Url: return dbg << v.toUrl(); +#if QT_CONFIG(regularexpression) case QCborValue::RegularExpression: return dbg << v.toRegularExpression(); +#endif case QCborValue::Uuid: return dbg << v.toUuid(); case QCborValue::Invalid: return dbg << "<invalid>"; + default: + break; } if (v.isSimpleType()) return dbg << v.toSimpleType(); diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h index 105af1ba73..d6ba4e88d8 100644 --- a/src/corelib/serialization/qcborvalue.h +++ b/src/corelib/serialization/qcborvalue.h @@ -43,7 +43,9 @@ #include <QtCore/qbytearray.h> #include <QtCore/qdatetime.h> #include <QtCore/qcborcommon.h> -#include <QtCore/qregularexpression.h> +#if QT_CONFIG(regularexpression) +# include <QtCore/qregularexpression.h> +#endif #include <QtCore/qstring.h> #include <QtCore/qstringview.h> #include <QtCore/qurl.h> @@ -155,7 +157,9 @@ public: explicit QCborValue(const QDateTime &dt); explicit QCborValue(const QUrl &url); +#if QT_CONFIG(regularexpression) explicit QCborValue(const QRegularExpression &rx); +#endif explicit QCborValue(const QUuid &uuid); ~QCborValue() { if (container) dispose(); } @@ -233,7 +237,9 @@ public: QString toString(const QString &defaultValue = {}) const; QDateTime toDateTime(const QDateTime &defaultValue = {}) const; QUrl toUrl(const QUrl &defaultValue = {}) const; +#if QT_CONFIG(regularexpression) QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const; +#endif QUuid toUuid(const QUuid &defaultValue = {}) const; #ifdef Q_QDOC @@ -380,8 +386,10 @@ public: { return concrete().toDateTime(defaultValue); } QUrl toUrl(const QUrl &defaultValue = {}) const { return concrete().toUrl(defaultValue); } +#if QT_CONFIG(regularexpression) QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const { return concrete().toRegularExpression(defaultValue); } +#endif QUuid toUuid(const QUuid &defaultValue = {}) const { return concrete().toUuid(defaultValue); } diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp index 158f1950d0..4f756df97c 100644 --- a/src/corelib/serialization/qjsoncbor.cpp +++ b/src/corelib/serialization/qjsoncbor.cpp @@ -543,14 +543,19 @@ QVariant QCborValue::toVariant() const case Url: return toUrl(); +#if QT_CONFIG(regularexpression) case RegularExpression: return toRegularExpression(); +#endif case Uuid: return toUuid(); case Invalid: return QVariant(); + + default: + break; } if (isSimpleType()) @@ -714,8 +719,10 @@ QCborValue QCborValue::fromVariant(const QVariant &variant) case QVariant::Hash: return QCborMap::fromVariantHash(variant.toHash()); #ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) case QVariant::RegularExpression: return QCborValue(variant.toRegularExpression()); +#endif case QMetaType::QJsonValue: return fromJsonValue(variant.toJsonValue()); case QMetaType::QJsonObject: diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index f151713400..0a3a37863a 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -51,7 +51,9 @@ #include <private/qguiapplication_p.h> #include <QScreen> #include <QDir> -#include <QRegularExpression> +#if QT_CONFIG(regularexpression) +# include <QRegularExpression> +#endif #include <QLoggingCategory> #if defined(Q_OS_LINUX) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index ddb8f45188..d42a33c22b 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -48,7 +48,9 @@ #undef register #include <GL/glx.h> -#include <QtCore/QRegularExpression> +#if QT_CONFIG(regularexpression) +# include <QtCore/QRegularExpression> +#endif #include <QtGui/QOpenGLContext> #include <QtGui/QOffscreenSurface> @@ -722,6 +724,7 @@ void QGLXContext::queryDummyContext() // The issue was fixed in Xcb 1.11, but we can't check for that // at runtime, so instead assume it fixed with recent Mesa versions // released several years after the Xcb fix. +#if QT_CONFIG(regularexpression) QRegularExpression versionTest(QStringLiteral("Mesa (\\d+)")); QRegularExpressionMatch result = versionTest.match(QString::fromLatin1(mesaVersionStr)); int versionNr = 0; @@ -731,6 +734,7 @@ void QGLXContext::queryDummyContext() // White-listed m_supportsThreading = true; } +#endif } if (!m_supportsThreading) { qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: " diff --git a/src/testlib/qtaptestlogger.cpp b/src/testlib/qtaptestlogger.cpp index 37ab89ac91..a81d9d5c8b 100644 --- a/src/testlib/qtaptestlogger.cpp +++ b/src/testlib/qtaptestlogger.cpp @@ -43,7 +43,9 @@ #include "qtestresult_p.h" #include "qtestassert.h" -#include <QtCore/qregularexpression.h> +#if QT_CONFIG(regularexpression) +# include <QtCore/qregularexpression.h> +#endif QT_BEGIN_NAMESPACE @@ -146,6 +148,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, outputString(YAML_INDENT "---\n"); if (type != XFail) { +#if QT_CONFIG(regularexpression) // This is fragile, but unfortunately testlib doesn't plumb // the expected and actual values to the loggers (yet). static QRegularExpression verifyRegex( @@ -206,6 +209,12 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, YAML_INDENT "# %s\n", description); outputString(unparsableDescription.data()); } +#else + QTestCharBuffer unparsableDescription; + QTest::qt_asprintf(&unparsableDescription, + YAML_INDENT "# %s\n", description); + outputString(unparsableDescription.data()); +#endif } if (file) { |