File: dubious-bitwise-with-not.c

package info (click to toggle)
sparse 0.4.1%2Bgit20081218-1
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 1,348 kB
  • ctags: 2,852
  • sloc: ansic: 25,201; perl: 236; makefile: 181; sh: 181
file content (24 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
static unsigned int ok1  = !1 &&  2;
static unsigned int bad1 = !1 &   2;
static unsigned int ok2  = !1 ||  2;
static unsigned int bad2 = !1 |   2;
static unsigned int ok3  =  1 && !2;
static unsigned int bad3 =  1 &  !2;
static unsigned int ok4  =  1 || !2;
static unsigned int bad4 =  1 |  !2;
static unsigned int ok5  = !1 && !2;
static unsigned int bad5 = !1 &  !2;
static unsigned int ok6  = !1 || !2;
static unsigned int bad6 = !1 |  !2;
/*
 * check-name: Dubious bitwise operation on !x
 *
 * check-error-start
dubious-bitwise-with-not.c:2:31: warning: dubious: !x & y
dubious-bitwise-with-not.c:4:31: warning: dubious: !x | y
dubious-bitwise-with-not.c:6:31: warning: dubious: x & !y
dubious-bitwise-with-not.c:8:31: warning: dubious: x | !y
dubious-bitwise-with-not.c:10:31: warning: dubious: !x & !y
dubious-bitwise-with-not.c:12:31: warning: dubious: !x | !y
 * check-error-end
 */