unbreak infinite recursion check for fromfile() & co.

i broke this by switching to using a separate evaluator. the new
evaluator has an empty file stack, so the check would be pointless.
fix it by recoding and traversing the call chain.

Change-Id: Icb1f19adc6e66a865cd5be78eeb1c10072b4f8fc
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-08-24 16:17:03 +02:00
parent 4c96bd6791
commit fe87e222fb
2 changed files with 11 additions and 5 deletions

View File

@@ -170,6 +170,7 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option,
initStatics(); initStatics();
// Configuration, more or less // Configuration, more or less
m_caller = 0;
#ifdef PROEVALUATOR_CUMULATIVE #ifdef PROEVALUATOR_CUMULATIVE
m_cumulative = false; m_cumulative = false;
#endif #endif
@@ -1626,11 +1627,14 @@ bool QMakeEvaluator::evaluateFile(
{ {
if (fileName.isEmpty()) if (fileName.isEmpty())
return false; return false;
foreach (const ProFile *pf, m_profileStack) QMakeEvaluator *ref = this;
if (pf->fileName() == fileName) { do {
evalError(fL1S("Circular inclusion of %1.").arg(fileName)); foreach (const ProFile *pf, ref->m_profileStack)
return false; if (pf->fileName() == fileName) {
} evalError(fL1S("Circular inclusion of %1.").arg(fileName));
return false;
}
} while ((ref = ref->m_caller));
return evaluateFileDirect(fileName, type, flags); return evaluateFileDirect(fileName, type, flags);
} }
@@ -1695,6 +1699,7 @@ bool QMakeEvaluator::evaluateFileInto(const QString &fileName, QMakeHandler::Eva
ProValueMap *values, LoadFlags flags) ProValueMap *values, LoadFlags flags)
{ {
QMakeEvaluator visitor(m_option, m_parser, m_handler); QMakeEvaluator visitor(m_option, m_parser, m_handler);
visitor.m_caller = this;
visitor.m_outputDir = m_outputDir; visitor.m_outputDir = m_outputDir;
if (!visitor.evaluateFile(fileName, type, flags)) if (!visitor.evaluateFile(fileName, type, flags))
return false; return false;

View File

@@ -195,6 +195,7 @@ public:
static void removeEach(ProStringList *varlist, const ProStringList &value); static void removeEach(ProStringList *varlist, const ProStringList &value);
QMakeEvaluator *m_caller;
int m_loopLevel; // To report unexpected break() and next()s int m_loopLevel; // To report unexpected break() and next()s
#ifdef PROEVALUATOR_CUMULATIVE #ifdef PROEVALUATOR_CUMULATIVE
bool m_cumulative; bool m_cumulative;