unwind: ignore component_match_add_release() paths
[smatch.git] / validation / restrict.c
blobd7cd8ad98f7528cbe5fbffaa78c8eef1505486ca
1 void f00(void *restrict dst);
2 void f01(void *restrict *dst);
3 void f02(void *restrict *dst);
4 void f03(void *restrict *dst);
6 void *restrict rp;
7 void * up;
9 void f00(void *dst) { } /* check-should-pass */
10 void f01(typeof(&rp) dst) { } /* check-should-pass */
11 void f02(void **dst) { } /* check-should-fail */
12 void f03(typeof(&up) dst) { } /* check-should-fail */
14 void foo(void)
16 rp = up; /* check-should-pass */
17 up = rp; /* check-should-pass */
20 void ref(void)
22 void *const qp;
23 void * up;
24 extern void *const *pqp;
25 extern void **pup;
27 pqp = &qp; /* check-should-pass */
28 pqp = &up; /* check-should-pass */
29 pqp = pup;
31 pup = &up; /* check-should-pass */
33 pup = &qp; /* check-should-fail */
34 pup = pqp; /* check-should-fail */
37 void bar(void)
39 extern void *restrict *prp;
40 extern void **pup;
42 prp = &rp; /* check-should-pass */
43 prp = &up; /* check-should-pass */
44 prp = pup;
46 pup = &up; /* check-should-pass */
48 pup = &rp; /* check-should-fail */
49 pup = prp; /* check-should-fail */
52 void baz(void)
54 extern typeof(&rp) prp;
55 extern typeof(&up) pup;
57 prp = &rp; /* check-should-pass */
58 prp = &up; /* check-should-pass */
59 prp = pup;
61 pup = &up; /* check-should-pass */
63 pup = &rp; /* check-should-fail */
64 pup = prp; /* check-should-fail */
68 * check-name: restrict qualifier
69 * check-command: sparse -Wno-decl $file
71 * check-error-start
72 restrict.c:11:6: error: symbol 'f02' redeclared with different type (incompatible argument 1 (different modifiers)):
73 restrict.c:11:6: void extern [addressable] [toplevel] f02( ... )
74 restrict.c:3:6: note: previously declared as:
75 restrict.c:3:6: void extern [addressable] [toplevel] f02( ... )
76 restrict.c:12:6: error: symbol 'f03' redeclared with different type (incompatible argument 1 (different modifiers)):
77 restrict.c:12:6: void extern [addressable] [toplevel] f03( ... )
78 restrict.c:4:6: note: previously declared as:
79 restrict.c:4:6: void extern [addressable] [toplevel] f03( ... )
80 restrict.c:33:13: warning: incorrect type in assignment (different modifiers)
81 restrict.c:33:13: expected void **extern [assigned] pup
82 restrict.c:33:13: got void *const *
83 restrict.c:34:13: warning: incorrect type in assignment (different modifiers)
84 restrict.c:34:13: expected void **extern [assigned] pup
85 restrict.c:34:13: got void *const *extern [assigned] pqp
86 restrict.c:48:13: warning: incorrect type in assignment (different modifiers)
87 restrict.c:48:13: expected void **extern [assigned] pup
88 restrict.c:48:13: got void *restrict *
89 restrict.c:49:13: warning: incorrect type in assignment (different modifiers)
90 restrict.c:49:13: expected void **extern [assigned] pup
91 restrict.c:49:13: got void *restrict *extern [assigned] prp
92 restrict.c:63:13: warning: incorrect type in assignment (different modifiers)
93 restrict.c:63:13: expected void **extern [assigned] pup
94 restrict.c:63:13: got void *restrict *
95 restrict.c:64:13: warning: incorrect type in assignment (different modifiers)
96 restrict.c:64:13: expected void **extern [assigned] pup
97 restrict.c:64:13: got void *restrict *extern [assigned] prp
98 * check-error-end