Fixed #6275: Simplification of = (NULL); to = 0;
This commit is contained in:
parent
85c02df56c
commit
428587f3d4
|
@ -1819,7 +1819,7 @@ void Tokenizer::simplifyFileAndLineMacro()
|
|||
void Tokenizer::simplifyNull()
|
||||
{
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (tok->str() == "NULL" && !Token::Match(tok->previous(), "[(,] NULL [,)]"))
|
||||
if (tok->str() == "NULL" && (!Token::Match(tok->previous(), "[(,] NULL [,)]") || tok->strAt(-2) == "="))
|
||||
tok->str("0");
|
||||
else if (tok->str() == "__null" || tok->str() == "'\\0'" || tok->str() == "'\\x0'") {
|
||||
tok->originalName(tok->str());
|
||||
|
|
|
@ -6197,6 +6197,7 @@ private:
|
|||
void simplifyNull() {
|
||||
ASSERT_EQUALS("if ( ! p )", tokenizeAndStringify("if (p==NULL)"));
|
||||
ASSERT_EQUALS("f ( NULL ) ;", tokenizeAndStringify("f(NULL);"));
|
||||
ASSERT_EQUALS("char * i ; i = 0 ;", tokenizeAndStringify("char* i = (NULL);"));
|
||||
}
|
||||
|
||||
void simplifyNullArray() {
|
||||
|
|
Loading…
Reference in New Issue