Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux)

This commit is contained in:
Daniel Marjamäki 2015-01-04 13:50:54 +01:00
parent e06a4cdf00
commit 7bafbfbd6e
3 changed files with 2 additions and 6 deletions

View File

@ -6142,10 +6142,6 @@ void Tokenizer::simplifyIfNotNull()
}
}
else if (tok->link() && Token::simpleMatch(tok, ") != 0")) {
deleteFrom = tok;
}
if (deleteFrom) {
Token::eraseTokens(deleteFrom, deleteFrom->tokAt(3));
tok = deleteFrom;

View File

@ -579,7 +579,7 @@ private:
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
invalidFunctionUsage("int f() { memset(a,b,sizeof(a)!=0); }");
TODO_ASSERT_EQUALS("error", "", errout.str());
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
invalidFunctionUsage("int f() { strtol(a,b,sizeof(a)!=12); }");
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (comparison result) but the valid values are '0,2:36'.\n", errout.str());

View File

@ -1668,7 +1668,7 @@ private:
ASSERT_EQUALS("char * s ; do { s = new char [ 10 ] ; } while ( ! s ) ;",
tok("char *s; do { } while (0 == (s=new char[10]));"));
// #4911
ASSERT_EQUALS("; do { current = f ( ) ; } while ( current ) ;", simplifyIfAndWhileAssign(";do { } while((current=f()) != NULL);"));
ASSERT_EQUALS("; do { current = f ( ) ; } while ( ( current ) != 0 ) ;", simplifyIfAndWhileAssign(";do { } while((current=f()) != NULL);"));
}
void ifnot() {