Commit d351756c authored by Carlos Alves's avatar Carlos Alves
Browse files

OptimizeOnFirstUsageOption is ignored by compiler

This option is deprecated on Qt since 5.12. Konsole cmake minimal Qt
version set is 5.12, giving warning messages while making.
A regular expression is automatically optimized the first time it is
used now.
parent fa398f56
......@@ -17,19 +17,16 @@ using namespace Konsole;
// Please be careful when altering them.
// protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, ), :, comma and dot
const QRegularExpression UrlFilter::FullUrlRegExp(
QStringLiteral("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:]"),
QRegularExpression::OptimizeOnFirstUsageOption);
QStringLiteral("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:]"));
// email address:
// [word chars, dots or dashes]@[word chars, dots or dashes].[word chars]
const QRegularExpression UrlFilter::EmailAddressRegExp(
QStringLiteral("\\b(\\w|\\.|-|\\+)+@(\\w|\\.|-)+\\.\\w+\\b"),
QRegularExpression::OptimizeOnFirstUsageOption);
QStringLiteral("\\b(\\w|\\.|-|\\+)+@(\\w|\\.|-)+\\.\\w+\\b"));
// matches full url or email address
const QRegularExpression UrlFilter::CompleteUrlRegExp(
QLatin1Char('(') + FullUrlRegExp.pattern() + QLatin1Char('|') + EmailAddressRegExp.pattern() + QLatin1Char(')'),
QRegularExpression::OptimizeOnFirstUsageOption);
QLatin1Char('(') + FullUrlRegExp.pattern() + QLatin1Char('|') + EmailAddressRegExp.pattern() + QLatin1Char(')'));
UrlFilter::UrlFilter()
......
......@@ -337,12 +337,10 @@ QList<KeyboardTranslatorReader::Token> KeyboardTranslatorReader::tokenize(const
text = text.simplified();
// title line: keyboard "title"
static const QRegularExpression title(QStringLiteral("keyboard\\s+\"(.*)\""),
QRegularExpression::OptimizeOnFirstUsageOption);
static const QRegularExpression title(QStringLiteral("keyboard\\s+\"(.*)\""));
// key line: key KeySequence : "output"
// key line: key KeySequence : command
static const QRegularExpression key(QStringLiteral("key\\s+(.+?)\\s*:\\s*(\"(.*)\"|\\w+)"),
QRegularExpression::OptimizeOnFirstUsageOption);
static const QRegularExpression key(QStringLiteral("key\\s+(.+?)\\s*:\\s*(\"(.*)\"|\\w+)"));
QList<Token> list;
if (text.isEmpty()) {
......
......@@ -135,8 +135,7 @@ void Template::executeCommand(Element &element, const Template::Element &childSt
// Set printf-like format (with leading %) applied for strings and numbers
// inside the group
} else if(argv[0] == QStringLiteral("fmt")) {
static const QRegularExpression FMT_RE(QStringLiteral(R":(^%[-0 +#]?(?:[1-9][0-9]*)?\.?[0-9]*[diouxXs]$):"),
QRegularExpression::OptimizeOnFirstUsageOption);
static const QRegularExpression FMT_RE(QStringLiteral(R":(^%[-0 +#]?(?:[1-9][0-9]*)?\.?[0-9]*[diouxXs]$):"));
const auto match = FMT_RE.match(argv.value(1));
QString fmt = QStringLiteral("");
if(!match.hasMatch())
......@@ -155,14 +154,11 @@ void Template::parseRecursively(Element &element) {
static const QRegularExpression RE(QStringLiteral(R":((?'comment'«\*(([^:]*):)?.*?(?(-2):\g{-1})\*»)|):"
R":(«(?:(?'name'[-_a-zA-Z0-9]*)|(?:!(?'cmd'[-_a-zA-Z0-9]+(?: +(?:[^\\:]+|(?:\\.)+)+)?)))):"
R":((?::(?:~[ \t]*\n)?(?'inner'(?:[^«]*?|(?R))*))?(?:\n[ \t]*~)?»):"),
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption |
QRegularExpression::OptimizeOnFirstUsageOption);
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption);
static const QRegularExpression CMD_SPLIT_RE(QStringLiteral(R":((?:"((?:(?:\\.)*|[^"]*)*)"|(?:[^\\ "]+|(?:\\.)+)+)):"),
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption |
QRegularExpression::OptimizeOnFirstUsageOption);
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption);
static const QRegularExpression UNESCAPE_RE(QStringLiteral(R":(\\(.)):"),
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption |
QRegularExpression::OptimizeOnFirstUsageOption);
QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption);
static const QString nameGroupName = QStringLiteral("name");
static const QString innerGroupName = QStringLiteral("inner");
static const QString cmdGroupName = QStringLiteral("cmd");
......
......@@ -70,8 +70,7 @@ protected:
// "udRangeInd" (UnicodeData.txt only) - if present, the line is either first or last line of a range
R"#([ \t]*(?<field0>[^#;\n]*?(?:, (?<udRangeInd>First|Last)>)?)[ \t]*(?:;|(?:\#.*)?$))|)#"
// Match 2..n: "field" - n-th field
R"#((?:\G(?<=;)[ \t]*(?<field>[^#;\n]*?)[ \t]*(?:;|(?:#.*)?$)))#"),
QRegularExpression::OptimizeOnFirstUsageOption
R"#((?:\G(?<=;)[ \t]*(?<field>[^#;\n]*?)[ \t]*(?:;|(?:#.*)?$)))#")
);
static const QRegularExpression UD_RANGE_IND_RE(QStringLiteral(", (First|Last)"));
static const QRegularExpression COMMENT_RE(QStringLiteral("^[ \t]*(#.*)?$"));
......@@ -717,7 +716,7 @@ bool details(QTextStream &out, const QVector<CharacterProperties> &props, const
template <class EntryType>
static void processInputFiles(QVector<CharacterProperties> &props, const QStringList &files, const QString &fileTypeName,
void (*cb)(CharacterProperties &prop, const EntryType &entry)) {
static const QRegularExpression PROTOCOL_RE(QStringLiteral(R"#(^[a-z]+://)#"), QRegularExpression::OptimizeOnFirstUsageOption);
static const QRegularExpression PROTOCOL_RE(QStringLiteral(R"#(^[a-z]+://)#"));
for(const QString &fileName: files) {
qInfo().noquote() << QStringLiteral("Parsing as %1: %2").arg(fileTypeName).arg(fileName);
QSharedPointer<QIODevice> source = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment