Fixed #9324 (FP compareBoolExpressionWithInt - when using C++ and/or operator synonyms)
This commit is contained in:
parent
03ae0ccef3
commit
8c8952ae7c
|
@ -7059,7 +7059,7 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
||||||
if (cOpIt != cAlternativeTokens.end()) {
|
if (cOpIt != cAlternativeTokens.end()) {
|
||||||
if (!Token::Match(tok->previous(), "%name%|%num%|%char%|)|]|> %name% %name%|%num%|%char%|%op%|("))
|
if (!Token::Match(tok->previous(), "%name%|%num%|%char%|)|]|> %name% %name%|%num%|%char%|%op%|("))
|
||||||
continue;
|
continue;
|
||||||
if (Token::Match(tok->next(), "%assign%|%or%|%oror%|&&|*|/|%|^"))
|
if (Token::Match(tok->next(), "%assign%|%or%|%oror%|&&|*|/|%|^") && !Token::Match(tok->previous(), "%num%|%char% %name% *"))
|
||||||
continue;
|
continue;
|
||||||
tok->str(cOpIt->second);
|
tok->str(cOpIt->second);
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
|
@ -6151,6 +6151,9 @@ private:
|
||||||
ASSERT_EQUALS("void f ( struct S * s ) { x = s . and + 1 ; }", tokenizeAndStringify("void f(struct S *s) { x = s->and + 1; }", false, true, Settings::Native, "test.c"));
|
ASSERT_EQUALS("void f ( struct S * s ) { x = s . and + 1 ; }", tokenizeAndStringify("void f(struct S *s) { x = s->and + 1; }", false, true, Settings::Native, "test.c"));
|
||||||
// #8745
|
// #8745
|
||||||
ASSERT_EQUALS("void f ( ) { if ( x ) { or = 0 ; } }", tokenizeAndStringify("void f() { if (x) or = 0; }"));
|
ASSERT_EQUALS("void f ( ) { if ( x ) { or = 0 ; } }", tokenizeAndStringify("void f() { if (x) or = 0; }"));
|
||||||
|
// #9324
|
||||||
|
ASSERT_EQUALS("void f ( const char * str ) { while ( * str == '!' || * str == '[' ) { } }",
|
||||||
|
tokenizeAndStringify("void f(const char *str) { while (*str=='!' or *str=='['){} }"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyCalculations() {
|
void simplifyCalculations() {
|
||||||
|
|
Loading…
Reference in New Issue