xref: /illumos-gate/usr/src/tools/smatch/src/validation/dubious-bitwise-with-not.c (revision 1f5207b7604fb44407eb4342aff613f7c4508508)
1 static unsigned int ok1  = !1 &&  2;
2 static unsigned int bad1 = !1 &   2;
3 static unsigned int ok2  = !1 ||  2;
4 static unsigned int bad2 = !1 |   2;
5 static unsigned int ok3  =  1 && !2;
6 static unsigned int bad3 =  1 &  !2;
7 static unsigned int ok4  =  1 || !2;
8 static unsigned int bad4 =  1 |  !2;
9 static unsigned int ok5  = !1 && !2;
10 static unsigned int bad5 = !1 &  !2;
11 static unsigned int ok6  = !1 || !2;
12 static unsigned int bad6 = !1 |  !2;
13 /*
14  * check-name: Dubious bitwise operation on !x
15  *
16  * check-error-start
17 dubious-bitwise-with-not.c:2:31: warning: dubious: !x & y
18 dubious-bitwise-with-not.c:4:31: warning: dubious: !x | y
19 dubious-bitwise-with-not.c:6:31: warning: dubious: x & !y
20 dubious-bitwise-with-not.c:8:31: warning: dubious: x | !y
21 dubious-bitwise-with-not.c:10:31: warning: dubious: !x & !y
22 dubious-bitwise-with-not.c:12:31: warning: dubious: !x | !y
23  * check-error-end
24  */
25