hooks: add a warning to detect unimplemented hooks
[smatch.git] / validation / field-override.c
blobec6987df7c97db0dd51b4e1e4af74781720e6d7e
1 static int ref[] = {
2 [1] = 3,
3 [2] = 3,
4 [3] = 3,
5 [2] = 2, /* check-should-warn */
6 [1] = 1, /* check-should-warn */
7 };
9 static int foo[] = {
10 [1 ... 3] = 3,
13 static int foz[4] = {
14 [0 ... 3] = 3,
15 [0] = 0,
16 [1] = 0,
17 [2 ... 3] = 1,
18 [2] = 3, /* check-should-warn */
19 [3] = 3, /* check-should-warn */
22 static int bar[] = {
23 [1 ... 3] = 3,
24 [1] = 1, /* check-should-warn */
25 [2] = 2, /* check-should-warn */
26 [2 ... 4] = 2, /* check-should-warn */
27 [2 ... 3] = 2, /* check-should-warn */
28 [4] = 4, /* check-should-warn */
29 [0] = 0,
30 [5] = 5,
33 static int baz[3][3] = {
34 [0 ... 2][0 ... 2] = 0,
35 [0] = { 0, 0, 0, }, /* check-should-warn */
36 [0][0] = 1, /* check-should-warn */
37 [1] = { 0, 0, 0, }, /* check-should-warn */
38 [1][0] = 1, /* check-should-warn */
39 [1][1] = 1, /* check-should-warn */
40 [1 ... 2][1 ... 2] = 2,
44 struct s {
45 int i;
46 int a[2];
49 static struct s s = {
50 .a[0] = 0,
51 .a[1] = 1,
54 static struct s a[2] = {
55 [0].i = 0,
56 [1].i = 1,
57 [0].a[0] = 2,
58 [0].a[1] = 3,
61 static struct s b[2] = {
62 [0 ... 1] = { 0, { 1, 2 }, },
63 [0].i = 0,
64 [1].i = 1,
65 [0].a[0] = 2,
66 [0].a[1] = 3,
70 * check-name: field-override
71 * check-command: sparse -Woverride-init -Woverride-init-all $file
73 * check-error-start
74 field-override.c:2:10: warning: Initializer entry defined twice
75 field-override.c:6:10: also defined here
76 field-override.c:3:10: warning: Initializer entry defined twice
77 field-override.c:5:10: also defined here
78 field-override.c:17:10: warning: Initializer entry defined twice
79 field-override.c:18:10: also defined here
80 field-override.c:17:10: warning: Initializer entry defined twice
81 field-override.c:19:10: also defined here
82 field-override.c:23:10: warning: Initializer entry defined twice
83 field-override.c:24:10: also defined here
84 field-override.c:23:10: warning: Initializer entry defined twice
85 field-override.c:25:10: also defined here
86 field-override.c:23:10: warning: Initializer entry defined twice
87 field-override.c:26:10: also defined here
88 field-override.c:26:10: warning: Initializer entry defined twice
89 field-override.c:27:10: also defined here
90 field-override.c:26:10: warning: Initializer entry defined twice
91 field-override.c:28:10: also defined here
92 field-override.c:35:10: warning: Initializer entry defined twice
93 field-override.c:36:10: also defined here
94 field-override.c:37:10: warning: Initializer entry defined twice
95 field-override.c:38:10: also defined here
96 field-override.c:37:10: warning: Initializer entry defined twice
97 field-override.c:39:10: also defined here
98 field-override.c:37:10: warning: Initializer entry defined twice
99 field-override.c:40:10: also defined here
100 * check-error-end