aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-15 11:47:44 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:40 +0200
commit3c9d59f6a5356713ceef9454954b438003422ded (patch)
tree09cd6f5927f38ad06ccab2418eec57f6c9a9aa6a /validation
parentf44e0e1a1ea604705e3bb418e09d50756d95b506 (diff)
downloadsparse-dev-3c9d59f6a5356713ceef9454954b438003422ded.tar.gz
cast: add tests for warnings issued by sparse -v
The sparse command (aka the 'checker') do a number of additional checks when used with the -v flag (I strongly believes that this option is rarely used but let me not disgress about it here). One of these additional checks is about casts. Add some testcases in order to catch any problems here. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/cast-kinds-check.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/validation/cast-kinds-check.c b/validation/cast-kinds-check.c
new file mode 100644
index 00000000..b8e94840
--- /dev/null
+++ b/validation/cast-kinds-check.c
@@ -0,0 +1,27 @@
+#include "linear/cast-kinds.c"
+
+/*
+ * check-name: cast-kinds check
+ * check-command: sparse -m64 -v $file
+ * check-known-to-fail
+ *
+ * check-error-start
+linear/cast-kinds.c:5:45: warning: cast drops bits
+linear/cast-kinds.c:6:47: warning: cast drops bits
+linear/cast-kinds.c:7:46: warning: cast drops bits
+linear/cast-kinds.c:8:45: warning: cast drops bits
+linear/cast-kinds.c:10:49: warning: cast drops bits
+linear/cast-kinds.c:12:48: warning: cast drops bits
+linear/cast-kinds.c:13:50: warning: cast drops bits
+linear/cast-kinds.c:14:49: warning: cast drops bits
+linear/cast-kinds.c:15:48: warning: cast drops bits
+linear/cast-kinds.c:17:52: warning: cast drops bits
+linear/cast-kinds.c:21:49: warning: cast wasn't removed
+linear/cast-kinds.c:22:48: warning: cast wasn't removed
+linear/cast-kinds.c:28:52: warning: cast wasn't removed
+linear/cast-kinds.c:29:51: warning: cast wasn't removed
+linear/cast-kinds.c:34:52: warning: cast wasn't removed
+linear/cast-kinds.c:35:54: warning: cast wasn't removed
+linear/cast-kinds.c:36:52: warning: cast wasn't removed
+ * check-error-end
+ */