summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-03 15:49:15 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-03 15:49:15 +0200
commit6357813207c866c99aadfd91af8fb3affe891f1d (patch)
tree69464d415b12ebaa3e57d88d7b5cd113878be988 /src/tools
parent5a76a3fb03f8d1dc8cb367de1a1dc6a37048376a (diff)
parentb3fcaea5f2b97d3f562add97aee48cbb469c875a (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: configure src/3rdparty/double-conversion/include/double-conversion/utils.h src/corelib/global/qnamespace.qdoc src/corelib/tools/qsimd_p.h tests/auto/corelib/io/qfile/tst_qfile.cpp Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/moc/generator.cpp8
-rw-r--r--src/tools/moc/main.cpp2
-rw-r--r--src/tools/moc/moc.cpp28
-rw-r--r--src/tools/moc/preprocessor.cpp18
-rw-r--r--src/tools/rcc/main.cpp5
5 files changed, 33 insertions, 28 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 2b09cf873a..3f274401b3 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -79,7 +79,7 @@ Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, con
, knownGadgets(knownGadgets)
{
if (cdef->superclassList.size())
- purestSuperClass = cdef->superclassList.first().first;
+ purestSuperClass = cdef->superclassList.constFirst().first;
}
static inline int lengthOfEscapeSequence(const QByteArray &s, int i)
@@ -499,9 +499,9 @@ void Generator::generateCode()
// QTBUG-20639 - Accept non-local enums for QML signal/slot parameters.
// Look for any scoped enum declarations, and add those to the list
// of extra/related metaobjects for this object.
- QList<QByteArray> enumKeys = cdef->enumDeclarations.keys();
- for (int i = 0; i < enumKeys.count(); ++i) {
- const QByteArray &enumKey = enumKeys[i];
+ for (auto it = cdef->enumDeclarations.keyBegin(),
+ end = cdef->enumDeclarations.keyEnd(); it != end; ++it) {
+ const QByteArray &enumKey = *it;
int s = enumKey.lastIndexOf("::");
if (s > 0) {
QByteArray scope = enumKey.left(s);
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index db81ecabd2..491301d582 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -370,7 +370,7 @@ int runMoc(int argc, char **argv)
int spos = filename.lastIndexOf(QDir::separator());
int ppos = filename.lastIndexOf(QLatin1Char('.'));
// spos >= -1 && ppos > spos => ppos >= 0
- moc.noInclude = (ppos > spos && filename[ppos + 1].toLower() != QLatin1Char('h'));
+ moc.noInclude = (ppos > spos && filename.at(ppos + 1).toLower() != QLatin1Char('h'));
}
if (defaultInclude) {
if (moc.includePath.isEmpty()) {
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 0e689bd5c1..1cf74c7389 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -136,7 +136,7 @@ bool Moc::parseClassHead(ClassDef *def)
} while (test(COMMA));
if (!def->superclassList.isEmpty()
- && knownGadgets.contains(def->superclassList.first().first)) {
+ && knownGadgets.contains(def->superclassList.constFirst().first)) {
// Q_GADGET subclasses are treated as Q_GADGETs
knownGadgets.insert(def->classname, def->qualified);
knownGadgets.insert(def->qualified, def->qualified);
@@ -312,7 +312,7 @@ void Moc::parseFunctionArguments(FunctionDef *def)
}
if (!def->arguments.isEmpty()
- && def->arguments.last().normalizedType == "QPrivateSignal") {
+ && def->arguments.constLast().normalizedType == "QPrivateSignal") {
def->arguments.removeLast();
def->isPrivateSignal = true;
}
@@ -730,7 +730,7 @@ void Moc::parse()
if (funcDef.isConstructor) {
if ((access == FunctionDef::Public) && funcDef.isInvokable) {
def.constructorList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.constructorList += funcDef;
@@ -743,7 +743,7 @@ void Moc::parse()
def.publicList += funcDef;
if (funcDef.isSlot) {
def.slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.slotList += funcDef;
@@ -752,7 +752,7 @@ void Moc::parse()
++def.revisionedMethods;
} else if (funcDef.isSignal) {
def.signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.signalList += funcDef;
@@ -761,7 +761,7 @@ void Moc::parse()
++def.revisionedMethods;
} else if (funcDef.isInvokable) {
def.methodList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.methodList += funcDef;
@@ -863,7 +863,7 @@ void Moc::generate(FILE *out)
{
QByteArray fn = filename;
int i = filename.length()-1;
- while (i>0 && filename[i-1] != '/' && filename[i-1] != '\\')
+ while (i > 0 && filename.at(i - 1) != '/' && filename.at(i - 1) != '\\')
--i; // skip path
if (i >= 0)
fn = filename.mid(i);
@@ -879,7 +879,7 @@ void Moc::generate(FILE *out)
includePath += '/';
for (int i = 0; i < includeFiles.size(); ++i) {
QByteArray inc = includeFiles.at(i);
- if (inc[0] != '<' && inc[0] != '"') {
+ if (inc.at(0) != '<' && inc.at(0) != '"') {
if (includePath.size() && includePath != "./")
inc.prepend(includePath);
inc = '\"' + inc + '\"';
@@ -887,7 +887,7 @@ void Moc::generate(FILE *out)
fprintf(out, "#include %s\n", inc.constData());
}
}
- if (classList.size() && classList.first().classname == "Qt")
+ if (classList.size() && classList.constFirst().classname == "Qt")
fprintf(out, "#include <QtCore/qobject.h>\n");
fprintf(out, "#include <QtCore/qbytearray.h>\n"); // For QByteArrayData
@@ -965,7 +965,7 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access)
++def->revisionedMethods;
}
def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->slotList += funcDef;
@@ -1021,7 +1021,7 @@ void Moc::parseSignals(ClassDef *def)
++def->revisionedMethods;
}
def->signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->signalList += funcDef;
@@ -1059,7 +1059,7 @@ void Moc::createPropertyDef(PropertyDef &propDef)
next();
propDef.name = lexem();
while (test(IDENTIFIER)) {
- QByteArray l = lexem();
+ const QByteArray l = lexem();
if (l[0] == 'C' && l == "CONSTANT") {
propDef.constant = true;
continue;
@@ -1395,7 +1395,7 @@ void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access)
funcDef.access = access;
parseFunction(&funcDef, true);
def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->slotList += funcDef;
@@ -1539,7 +1539,7 @@ void Moc::checkSuperClasses(ClassDef *def)
if (interface2IdMap.contains(superClass)) {
bool registeredInterface = false;
for (int i = 0; i < def->interfaceList.count(); ++i)
- if (def->interfaceList.at(i).first().className == superClass) {
+ if (def->interfaceList.at(i).constFirst().className == superClass) {
registeredInterface = true;
break;
}
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 9d9feb3ebe..ca5ee87cf1 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -205,13 +205,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
// STRING_LITERAL handling in moc
if (!Preprocessor::preprocessOnly
&& !symbols.isEmpty()
- && symbols.last().token == STRING_LITERAL) {
+ && symbols.constLast().token == STRING_LITERAL) {
- QByteArray newString = symbols.last().unquotedLexem();
+ QByteArray newString = symbols.constLast().unquotedLexem();
newString += input.mid(lexem - begin + 1, data - lexem - 2);
newString.prepend('\"');
newString.append('\"');
- symbols.last() = Symbol(symbols.last().lineNum,
+ symbols.last() = Symbol(symbols.constLast().lineNum,
STRING_LITERAL,
newString);
continue;
@@ -679,7 +679,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
if (s.token == WHITESPACE)
continue;
- while (expansion.size() && expansion.last().token == PP_WHITESPACE)
+ while (expansion.size() && expansion.constLast().token == PP_WHITESPACE)
expansion.pop_back();
Symbol next = s;
@@ -692,8 +692,8 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
next = arg.at(0);
}
- if (!expansion.isEmpty() && expansion.last().token == s.token) {
- Symbol last = expansion.last();
+ if (!expansion.isEmpty() && expansion.constLast().token == s.token) {
+ Symbol last = expansion.constLast();
expansion.pop_back();
if (last.token == STRING_LITERAL || s.token == STRING_LITERAL)
@@ -1127,12 +1127,12 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
}
// remove trailing whitespace
while (!macro.symbols.isEmpty() &&
- (macro.symbols.last().token == PP_WHITESPACE || macro.symbols.last().token == WHITESPACE))
+ (macro.symbols.constLast().token == PP_WHITESPACE || macro.symbols.constLast().token == WHITESPACE))
macro.symbols.pop_back();
if (!macro.symbols.isEmpty()) {
- if (macro.symbols.first().token == PP_HASHHASH ||
- macro.symbols.last().token == PP_HASHHASH) {
+ if (macro.symbols.constFirst().token == PP_HASHHASH ||
+ macro.symbols.constLast().token == PP_HASHHASH) {
error("'##' cannot appear at either end of a macro expansion");
}
}
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index e71ea57389..423b566896 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -250,6 +250,11 @@ int runRcc(int argc, char *argv[])
// Make sure fwrite to stdout doesn't do LF->CRLF
if (library.format() == RCCResourceLibrary::Binary)
_setmode(_fileno(stdout), _O_BINARY);
+ // Make sure QIODevice does not do LF->CRLF,
+ // otherwise we'll end up in CRCRLF instead of
+ // CRLF.
+ if (list)
+ mode &= ~QIODevice::Text;
#endif // Q_OS_WIN
// using this overload close() only flushes.
out.open(stdout, mode);