diff options
Diffstat (limited to 'qmake/library/qmakeevaluator.cpp')
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 4cfd265591..4c5ce2e097 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -188,7 +188,8 @@ void QMakeEvaluator::initStatics() { "QMAKE_RPATH", "QMAKE_LFLAGS_RPATH" }, { "QMAKE_FRAMEWORKDIR", "QMAKE_FRAMEWORKPATH" }, { "QMAKE_FRAMEWORKDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS" }, - { "IN_PWD", "PWD" } + { "IN_PWD", "PWD" }, + { "DEPLOYMENT", "INSTALLS" } }; for (unsigned i = 0; i < sizeof(mapInits)/sizeof(mapInits[0]); ++i) statics.varMap.insert(ProKey(mapInits[i].oldname), ProKey(mapInits[i].newname)); @@ -451,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; } @@ -574,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; @@ -750,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); @@ -760,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)); @@ -906,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 @@ -1153,8 +1162,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); @@ -1294,7 +1306,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConfigFeatures() config.detach(); processed.insert(config); VisitReturn vr = evaluateFeatureFile(config, true); - if (vr == ReturnError) + if (vr == ReturnError && !m_cumulative) return vr; if (vr == ReturnTrue) { finished = false; @@ -1909,7 +1921,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. |