aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorJosh Triplett <josh@freedesktop.org>2008-12-18 01:33:19 +0300
committerAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-12-18 21:11:00 +0300
commite34179b2e784ee6b4de195e69d5898127015545a (patch)
treed83ff141ebbb8de259f5afebca6c89193482ecf3 /validation
parentcaffda221c4e2db78b03f5e6f8c43d1104f02004 (diff)
downloadsparse-dev-e34179b2e784ee6b4de195e69d5898127015545a.tar.gz
Expand "dubious !x & y" handling to other combinations of !, &, and |.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/dubious-bitwise-with-not.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/validation/dubious-bitwise-with-not.c b/validation/dubious-bitwise-with-not.c
index e076899a..c48bcaee 100644
--- a/validation/dubious-bitwise-with-not.c
+++ b/validation/dubious-bitwise-with-not.c
@@ -1,9 +1,24 @@
-static unsigned int ok1 = !1 && 2;
-static unsigned int bad1 = !1 & 2;
+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
*/