diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-09-03 20:57:59 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-18 07:47:14 +0200 |
commit | 849f1f9efda601bcfd3760256205a2014e0bc936 (patch) | |
tree | 07cd4c4e4413b205a8e4e2be37e4cea5bed818cf /qmake/project.cpp | |
parent | c3c4f1eb5301a4fda17a9a48012df45f9a0ee7a3 (diff) | |
download | qtbase-849f1f9efda601bcfd3760256205a2014e0bc936.tar.gz |
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/project.cpp')
-rw-r--r-- | qmake/project.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp index e369ce1b42..478693f78b 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -42,11 +42,14 @@ #include "project.h" #include "option.h" +#include <qmakeevaluator_p.h> #include <qdir.h> #include <stdio.h> +using namespace QMakeInternal; + QT_BEGIN_NAMESPACE QMakeProject::QMakeProject() @@ -83,24 +86,34 @@ bool QMakeProject::test(const ProKey &func, const QList<ProStringList> &args) { m_current.clear(); + if (int func_t = statics.functions.value(func)) + return evaluateBuiltinConditional(func_t, func, prepareBuiltinArgs(args)) == ReturnTrue; + QHash<ProKey, ProFunctionDef>::ConstIterator it = m_functionDefs.testFunctions.constFind(func); if (it != m_functionDefs.testFunctions.constEnd()) return evaluateBoolFunction(*it, args, func) == ReturnTrue; - return evaluateBuiltinConditional(func, prepareBuiltinArgs(args)) == ReturnTrue; + evalError(QStringLiteral("'%1' is not a recognized test function.") + .arg(func.toQString(m_tmp1))); + return false; } QStringList QMakeProject::expand(const ProKey &func, const QList<ProStringList> &args) { m_current.clear(); + if (int func_t = statics.expands.value(func)) + return evaluateBuiltinExpand(func_t, func, prepareBuiltinArgs(args)).toQStringList(); + QHash<ProKey, ProFunctionDef>::ConstIterator it = m_functionDefs.replaceFunctions.constFind(func); if (it != m_functionDefs.replaceFunctions.constEnd()) return evaluateFunction(*it, args, 0).toQStringList(); - return evaluateBuiltinExpand(func, prepareBuiltinArgs(args)).toQStringList(); + evalError(QStringLiteral("'%1' is not a recognized replace function.") + .arg(func.toQString(m_tmp1))); + return QStringList(); } ProString QMakeProject::expand(const QString &expr, const QString &where, int line) |