summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-09-19 17:21:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-30 16:53:27 +0100
commit8446f078a9d79ebef56d083f43306e89499e61cc (patch)
treef21b39f4245e4dce342e42a539c4b08136022ca8
parentc5c6cbe8937bb44a93b66c70bfa408e9425be100 (diff)
qmake: Expose ARGC to qmake functions to be able to check argument count
ARGS already exists, but is a flattened list of the arguments, so both foo(bar, baz) and foo(bar baz) will give count(ARGS, 2), making it unreliable for validating arguments to qmake functions. Change-Id: I0bcc16614c64000169431327da48fd1a26708e67 (cherry picked from qtbase/09205d573413da8a2ac3826198fe36bb2dc4349f) Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r--src/linguist/shared/qmakeevaluator.cpp2
-rw-r--r--src/linguist/shared/qmakeevaluator_p.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp
index a193a3965..c1400445e 100644
--- a/src/linguist/shared/qmakeevaluator.cpp
+++ b/src/linguist/shared/qmakeevaluator.cpp
@@ -121,6 +121,7 @@ void QMakeEvaluator::initStatics()
statics.strfalse = QLatin1String("false");
statics.strCONFIG = ProKey("CONFIG");
statics.strARGS = ProKey("ARGS");
+ statics.strARGC = ProKey("ARGC");
statics.strDot = QLatin1String(".");
statics.strDotDot = QLatin1String("..");
statics.strever = QLatin1String("ever");
@@ -1647,6 +1648,7 @@ ProStringList QMakeEvaluator::evaluateFunction(
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
}
m_valuemapStack.top()[statics.strARGS] = args;
+ m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count())));
vr = visitProBlock(func.pro(), func.tokPtr());
if (vr == ReturnReturn)
vr = ReturnTrue;
diff --git a/src/linguist/shared/qmakeevaluator_p.h b/src/linguist/shared/qmakeevaluator_p.h
index 025a913bc..7a89a23e0 100644
--- a/src/linguist/shared/qmakeevaluator_p.h
+++ b/src/linguist/shared/qmakeevaluator_p.h
@@ -83,6 +83,7 @@ struct QMakeStatics {
QString strfalse;
ProKey strCONFIG;
ProKey strARGS;
+ ProKey strARGC;
QString strDot;
QString strDotDot;
QString strever;