summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-03 17:11:36 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-05 18:41:27 +0200
commita1947aeffe158a0ea7de3ced1bf8d6a4719a27ef (patch)
treec1b249b7d8bd9b3079df3ad5fe468f7ff4df861b /qmake/generators/win32
parent412dd857b81471277e1014b6329f46a389a42cb3 (diff)
Port qmake over to user QRegularExpression
Use the DotMatchesEverythingOption for all places where we interpret .pro files, to increase compatibility with QRegExp. Change-Id: I347d6b17858069f3c9cedcedd04df58358d83f27 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r--qmake/generators/win32/mingw_make.cpp4
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp9
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp8
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp4
-rw-r--r--qmake/generators/win32/winmakefile.cpp8
5 files changed, 17 insertions, 16 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 096b041056..7a717a80a9 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -31,7 +31,7 @@
#include <proitems.h>
-#include <qregexp.h>
+#include <qregularexpression.h>
#include <qdir.h>
#include <stdlib.h>
#include <time.h>
@@ -209,7 +209,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
const ProStringList &incs = project->values("INCLUDEPATH");
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit).toQString();
- inc.replace(QRegExp("\\\\$"), "");
+ inc.replace(QRegularExpression("\\\\$"), "");
if (!isystem.isEmpty() && isSystemInclude(inc))
t << isystem << ' ';
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 355260c974..82c0983272 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -34,7 +34,7 @@
#include <qscopedpointer.h>
#include <qstringlist.h>
#include <qfileinfo.h>
-#include <qregexp.h>
+#include <qregularexpression.h>
QT_BEGIN_NAMESPACE
@@ -834,12 +834,13 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
QFile manifestFile(Option::output_dir + QLatin1Char('/') + manifest);
if (manifestFile.open(QFile::ReadOnly)) {
const QString contents = manifestFile.readAll();
- QRegExp regexp("[\\\\/a-zA-Z0-9_\\-\\!]*\\.(png|jpg|jpeg)");
+ QRegularExpression regexp("[\\\\/a-zA-Z0-9_\\-\\!]*\\.(png|jpg|jpeg)");
int pos = 0;
while (pos > -1) {
- pos = regexp.indexIn(contents, pos);
+ QRegularExpressionMatch m;
+ pos = contents.indexOf(regexp, pos, &m);
if (pos >= 0) {
- const QString match = regexp.cap(0);
+ const QString match = m.captured(0);
icons.insert(match);
pos += match.length();
}
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 73e84a3269..cf58ead2e9 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -29,7 +29,7 @@
#include "msvc_nmake.h"
#include "option.h"
-#include <qregexp.h>
+#include <qregularexpression.h>
#include <qdir.h>
#include <qdiriterator.h>
#include <qset.h>
@@ -370,12 +370,12 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
t << '{' << escapeDependencyPath(sourceDir) << '}' << (*cppit)
<< '{' << escapeDependencyPath(objDir) << '}' << Option::obj_ext << "::\n\t"
- << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegExp("\\$@"), fileVar("OBJECTS_DIR"))
+ << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegularExpression("\\$@"), fileVar("OBJECTS_DIR"))
<< "\n\t$<\n<<\n\n";
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
t << '{' << escapeDependencyPath(sourceDir) << '}' << (*cit)
<< '{' << escapeDependencyPath(objDir) << '}' << Option::obj_ext << "::\n\t"
- << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegExp("\\$@"), fileVar("OBJECTS_DIR"))
+ << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegularExpression("\\$@"), fileVar("OBJECTS_DIR"))
<< "\n\t$<\n<<\n\n";
}
} else {
@@ -434,7 +434,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
}
const QString resourceId = (templateName == "app") ? "1" : "2";
- const bool incrementalLinking = project->values("QMAKE_LFLAGS").toQStringList().filter(QRegExp("(/|-)INCREMENTAL:NO")).isEmpty();
+ const bool incrementalLinking = project->values("QMAKE_LFLAGS").toQStringList().filter(QRegularExpression("(/|-)INCREMENTAL:NO")).isEmpty();
if (incrementalLinking && !linkerSupportsEmbedding) {
// Link a resource that contains the manifest without modifying the exe/dll after linking.
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 3002ce889c..9e93fe51f3 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -34,7 +34,7 @@
#include <qscopedpointer.h>
#include <qfileinfo.h>
-#include <qregexp.h>
+#include <qregularexpression.h>
using namespace QMakeInternal;
@@ -321,7 +321,7 @@ triState operator!(const triState &rhs)
QStringList VCToolBase::fixCommandLine(const QString &input)
{
// The splitting regexp is a bit bizarre for backwards compat reasons (why else ...).
- return input.split(QRegExp(QLatin1String("(\n\t|\r\\\\h|\r\n)\\s*")));
+ return input.split(QRegularExpression(QLatin1String("(\n\t|\r\\\\h|\r\n)\\s*")));
}
static QString vcCommandSeparator()
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 112ad1f739..57f02c13d0 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -33,7 +33,7 @@
#include <qtextstream.h>
#include <qstring.h>
#include <qhash.h>
-#include <qregexp.h>
+#include <qregularexpression.h>
#include <qstringlist.h>
#include <qdir.h>
#include <stdlib.h>
@@ -561,7 +561,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t)
const ProStringList &incs = project->values("INCLUDEPATH");
for(int i = 0; i < incs.size(); ++i) {
QString inc = incs.at(i).toQString();
- inc.replace(QRegExp("\\\\$"), "");
+ inc.replace(QRegularExpression("\\\\$"), "");
if(!inc.isEmpty())
t << "-I" << escapeFilePath(inc) << ' ';
}
@@ -588,7 +588,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
t << "####### Output directory\n\n";
if(!project->values("OBJECTS_DIR").isEmpty())
- t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << Qt::endl;
+ t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegularExpression("\\\\$"))) << Qt::endl;
else
t << "OBJECTS_DIR = . \n";
t << Qt::endl;
@@ -860,7 +860,7 @@ QString Win32MakefileGenerator::escapeDependencyPath(const QString &path) const
{
QString ret = path;
if (!ret.isEmpty()) {
- static const QRegExp criticalChars(QStringLiteral("([\t #])"));
+ static const QRegularExpression criticalChars(QStringLiteral("([\t #])"));
if (ret.contains(criticalChars))
ret = "\"" + ret + "\"";
debug_msg(2, "EscapeDependencyPath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData());