param_key: fix container of when no struct member is referenced
[smatch.git] / validation / autotype-ko.c
blob5b6cd708ade742bc1308bc90a0a7eb72d3683e0c
1 __auto_type u; // KO: no initializer
2 __auto_type r[2] = { 0, 1 }; // KO: not a plain identifier
3 __auto_type foo(void) { } // KO: not a plain identifier
4 __auto_type v = 0, w = 1; // KO: in list
5 struct { __auto_type x; } s; // KO: not valid for struct/union
6 __auto_type self = self; // KO: self-declared
7 __auto_type undc = this; // KO: undeclared
9 int i = 1;
10 double f = 1.0;
11 __auto_type i = 2; // KO: redecl, same type
12 __auto_type f = 2.0f; // KO: redecl, diff type
15 static int foo(int a, const int *ptr)
17 __auto_type i = a;
18 __auto_type c = *ptr;
20 c += 1;
21 return i;
25 * check-name: autotype-ko
26 * check-command: sparse -Wno-decl $file
28 * check-error-start
29 autotype-ko.c:1:13: error: __auto_type without initializer
30 autotype-ko.c:2:13: error: __auto_type on non-identifier
31 autotype-ko.c:3:13: error: 'foo()' has __auto_type return type
32 autotype-ko.c:4:13: error: __auto_type on declaration list
33 autotype-ko.c:6:13: error: __auto_type on self-init var
34 autotype-ko.c:2:20: error: invalid initializer
35 autotype-ko.c:5:22: error: member 'x' has __auto_type
36 autotype-ko.c:7:20: error: undefined identifier 'this'
37 autotype-ko.c:11:13: error: symbol 'i' has multiple initializers (originally initialized at autotype-ko.c:9)
38 autotype-ko.c:12:13: error: symbol 'f' has multiple initializers (originally initialized at autotype-ko.c:10)
39 autotype-ko.c:12:13: error: symbol 'f' redeclared with different type (different type sizes):
40 autotype-ko.c:12:13: float [addressable] [toplevel] f
41 autotype-ko.c:10:8: note: previously declared as:
42 autotype-ko.c:10:8: double [addressable] [toplevel] f
43 autotype-ko.c:20:9: error: assignment to const expression
44 * check-error-end