Print this page
new smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/ptr-inherit.c
+++ new/usr/src/tools/smatch/src/validation/ptr-inherit.c
1 1 #define __user __attribute__((address_space(1)))
2 2 #define __noderef __attribute__((noderef))
3 3 #define __bitwise __attribute__((bitwise))
4 4 #define __nocast __attribute__((nocast))
5 5 #define __safe __attribute__((safe))
6 6
7 7
8 8 /* Should be inherited? */
9 9 static void test_const(void)
10 10 {
11 11 const int o;
12 12 int *p = &o; /* check-should-fail */
13 13 }
14 14
15 15 static void test_volatile(void)
16 16 {
17 17 volatile int o;
18 18 int *p = &o; /* check-should-fail */
19 19 }
20 20
21 21 static void test_noderef(void)
22 22 {
23 23 int __noderef o;
24 24 int *p = &o; /* check-should-fail */
25 25 }
26 26
27 27 static void test_bitwise(void)
28 28 {
29 29 int __bitwise o;
30 30 int *p = &o; /* check-should-fail */
31 31 }
32 32
33 33 static void test_user(void)
34 34 {
35 35 int __user o;
36 36 int *p = &o; /* check-should-fail */
37 37 }
38 38
39 39 static void test_nocast(void)
40 40 {
41 41 int __nocast o;
42 42 int __nocast *p = &o; /* check-should-pass */
43 43 }
44 44
45 45 /* Should be ignored? */
46 46 static void test_static(void)
47 47 {
48 48 /* storage is not inherited */
49 49 static int o;
50 50 int *p = &o; /* check-should-pass */
51 51 }
52 52
53 53 static void test_tls(void)
54 54 {
55 55 /* storage is not inherited */
↓ open down ↓ |
55 lines elided |
↑ open up ↑ |
56 56 static __thread int o;
57 57 int *p = &o; /* check-should-pass */
58 58 }
59 59
60 60 /*
61 61 * check-name: ptr-inherit.c
62 62 *
63 63 * check-error-start
64 64 ptr-inherit.c:12:19: warning: incorrect type in initializer (different modifiers)
65 65 ptr-inherit.c:12:19: expected int *p
66 -ptr-inherit.c:12:19: got int const *<noident>
66 +ptr-inherit.c:12:19: got int const *
67 67 ptr-inherit.c:18:19: warning: incorrect type in initializer (different modifiers)
68 68 ptr-inherit.c:18:19: expected int *p
69 -ptr-inherit.c:18:19: got int volatile *<noident>
69 +ptr-inherit.c:18:19: got int volatile *
70 70 ptr-inherit.c:24:19: warning: incorrect type in initializer (different modifiers)
71 71 ptr-inherit.c:24:19: expected int *p
72 -ptr-inherit.c:24:19: got int [noderef] *<noident>
72 +ptr-inherit.c:24:19: got int [noderef] *
73 73 ptr-inherit.c:30:19: warning: incorrect type in initializer (different base types)
74 74 ptr-inherit.c:30:19: expected int *p
75 -ptr-inherit.c:30:19: got restricted int *<noident>
75 +ptr-inherit.c:30:19: got restricted int *
76 76 ptr-inherit.c:36:19: warning: incorrect type in initializer (different address spaces)
77 77 ptr-inherit.c:36:19: expected int *p
78 -ptr-inherit.c:36:19: got int <asn:1>*<noident>
78 +ptr-inherit.c:36:19: got int <asn:1> *
79 79 * check-error-end
80 80 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX