Print this page
11972 resync smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/noderef.c
+++ new/usr/src/tools/smatch/src/validation/noderef.c
1 1 # define __A __attribute__((noderef))
2 2
3 3 struct x {
4 4 int a;
5 5 int b;
6 6 };
7 7
8 8 struct y {
9 9 int a[2];
10 10 };
11 11
12 12 static void h(void)
13 13 {
14 14 char __A *p;
15 15 char __A * * q1;
16 16 char * __A * q2;
17 17 struct x __A *xp;
18 18 struct x __A x;
19 19 int __A *q;
20 20 int __A *r;
21 21 struct y __A *py;
22 22
23 23 q1 = &p;
24 24 q2 = &p; /* This should complain */
25 25
26 26 r = &*q;
27 27 r = q;
28 28 r = &*(q+1); /* This should NOT complain */
29 29 r = q+1;
30 30
31 31 r = &xp->a; /* This should NOT complain */
32 32 r = &xp->b;
33 33 r = &(*xp).a;
34 34 r = &(*xp).b;
35 35
36 36 r = &x.a;
37 37 r = &x.b;
38 38
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
39 39 r = py->a;
40 40 r = py->a+1;
41 41 r = &py->a[0];
42 42 }
43 43 /*
44 44 * check-name: noderef attribute
45 45 *
46 46 * check-error-start
47 47 noderef.c:24:12: warning: incorrect type in assignment (different modifiers)
48 48 noderef.c:24:12: expected char *[noderef] *q2
49 -noderef.c:24:12: got char [noderef] **<noident>
49 +noderef.c:24:12: got char [noderef] **
50 50 * check-error-end
51 51 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX