The following code (this is simplified from a macro expression):
int tst(int a) { return ((a & 0x2) != 0) == 1; }
produces:
(style) Expression '(X & 0x2) == 0x1' is always false.
I had a quick look at the code and it seems to be cause by simplifyIfNotNull. If I disable the lines in lib/tokenize.cpp:
else if (tok->link() && match353(tok)) { // deleteFrom = tok; }
I get:
(warning) Comparison of a boolean expression with an integer other than 0 or 1.
This looks much better.
Log in to post a comment.
The following code (this is simplified from a macro expression):
int tst(int a) { return ((a & 0x2) != 0) == 1; }
produces:
(style) Expression '(X & 0x2) == 0x1' is always false.
I had a quick look at the code and it seems to be cause by simplifyIfNotNull. If I disable the lines in lib/tokenize.cpp:
I get:
(warning) Comparison of a boolean expression with an integer other than 0 or 1.
This looks much better.