summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeevaluator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/library/qmakeevaluator.cpp')
-rw-r--r--qmake/library/qmakeevaluator.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 31be44eda7..d7fba6b227 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -452,7 +452,7 @@ void QMakeEvaluator::evaluateExpression(
break; }
case TokEnvVar: {
const ProString &var = pro->getStr(tokPtr);
- const ProString &val = ProString(m_option->getEnv(var.toQString(m_tmp1)));
+ const ProString &val = ProString(m_option->getEnv(var.toQString()));
debugMsg(2, "env var %s => %s", dbgStr(var), dbgStr(val));
addStr(val, ret, pending, joined);
break; }
@@ -575,13 +575,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
okey = true, or_op = false; // force next evaluation
break;
case TokForLoop:
- if (m_cumulative) { // This is a no-win situation, so just pretend it's no loop
- skipHashStr(tokPtr);
- uint exprLen = getBlockLen(tokPtr);
- tokPtr += exprLen;
- blockLen = getBlockLen(tokPtr);
- ret = visitProBlock(tokPtr);
- } else if (okey != or_op) {
+ if (m_cumulative || okey != or_op) {
const ProKey &variable = pro->getHashStr(tokPtr);
uint exprLen = getBlockLen(tokPtr);
const ushort *exprPtr = tokPtr;
@@ -751,6 +745,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
ProStringList list = values(it_list.toKey());
if (list.isEmpty()) {
if (it_list == statics.strforever) {
+ if (m_cumulative) {
+ // The termination conditions wouldn't be evaluated, so we must skip it.
+ traceMsg("skipping forever loop in cumulative mode");
+ return ReturnFalse;
+ }
infinite = true;
} else {
const QString &itl = it_list.toQString(m_tmp1);
@@ -761,6 +760,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
if (ok) {
int end = itl.mid(dotdot+2).toInt(&ok);
if (ok) {
+ if (m_cumulative && qAbs(end - start) > 100) {
+ // Such a loop is unlikely to contribute something useful to the
+ // file collection, and may cause considerable delay.
+ traceMsg("skipping excessive loop in cumulative mode");
+ return ReturnFalse;
+ }
if (start < end) {
for (int i = start; i <= end; i++)
list << ProString(QString::number(i));
@@ -907,8 +912,11 @@ void QMakeEvaluator::visitProVariable(
m_featureRoots = 0;
else if (varName == statics.strQMAKESPEC) {
if (!values(varName).isEmpty()) {
- m_qmakespec = values(varName).first().toQString();
- m_featureRoots = 0;
+ QString spec = values(varName).first().toQString();
+ if (IoUtils::isAbsolutePath(spec)) {
+ m_qmakespec = spec;
+ m_featureRoots = 0;
+ }
}
}
#ifdef PROEVALUATOR_FULL
@@ -1156,8 +1164,11 @@ bool QMakeEvaluator::loadSpecInternal()
// the source of the qmake.conf at the end of the default/qmake.conf in
// the QMAKESPEC_ORIGINAL variable.
const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL"));
- if (!orig_spec.isEmpty())
- m_qmakespec = orig_spec.toQString();
+ if (!orig_spec.isEmpty()) {
+ QString spec = orig_spec.toQString();
+ if (IoUtils::isAbsolutePath(spec))
+ m_qmakespec = spec;
+ }
# endif
#endif
valuesRef(ProKey("QMAKESPEC")) = ProString(m_qmakespec);
@@ -1912,7 +1923,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
}
#ifdef QMAKE_BUILTIN_PRFS
fn.prepend(QLatin1String(":/qmake/features/"));
- if (QFileInfo(fn).exists())
+ if (QFileInfo::exists(fn))
goto cool;
#endif
fn = QLatin1String(""); // Indicate failed lookup. See comment above.