aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorPekka Enberg <penberg@kernel.org>2011-08-22 16:57:28 +0300
committerChristopher Li <sparse@chrisli.org>2011-08-24 14:01:17 -0700
commit6afef22e1e3c2a7e6dab464706c80f4541f90a4b (patch)
treef02d24aeabb8d3494013897747a15f0e5d1c63f4 /validation
parentb183ef202eb44e73f0a60b272e2fc50146a0603d (diff)
downloadsparse-dev-6afef22e1e3c2a7e6dab464706c80f4541f90a4b.tar.gz
sparse: Enable unhandled validation tests
This patch enables unhandled tests that did not have "check-name" specified. It's pointless not to run them. Cc: Christopher Li <sparse@chrisli.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/badtype1.c5
-rw-r--r--validation/badtype2.c14
-rw-r--r--validation/badtype3.c17
-rw-r--r--validation/bitfields.c3
-rw-r--r--validation/builtin_safe1.c13
-rw-r--r--validation/choose_expr.c13
-rw-r--r--validation/field-overlap.c4
-rw-r--r--validation/foul-bitwise.c10
-rw-r--r--validation/inline_compound_literals.c4
-rw-r--r--validation/struct-ns2.c5
-rw-r--r--validation/struct-size1.c4
-rw-r--r--validation/test-be.c3
-rw-r--r--validation/type1.c4
13 files changed, 99 insertions, 0 deletions
diff --git a/validation/badtype1.c b/validation/badtype1.c
index 4366d8db..ced7f9f1 100644
--- a/validation/badtype1.c
+++ b/validation/badtype1.c
@@ -1 +1,6 @@
static void foo(enum bar baz);
+
+/*
+ * check-name: enum not in scope
+ * check-known-to-fail
+ */
diff --git a/validation/badtype2.c b/validation/badtype2.c
index aad725df..90a5fa1e 100644
--- a/validation/badtype2.c
+++ b/validation/badtype2.c
@@ -8,3 +8,17 @@ static undef foo(char *c)
return bar();
}
}
+
+/*
+ * check-name: missing type
+ * check-error-start
+badtype2.c:2:14: error: Expected ; at end of declaration
+badtype2.c:2:14: error: got bar
+badtype2.c:3:14: error: Expected ; at end of declaration
+badtype2.c:3:14: error: got foo
+badtype2.c:6:3: error: Trying to use reserved word 'switch' as identifier
+badtype2.c:7:3: error: not in switch scope
+badtype2.c:10:1: error: Expected ; at the end of type declaration
+badtype2.c:10:1: error: got }
+ * check-error-end
+ */
diff --git a/validation/badtype3.c b/validation/badtype3.c
index 198ef874..20f346c5 100644
--- a/validation/badtype3.c
+++ b/validation/badtype3.c
@@ -8,3 +8,20 @@ foo (int (*func) (undef, void *), void *data)
}
return err;
}
+
+/*
+ * check-name: missing type in argument list
+ * check-error-start
+badtype3.c:2:18: warning: identifier list not in definition
+badtype3.c:2:24: error: Expected ) in function declarator
+badtype3.c:2:24: error: got ,
+badtype3.c:5:3: error: Trying to use reserved word 'while' as identifier
+badtype3.c:7:7: error: break/continue not in iterator scope
+badtype3.c:9:3: error: Trying to use reserved word 'return' as identifier
+badtype3.c:9:10: error: Expected ; at end of declaration
+badtype3.c:9:10: error: got err
+badtype3.c:10:1: error: Expected ; at the end of type declaration
+badtype3.c:10:1: error: got }
+badtype3.c:6:11: error: undefined identifier 'func'
+ * check-error-end
+ */
diff --git a/validation/bitfields.c b/validation/bitfields.c
index 16aa16d1..ea24841f 100644
--- a/validation/bitfields.c
+++ b/validation/bitfields.c
@@ -16,3 +16,6 @@ static int b(void)
return a[y.x];
}
+/*
+ * check-name: bitfield to integer promotion
+ */
diff --git a/validation/builtin_safe1.c b/validation/builtin_safe1.c
index 8a8b9794..2f6c9d27 100644
--- a/validation/builtin_safe1.c
+++ b/validation/builtin_safe1.c
@@ -24,3 +24,16 @@ static int foo(int x, int y)
return x;
}
+/*
+ * check-name: __builtin_safe
+ * check-known-to-fail
+ * check-error-start
+builtin_safe1.c:13:3: warning: Macro argument with side effects: x++
+builtin_safe1.c:14:3: warning: Macro argument with side effects: x+=1
+builtin_safe1.c:15:3: warning: Macro argument with side effects: x=x+1
+builtin_safe1.c:16:3: warning: Macro argument with side effects: x%=y
+builtin_safe1.c:17:3: warning: Macro argument with side effects: x=y
+builtin_safe1.c:18:3: warning: Macro argument with side effects: g(x)
+builtin_safe1.c:19:3: warning: Macro argument with side effects: (y,g(x))
+ * check-error-end
+ */
diff --git a/validation/choose_expr.c b/validation/choose_expr.c
index 55bfa0cc..f6fd84cf 100644
--- a/validation/choose_expr.c
+++ b/validation/choose_expr.c
@@ -2,3 +2,16 @@ static int x = __builtin_choose_expr(0,(char *)0,(void)0);
static int y = __builtin_choose_expr(1,(char *)0,(void)0);
static char s[42];
static int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42);
+
+/*
+ * check-name: choose expr builtin
+ * check-error-start
+choose_expr.c:1:51: warning: incorrect type in initializer (different base types)
+choose_expr.c:1:51: expected int static [signed] [toplevel] x
+choose_expr.c:1:51: got void <noident>
+choose_expr.c:2:41: warning: incorrect type in initializer (different base types)
+choose_expr.c:2:41: expected int static [signed] [toplevel] y
+choose_expr.c:2:41: got char *<noident>
+choose_expr.c:4:17: warning: division by zero
+ * check-error-end
+ */
diff --git a/validation/field-overlap.c b/validation/field-overlap.c
index 15b974aa..a6abab25 100644
--- a/validation/field-overlap.c
+++ b/validation/field-overlap.c
@@ -10,3 +10,7 @@ static struct {int x, y, z;} w[2] = {
{.x = 1, .y = 2, .z = 3},
{.x = 1, .y = 2, .z = 3}
};
+
+/*
+ * check-name: field overlap
+ */
diff --git a/validation/foul-bitwise.c b/validation/foul-bitwise.c
index ca84be60..9e21eab7 100644
--- a/validation/foul-bitwise.c
+++ b/validation/foul-bitwise.c
@@ -18,3 +18,13 @@ static __le16 bar(__le16 a)
{
return -a;
}
+
+/*
+ * check-name: foul bitwise
+ * check-error-start
+foul-bitwise.c:9:16: warning: restricted __le16 degrades to integer
+foul-bitwise.c:9:22: warning: restricted __le16 degrades to integer
+foul-bitwise.c:19:16: error: incompatible types for operation (-)
+foul-bitwise.c:19:16: argument has type restricted __le16 [usertype] a
+ * check-error-end
+ */
diff --git a/validation/inline_compound_literals.c b/validation/inline_compound_literals.c
index 649d42ab..fc223ff5 100644
--- a/validation/inline_compound_literals.c
+++ b/validation/inline_compound_literals.c
@@ -16,3 +16,7 @@ static void foo(void)
{
baz();
}
+
+/*
+ * check-name: inline compound literals
+ */
diff --git a/validation/struct-ns2.c b/validation/struct-ns2.c
index b38af0ab..4dd2c3bf 100644
--- a/validation/struct-ns2.c
+++ b/validation/struct-ns2.c
@@ -12,3 +12,8 @@ h (void)
struct Bar y;
y.i = 1;
}
+
+/*
+ * check-name: struct not in scope
+ * check-known-to-fail
+ */
diff --git a/validation/struct-size1.c b/validation/struct-size1.c
index 4748cd3c..cf956a41 100644
--- a/validation/struct-size1.c
+++ b/validation/struct-size1.c
@@ -15,3 +15,7 @@ static const struct { int x; } foo[] = {{ 1 }};
struct C {
int bar[(sizeof foo/sizeof foo[0])];
};
+
+/*
+ * check-name: struct size
+ */
diff --git a/validation/test-be.c b/validation/test-be.c
index 6b74555b..deda3cc1 100644
--- a/validation/test-be.c
+++ b/validation/test-be.c
@@ -41,3 +41,6 @@ int main (int argc, char *argv[])
return 0;
}
+/*
+ * check-name: binary operations
+ */
diff --git a/validation/type1.c b/validation/type1.c
index 4f08f88a..2a55f2a9 100644
--- a/validation/type1.c
+++ b/validation/type1.c
@@ -21,3 +21,7 @@ static int test(struct hello *arg)
{
return deref(arg->array);
}
+
+/*
+ * check-name: "char []" to "char *" demotion
+ */