avoid useless warning for 'bool <- restricted type' conversion
[smatch.git] / validation / noderef.c
blob8c89f6092b3703bee1503b3b8f6bfe6fc6282deb
1 # define __A __attribute__((noderef))
3 struct x {
4 int a;
5 int b;
6 };
8 struct y {
9 int a[2];
12 static void h(void)
14 char __A *p;
15 char __A * * q1;
16 char * __A * q2;
17 struct x __A *xp;
18 struct x __A x;
19 int __A *q;
20 int __A *r;
21 struct y __A *py;
23 q1 = &p;
24 q2 = &p; /* This should complain */
26 r = &*q;
27 r = q;
28 r = &*(q+1); /* This should NOT complain */
29 r = q+1;
31 r = &xp->a; /* This should NOT complain */
32 r = &xp->b;
33 r = &(*xp).a;
34 r = &(*xp).b;
36 r = &x.a;
37 r = &x.b;
39 r = py->a;
40 r = py->a+1;
41 r = &py->a[0];
44 * check-name: noderef attribute
46 * check-error-start
47 noderef.c:24:12: warning: incorrect type in assignment (different modifiers)
48 noderef.c:24:12: expected char *[noderef] *q2
49 noderef.c:24:12: got char [noderef] **<noident>
50 * check-error-end