Or vs and: warn about bitwise ANDs that always give zero
commit2bcebde2fb220699988eb00f03cdf243d7dd83e2
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Jun 2012 10:51:56 +0000 (11 13:51 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Jun 2012 10:51:56 +0000 (11 13:51 +0300)
tree60da1671f09c3e558f264d5ab59f37e30e44699b
parentb6e9464b5194e515a5c3102089084d7b722cf411
Or vs and: warn about bitwise ANDs that always give zero

This is only turned on if you have --spammy enabled because it tends to
have a bunch of false positives.

The rule her is that if we have (x & y) that is not in a macro and always
results in a zero then print a warning.

foo = (0x1 & 0x2);  // <- warn

One cause of false positives is that maybe we mask out the upper bits
giving zero and then we mask out the lower bits on the next line.  Another
is code that which is commented out or which has only been partially
implemented.

frob(FOO | ( 0 & PLANNED_FEATURE));

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_or_vs_and.c