Commit 87c86c7b authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

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: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
(cherry picked from qtbase/bec885380a091dc0b37b372acf88cc3d17c80779)
parent 13148ede
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment