Commit ae1017b0 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

make all parse errors invalidate the parse result



they have been semi-warnings for a long enough time now.

Change-Id: I3fffd63f7b44b30d2dc18cdcd74221c10e98399d
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
(cherry picked from qtbase/704aec46230bf7ce29927bae03902e86454aecec)
parent 8a1e9e73
...@@ -597,7 +597,6 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra ...@@ -597,7 +597,6 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
parseError(fL1S("Missing %1 terminator [found %2]") parseError(fL1S("Missing %1 terminator [found %2]")
.arg(QChar(term)) .arg(QChar(term))
.arg(c ? QString(c) : QString::fromLatin1("end-of-line"))); .arg(c ? QString(c) : QString::fromLatin1("end-of-line")));
pro->setOk(false);
m_inError = true; m_inError = true;
// Just parse on, as if there was a terminator ... // Just parse on, as if there was a terminator ...
} else { } else {
...@@ -681,7 +680,6 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra ...@@ -681,7 +680,6 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
parseError(fL1S("Extra characters after test expression.")); parseError(fL1S("Extra characters after test expression."));
else else
parseError(fL1S("Opening parenthesis without prior test name.")); parseError(fL1S("Opening parenthesis without prior test name."));
pro->setOk(false);
ptr = buf; // Put empty function name ptr = buf; // Put empty function name
} }
*ptr++ = TokTestCall; *ptr++ = TokTestCall;
...@@ -713,10 +711,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra ...@@ -713,10 +711,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
finalizeCond(tokPtr, buf, ptr, wordCount); finalizeCond(tokPtr, buf, ptr, wordCount);
flushCond(tokPtr); flushCond(tokPtr);
++m_blockstack.top().braceLevel; ++m_blockstack.top().braceLevel;
if (grammar == TestGrammar) { if (grammar == TestGrammar)
parseError(fL1S("Opening scope not permitted in this context.")); parseError(fL1S("Opening scope not permitted in this context."));
pro->setOk(false);
}
goto nextItem; goto nextItem;
} else if (c == '}') { } else if (c == '}') {
FLUSH_LHS_LITERAL(); FLUSH_LHS_LITERAL();
...@@ -758,10 +754,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra ...@@ -758,10 +754,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
putLineMarker(tokPtr); putLineMarker(tokPtr);
if (grammar == TestGrammar) { if (grammar == TestGrammar) {
parseError(fL1S("Assignment not permitted in this context.")); parseError(fL1S("Assignment not permitted in this context."));
pro->setOk(false);
} else if (wordCount != 1) { } else if (wordCount != 1) {
parseError(fL1S("Assignment needs exactly one word on the left hand side.")); parseError(fL1S("Assignment needs exactly one word on the left hand side."));
pro->setOk(false);
// Put empty variable name. // Put empty variable name.
} else { } else {
putBlock(tokPtr, buf, ptr - buf); putBlock(tokPtr, buf, ptr - buf);
...@@ -856,10 +850,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra ...@@ -856,10 +850,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
} }
flushScopes(tokPtr); flushScopes(tokPtr);
if (m_blockstack.size() > 1) { if (m_blockstack.size() > 1)
parseError(fL1S("Missing closing brace(s).")); parseError(fL1S("Missing closing brace(s)."));
pro->setOk(false);
}
while (m_blockstack.size()) while (m_blockstack.size())
leaveScope(tokPtr); leaveScope(tokPtr);
tokBuff.resize(tokPtr - (ushort *)tokBuff.constData()); // Reserved capacity stays tokBuff.resize(tokPtr - (ushort *)tokBuff.constData()); // Reserved capacity stays
...@@ -959,7 +951,6 @@ void QMakeParser::bogusTest(ushort *&tokPtr) ...@@ -959,7 +951,6 @@ void QMakeParser::bogusTest(ushort *&tokPtr)
m_invert = false; m_invert = false;
m_state = StCond; m_state = StCond;
m_canElse = true; m_canElse = true;
m_proFile->setOk(false);
} }
void QMakeParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount) void QMakeParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount)
......
...@@ -150,7 +150,10 @@ private: ...@@ -150,7 +150,10 @@ private:
void message(int type, const QString &msg) const; void message(int type, const QString &msg) const;
void parseError(const QString &msg) const void parseError(const QString &msg) const
{ message(QMakeParserHandler::ParserError, msg); } {
message(QMakeParserHandler::ParserError, msg);
m_proFile->setOk(false);
}
void languageWarning(const QString &msg) const void languageWarning(const QString &msg) const
{ message(QMakeParserHandler::ParserWarnLanguage, msg); } { message(QMakeParserHandler::ParserWarnLanguage, msg); }
void deprecationWarning(const QString &msg) const void deprecationWarning(const QString &msg) const
......
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