Commit b0d764cf authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

make cumulative mode support in ProFileEvaluator optional

just in case it gets used for something "real" ...

making exact mode optional would make no sense, as feature files always
need to be evaluated exactly for meaningful results.

Change-Id: I568ab751cf74790e0f79b54248202412c39a68ea
Reviewed-on: http://codereview.qt.nokia.com/306

Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 7572718a
......@@ -275,7 +275,11 @@ public:
int m_skipLevel;
int m_loopLevel; // To report unexpected break() and next()s
#ifdef PROEVALUATOR_CUMULATIVE
bool m_cumulative;
#else
enum { m_cumulative = 0 };
#endif
struct Location {
Location() : pro(0), line(0) {}
......@@ -502,7 +506,9 @@ ProFileEvaluator::Private::Private(ProFileEvaluator *q_, ProFileOption *option,
initStatics();
// Configuration, more or less
#ifdef PROEVALUATOR_CUMULATIVE
m_cumulative = true;
#endif
// Evaluator state
m_skipLevel = 0;
......@@ -1218,8 +1224,10 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
locker.unlock();
#endif
#ifdef PROEVALUATOR_CUMULATIVE
bool cumulative = m_cumulative;
m_cumulative = false;
#endif
// ### init QMAKE_QMAKE, QMAKE_SH
// ### init QMAKE_EXT_{C,H,CPP,OBJ}
......@@ -1333,7 +1341,9 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
m_option->base_valuemap = m_valuemapStack.top();
m_option->base_functions = m_functionDefs;
#ifdef PROEVALUATOR_CUMULATIVE
m_cumulative = cumulative;
#endif
#ifdef PROEVALUATOR_THREAD_SAFE
locker.relock();
......@@ -3237,14 +3247,18 @@ bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName)
fn = resolvePath(fn);
}
#ifdef PROEVALUATOR_CUMULATIVE
bool cumulative = m_cumulative;
m_cumulative = false;
#endif
// The path is fully normalized already.
bool ok = evaluateFileDirect(fn, ProFileEvaluatorHandler::EvalFeatureFile,
ProFileEvaluator::LoadProOnly);
#ifdef PROEVALUATOR_CUMULATIVE
m_cumulative = cumulative;
#endif
return ok;
}
......@@ -3253,7 +3267,9 @@ bool ProFileEvaluator::Private::evaluateFileInto(
QHash<ProString, ProStringList> *values, FunctionDefs *funcs, EvalIntoMode mode)
{
ProFileEvaluator visitor(m_option, m_parser, m_handler);
#ifdef PROEVALUATOR_CUMULATIVE
visitor.d->m_cumulative = false;
#endif
visitor.d->m_outputDir = m_outputDir;
// visitor.d->m_valuemapStack.top() = *values;
if (funcs)
......@@ -3424,10 +3440,12 @@ QString ProFileEvaluator::propertyValue(const QString &name) const
return d->propertyValue(name, false);
}
#ifdef PROEVALUATOR_CUMULATIVE
void ProFileEvaluator::setCumulative(bool on)
{
d->m_cumulative = on;
}
#endif
void ProFileEvaluator::setOutputDir(const QString &dir)
{
......
......@@ -115,7 +115,9 @@ public:
~ProFileEvaluator();
ProFileEvaluator::TemplateType templateType() const;
#ifdef PROEVALUATOR_CUMULATIVE
void setCumulative(bool on); // Default is true!
#endif
void setOutputDir(const QString &dir); // Default is empty
enum LoadFlag {
......
VPATH += $$PWD
QT += xml
DEFINES += PROEVALUATOR_CUMULATIVE
INCLUDEPATH *= $$PWD $$PWD/..
DEPENDPATH *= $$PWD $$PWD/..
......
......@@ -91,7 +91,9 @@ static int evaluate(const QString &fileName, const QString &in_pwd, const QStrin
visited.insert(fileName);
ProFileEvaluator visitor(option, parser, &evalHandler);
#ifdef PROEVALUATOR_CUMULATIVE
visitor.setCumulative(cumulative);
#endif
visitor.setOutputDir(out_pwd);
ProFile *pro;
......
......@@ -20,3 +20,4 @@ HEADERS = profileparser.h profileevaluator.h proitems.h ioutils.h
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
DEFINES += PROEVALUATOR_CUMULATIVE
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment