summaryrefslogtreecommitdiffstats
path: root/qmake/library
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/library')
-rw-r--r--qmake/library/qmakebuiltins.cpp26
-rw-r--r--qmake/library/qmakeevaluator.h2
-rw-r--r--qmake/library/qmakeglobals.cpp23
-rw-r--r--qmake/library/qmakeglobals.h2
-rw-r--r--qmake/library/qmakeparser.cpp7
5 files changed, 31 insertions, 29 deletions
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 2ade267f74..f46d66ba89 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -382,14 +382,16 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
}
void QMakeEvaluator::populateDeps(
- const ProStringList &deps, const ProString &prefix,
+ const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes,
QHash<ProKey, QSet<ProKey> > &dependencies, ProValueMap &dependees,
ProStringList &rootSet) const
{
foreach (const ProString &item, deps)
if (!dependencies.contains(item.toKey())) {
QSet<ProKey> &dset = dependencies[item.toKey()]; // Always create entry
- ProStringList depends = values(ProKey(prefix + item + QString::fromLatin1(".depends")));
+ ProStringList depends;
+ foreach (const ProString &suffix, suffixes)
+ depends += values(ProKey(prefix + item + suffix));
if (depends.isEmpty()) {
rootSet << item;
} else {
@@ -397,7 +399,7 @@ void QMakeEvaluator::populateDeps(
dset.insert(dep.toKey());
dependees[dep.toKey()] << item;
}
- populateDeps(depends, prefix, dependencies, dependees, rootSet);
+ populateDeps(depends, prefix, suffixes, dependencies, dependees, rootSet);
}
}
}
@@ -692,11 +694,10 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
}
break;
case E_EVAL:
- if (args.count() != 1) {
+ if (args.count() != 1)
evalError(fL1S("eval(variable) requires one argument."));
- } else {
+ else
ret += values(map(args.at(0)));
- }
break;
case E_LIST: {
QString tmp;
@@ -913,14 +914,17 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_SORT_DEPENDS:
case E_RESOLVE_DEPENDS:
- if (args.count() < 1 || args.count() > 2) {
- evalError(fL1S("%1(var, prefix) requires one or two arguments.").arg(func.toQString(m_tmp1)));
+ if (args.count() < 1 || args.count() > 3) {
+ evalError(fL1S("%1(var, [prefix, [suffixes]]) requires one to three arguments.")
+ .arg(func.toQString(m_tmp1)));
} else {
QHash<ProKey, QSet<ProKey> > dependencies;
ProValueMap dependees;
ProStringList rootSet;
ProStringList orgList = values(args.at(0).toKey());
populateDeps(orgList, (args.count() < 2 ? ProString() : args.at(1)),
+ args.count() < 3 ? ProStringList(ProString(".depends"))
+ : split_value_list(args.at(2).toQString(m_tmp2)),
dependencies, dependees, rootSet);
for (int i = 0; i < rootSet.size(); ++i) {
const ProString &item = rootSet.at(i);
@@ -1155,9 +1159,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
for (int i = configs.size() - 1; i >= 0; i--) {
for (int mut = 0; mut < mutuals.count(); mut++) {
- if (configs[i] == mutuals[mut].trimmed()) {
+ if (configs[i] == mutuals[mut].trimmed())
return returnBool(configs[i] == args[0]);
- }
}
}
return ReturnFalse;
@@ -1421,9 +1424,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
const QString &file = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
- if (IoUtils::exists(file)) {
+ if (IoUtils::exists(file))
return ReturnTrue;
- }
int slsh = file.lastIndexOf(QLatin1Char('/'));
QString fn = file.mid(slsh+1);
if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) {
diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h
index ec36fdac39..4565a2cc15 100644
--- a/qmake/library/qmakeevaluator.h
+++ b/qmake/library/qmakeevaluator.h
@@ -219,7 +219,7 @@ public:
bool isActiveConfig(const QString &config, bool regex = false);
void populateDeps(
- const ProStringList &deps, const ProString &prefix,
+ const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes,
QHash<ProKey, QSet<ProKey> > &dependencies,
ProValueMap &dependees, ProStringList &rootSet) const;
diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp
index 7a907b7eed..ac9a0856ff 100644
--- a/qmake/library/qmakeglobals.cpp
+++ b/qmake/library/qmakeglobals.cpp
@@ -164,29 +164,28 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
break;
default:
if (arg.startsWith(QLatin1Char('-'))) {
- if (arg == QLatin1String("-after")) {
+ if (arg == QLatin1String("-after"))
state.after = true;
- } else if (arg == QLatin1String("-config")) {
+ else if (arg == QLatin1String("-config"))
argState = ArgConfig;
- } else if (arg == QLatin1String("-nocache")) {
+ else if (arg == QLatin1String("-nocache"))
do_cache = false;
- } else if (arg == QLatin1String("-cache")) {
+ else if (arg == QLatin1String("-cache"))
argState = ArgCache;
- } else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec")) {
+ else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec"))
argState = ArgSpec;
- } else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec")) {
+ else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec"))
argState = ArgXSpec;
- } else if (arg == QLatin1String("-template") || arg == QLatin1String("-t")) {
+ else if (arg == QLatin1String("-template") || arg == QLatin1String("-t"))
argState = ArgTmpl;
- } else if (arg == QLatin1String("-template_prefix") || arg == QLatin1String("-tp")) {
+ else if (arg == QLatin1String("-template_prefix") || arg == QLatin1String("-tp"))
argState = ArgTmplPfx;
- } else if (arg == QLatin1String("-win32")) {
+ else if (arg == QLatin1String("-win32"))
dir_sep = QLatin1Char('\\');
- } else if (arg == QLatin1String("-unix")) {
+ else if (arg == QLatin1String("-unix"))
dir_sep = QLatin1Char('/');
- } else {
+ else
return ArgumentUnknown;
- }
} else if (arg.contains(QLatin1Char('='))) {
if (state.after)
state.postcmds << arg;
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 9f8893ec9c..efb4d28a63 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -99,6 +99,8 @@ public:
QString pwd;
QStringList precmds, preconfigs, postcmds, postconfigs;
bool after;
+
+ void flush() { after = false; }
};
class QMAKE_EXPORT QMakeGlobals
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 6641149941..f32267cf59 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -239,7 +239,7 @@ bool QMakeParser::read(ProFile *pro)
}
QByteArray bcont = file.readAll();
- if (bcont.startsWith(QByteArray("\xef\xbb\xbf"))) {
+ if (bcont.startsWith("\xef\xbb\xbf")) {
// UTF-8 BOM will cause subtle errors
m_handler->message(QMakeParserHandler::ParserIoError,
fL1S("Unexpected UTF-8 BOM in %1").arg(pro->fileName()));
@@ -1147,11 +1147,10 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
uint nlen = uce[1];
if (uce[nlen + 2] == TokFuncTerminator) {
m_tmp.setRawData((QChar *)uce + 2, nlen);
- if (m_tmp == statics.strhost_build) {
+ if (m_tmp == statics.strhost_build)
m_proFile->setHostBuild(true);
- } else {
+ else
parseError(fL1S("Unknown option() %1.").arg(m_tmp));
- }
return;
}
}