#6948 cash: daca: mgetty (garbage code)

This commit is contained in:
amai2012 2015-08-21 10:40:43 +02:00
parent 8d926d7328
commit 873861df4a
2 changed files with 6 additions and 1 deletions

View File

@ -1970,7 +1970,7 @@ void Tokenizer::concatenateNegativeNumberAndAnyPositive()
if (!Token::Match(tok, "?|:|,|(|[|{|return|case|sizeof|%op% +|-") || tok->tokType() == Token::eIncDecOp) if (!Token::Match(tok, "?|:|,|(|[|{|return|case|sizeof|%op% +|-") || tok->tokType() == Token::eIncDecOp)
continue; continue;
while (tok->next()->str() == "+") while (tok->next() && tok->next()->str() == "+")
tok->deleteNext(); tok->deleteNext();
if (Token::Match(tok->next(), "- %num%")) { if (Token::Match(tok->next(), "- %num%")) {

View File

@ -163,6 +163,7 @@ private:
TEST_CASE(garbageCode121); // #2585 TEST_CASE(garbageCode121); // #2585
TEST_CASE(garbageCode122); // #6303 TEST_CASE(garbageCode122); // #6303
TEST_CASE(garbageCode123); TEST_CASE(garbageCode123);
TEST_CASE(garbageCode124); // 6948
TEST_CASE(garbageValueFlow); TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase); TEST_CASE(garbageSymbolDatabase);
@ -933,6 +934,10 @@ private:
"}"); "}");
} }
void garbageCode124() {
checkCode("+---+");
}
void garbageValueFlow() { void garbageValueFlow() {
// #6089 // #6089
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n" const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"