Fix #713 (Tokenizer: Simplify 0L)

http://sourceforge.net/apps/trac/cppcheck/ticket/713
This commit is contained in:
Reijo Tomperi 2009-09-23 00:23:11 +03:00
parent 73a48c2e7b
commit ef09f3475c
2 changed files with 4 additions and 1 deletions

View File

@ -1700,7 +1700,8 @@ void Tokenizer::simplifyTokenList()
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (tok->str() == "NULL" ||
tok->str() == "'\\0'")
tok->str() == "'\\0'" ||
tok->str() == "0L")
tok->str("0");
}

View File

@ -381,6 +381,7 @@ private:
" if (p1 != NULL || p2 == NULL) { ; }\n"
" if (p1 != NULL && p2 == NULL) { ; }\n"
" if (p == '\\0');\n"
" if (p == 0L);\n"
"}\n";
ASSERT_EQUALS("void f ( )\n"
@ -412,6 +413,7 @@ private:
"if ( p1 || ! p2 ) { ; }\n"
"if ( p1 && ! p2 ) { ; }\n"
"if ( ! p ) { ; }\n"
"if ( ! p ) { ; }\n"
"}", tokenizeAndStringify(code, true));
}