Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8530,6 +8530,9 @@ void Tokenizer::findGarbageCode() const
else if (Token::Match(tok, "[({<] %assign%"))
syntaxError(tok);

else if (Token::Match(tok, "%assign% >"))
syntaxError(tok);

else if (Token::Match(tok, "[`\\@]"))
syntaxError(tok);

Expand Down
4 changes: 4 additions & 0 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,10 @@ void TokenList::validateAst(bool print) const
throw InternalError(tok, "Syntax Error: AST broken, binary operator '" + tok->str() + "' doesn't have two operands.", InternalError::AST);
}

if (Token::Match(tok, "++|--") && !tok->astOperand1()) {
throw InternalError(tok, "Syntax Error: AST broken, operator '" + tok->str() + "' doesn't have an operand.", InternalError::AST);
}

// Check control blocks and asserts
if (Token::Match(tok->previous(), "if|while|for|switch|assert|ASSERT (")) {
if (!tok->astOperand1() || !tok->astOperand2())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C(){o y=>::*}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert(a~--)
6 changes: 3 additions & 3 deletions test/testpostfixoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ class TestPostfixOperator : public TestFixture {
}

void test2168() {
check("--> declare allocator lock here\n"
"int main(){}");
ASSERT_EQUALS("", errout_str());
ASSERT_THROW_INTERNAL(check("--> declare allocator lock here\n"
"int main(){}"),
AST);
}

void pointerSimplest() {
Expand Down