Fix #670 (Tokenizer: Simplify '\0' into 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/670
This commit is contained in:
parent
e3119235e0
commit
2b6955dde5
|
@ -1642,7 +1642,8 @@ void Tokenizer::simplifyTokenList()
|
|||
// Replace NULL with 0..
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (tok->str() == "NULL")
|
||||
if (tok->str() == "NULL" ||
|
||||
tok->str() == "'\\0'")
|
||||
tok->str("0");
|
||||
}
|
||||
|
||||
|
|
|
@ -376,6 +376,7 @@ private:
|
|||
" while (NULL == Foo::p);\n"
|
||||
" if (p1 != NULL || p2 == NULL) { ; }\n"
|
||||
" if (p1 != NULL && p2 == NULL) { ; }\n"
|
||||
" if (p == '\\0');\n"
|
||||
"}\n";
|
||||
|
||||
ASSERT_EQUALS("void f ( )\n"
|
||||
|
@ -406,6 +407,7 @@ private:
|
|||
"while ( ! Foo :: p ) { ; }\n"
|
||||
"if ( p1 || ! p2 ) { ; }\n"
|
||||
"if ( p1 && ! p2 ) { ; }\n"
|
||||
"if ( ! p ) { ; }\n"
|
||||
"}", tokenizeAndStringify(code, true));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue