aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/proparser
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-02-18 10:54:24 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-28 13:02:14 +0000
commit87c86c7bdb584641994a6488e3c6ae919763058b (patch)
treeba28c0a68e1a6e9ffab4858af9125a2c8ba7fc7d /src/shared/proparser
parent13148ede99a987defa4e4a7405ccfcbd953c4f5d (diff)
don't write pointless TokAnd at start of control scopes
a colon after else/for is non-AND-ing, i.e., it's no logical operator, but "punctuation". therefore, putting an operator into the token stream is bogus. it didn't hurt execution, so it went unnoticed, but it still wasted some bytes and cpu cycles. Change-Id: If5578074257feed299bda1630bf0dfe72eb395ae Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> (cherry picked from qtbase/bec885380a091dc0b37b372acf88cc3d17c80779)
Diffstat (limited to 'src/shared/proparser')
-rw-r--r--src/shared/proparser/qmakeparser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp
index 83d71f252fb..0c4cdf7b574 100644
--- a/src/shared/proparser/qmakeparser.cpp
+++ b/src/shared/proparser/qmakeparser.cpp
@@ -930,8 +930,14 @@ void QMakeParser::flushCond(ushort *&tokPtr)
void QMakeParser::putOperator(ushort *&tokPtr)
{
- if (m_operator != NoOperator) {
- putTok(tokPtr, (m_operator == AndOperator) ? TokAnd : TokOr);
+ if (m_operator== AndOperator) {
+ // A colon must be used after else and for() if no brace is used,
+ // but in this case it is obviously not a binary operator.
+ if (m_state == StCond)
+ putTok(tokPtr, TokAnd);
+ m_operator = NoOperator;
+ } else if (m_operator == OrOperator) {
+ putTok(tokPtr, TokOr);
m_operator = NoOperator;
}
}