summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeevaluator.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-09-03 20:57:59 +0200
committerQt by Nokia <qt-info@nokia.com>2012-09-18 07:47:14 +0200
commit849f1f9efda601bcfd3760256205a2014e0bc936 (patch)
tree07cd4c4e4413b205a8e4e2be37e4cea5bed818cf /qmake/library/qmakeevaluator.cpp
parentc3c4f1eb5301a4fda17a9a48012df45f9a0ee7a3 (diff)
don't allow overloading of built-in functions
the functions are not versioned or scoped, so user-defined overloads would mess up qmake's own feature files. it seems safer to break user projects than to allow the user to break qmake. Change-Id: I020a2e6416bbb6e2fd2ece339629d848c00c8398 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'qmake/library/qmakeevaluator.cpp')
-rw-r--r--qmake/library/qmakeevaluator.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 8bb4fddf19..8fad206f6a 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1642,6 +1642,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction(
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
const ProKey &func, const ushort *&tokPtr)
{
+ if (int func_t = statics.functions.value(func)) {
+ //why don't the builtin functions just use args_list? --Sam
+ return evaluateBuiltinConditional(func_t, func, expandVariableReferences(tokPtr, 5, true));
+ }
+
QHash<ProKey, ProFunctionDef>::ConstIterator it =
m_functionDefs.testFunctions.constFind(func);
if (it != m_functionDefs.testFunctions.constEnd()) {
@@ -1650,13 +1655,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
return evaluateBoolFunction(*it, args, func);
}
- //why don't the builtin functions just use args_list? --Sam
- return evaluateBuiltinConditional(func, expandVariableReferences(tokPtr, 5, true));
+ skipExpression(tokPtr);
+ evalError(fL1S("'%1' is not a recognized test function.").arg(func.toQString(m_tmp1)));
+ return ReturnFalse;
}
ProStringList QMakeEvaluator::evaluateExpandFunction(
const ProKey &func, const ushort *&tokPtr)
{
+ if (int func_t = statics.expands.value(func)) {
+ //why don't the builtin functions just use args_list? --Sam
+ return evaluateBuiltinExpand(func_t, func, expandVariableReferences(tokPtr, 5, true));
+ }
+
QHash<ProKey, ProFunctionDef>::ConstIterator it =
m_functionDefs.replaceFunctions.constFind(func);
if (it != m_functionDefs.replaceFunctions.constEnd()) {
@@ -1665,8 +1676,9 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
return evaluateFunction(*it, args, 0);
}
- //why don't the builtin functions just use args_list? --Sam
- return evaluateBuiltinExpand(func, expandVariableReferences(tokPtr, 5, true));
+ skipExpression(tokPtr);
+ evalError(fL1S("'%1' is not a recognized replace function.").arg(func.toQString(m_tmp1)));
+ return ProStringList();
}
bool QMakeEvaluator::evaluateConditional(const QString &cond, const QString &where, int line)