aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-03 13:42:42 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-09-18 16:01:23 +0200
commitf448769d2dca82b708667b48e27e5158d2a707f1 (patch)
tree3759106154fba2fda34ddda2ef1d938d51bfea4e /validation
parentc5d7212e5f33e7674fc5f570158a80550dad5567 (diff)
downloadsparse-dev-f448769d2dca82b708667b48e27e5158d2a707f1.tar.gz
add test case for incomplete type
Add a test case for the diagnostic of returning an incomplete type. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/incomplete-struct.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/validation/incomplete-struct.c b/validation/incomplete-struct.c
new file mode 100644
index 00000000..f9429f33
--- /dev/null
+++ b/validation/incomplete-struct.c
@@ -0,0 +1,23 @@
+struct s;
+
+void foo(struct s s)
+{
+}
+
+struct s bar(void)
+{
+ struct s s;
+ return s;
+}
+
+/*
+ * check-name: incomplete struct
+ * check-command: sparse -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-error-start
+incomplete-struct.c:3:19: error: parameter 's' has incomplete type
+incomplete-struct.c:7:10: error: return type is incomplete
+incomplete-struct.c:9:11: error: 's' has incompelete type
+ * check-error-end
+ */