summaryrefslogtreecommitdiffstats
path: root/qmake/library
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-05 12:35:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-12 18:13:37 +0100
commit525eb337670f61078383c20ad9be274dcf2d0928 (patch)
treeee593bc03146554854f6c443a1fdb5cfd76e2460 /qmake/library
parent0dedf8c3403923b963c51eb65d9cbe838d5ba0d4 (diff)
permit returning from files
this allows skipping an entire feature file if a condition is not fulfilled, without putting the whole body inside a conditional. Change-Id: I84fe9c94dda58c794fb52c3f163b40563b0db30a Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'qmake/library')
-rw-r--r--qmake/library/qmakeparser.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index f32267cf59..557a779717 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -1024,7 +1024,6 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
m_tmp.setRawData((QChar *)uc + 4, nlen);
const QString *defName;
ushort defType;
- uchar nest;
if (m_tmp == statics.strfor) {
if (m_invert || m_operator == OrOperator) {
// '|' could actually work reasonably, but qmake does nonsense here.
@@ -1101,13 +1100,20 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
parseError(fL1S("%1(function) requires one literal argument.").arg(*defName));
return;
} else if (m_tmp == statics.strreturn) {
- if (argc > 1) {
- parseError(fL1S("return() requires zero or one argument."));
- bogusTest(tokPtr);
- return;
+ if (m_blockstack.top().nest & NestFunction) {
+ if (argc > 1) {
+ parseError(fL1S("return() requires zero or one argument."));
+ bogusTest(tokPtr);
+ return;
+ }
+ } else {
+ if (*uce != TokFuncTerminator) {
+ parseError(fL1S("Top-level return() requires zero arguments."));
+ bogusTest(tokPtr);
+ return;
+ }
}
defType = TokReturn;
- nest = NestFunction;
goto ctrlstm2;
} else if (m_tmp == statics.strnext) {
defType = TokNext;
@@ -1120,15 +1126,14 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
bogusTest(tokPtr);
return;
}
- nest = NestLoop;
- ctrlstm2:
- if (m_invert) {
- parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp));
+ if (!(m_blockstack.top().nest & NestLoop)) {
+ parseError(fL1S("Unexpected %1().").arg(m_tmp));
bogusTest(tokPtr);
return;
}
- if (!(m_blockstack.top().nest & nest)) {
- parseError(fL1S("Unexpected %1().").arg(m_tmp));
+ ctrlstm2:
+ if (m_invert) {
+ parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp));
bogusTest(tokPtr);
return;
}