param_key: fix container of when no struct member is referenced
[smatch.git] / validation / c11-atomic.c
blob85461f64d1d3b8d0bcd74eee2012af665a6b9c5e
1 void f00(int _Atomic dst);
2 void f01(int _Atomic *dst);
3 void f02(int _Atomic *dst);
4 void f03(int _Atomic *dst);
6 int _Atomic qo;
7 int uo;
9 void f00(int dst) { } /* check-should-fail */
10 void f01(typeof(&qo) dst) { } /* check-should-pass */
11 void f02(int *dst) { } /* check-should-fail */
12 void f03(typeof(&uo) dst) { } /* check-should-fail */
14 void foo(void)
16 qo = uo; /* check-should-pass */
17 uo = qo; /* check-should-pass */
20 void ref(void)
22 const int qo;
23 int uo;
24 const int *pqo;
25 int *puo;
27 pqo = &qo; /* check-should-pass */
28 pqo = &uo; /* check-should-pass */
29 pqo = puo; /* check-should-pass */
31 puo = &uo; /* check-should-pass */
33 puo = &qo; /* check-should-fail */
34 puo = pqo; /* check-should-fail */
37 void bar(void)
39 int _Atomic *pqo;
40 int *puo;
42 pqo = &qo; /* check-should-pass */
43 pqo = &uo; /* check-should-fail */
44 pqo = puo; /* check-should-fail */
46 puo = &uo; /* check-should-pass */
48 puo = &qo; /* check-should-fail */
49 puo = pqo; /* check-should-fail */
52 void baz(void)
54 typeof(&qo) pqo;
55 typeof(&uo) puo;
57 pqo = &qo; /* check-should-pass */
58 pqo = &uo; /* check-should-fail*/
59 pqo = puo; /* check-should-fail */
61 puo = &uo; /* check-should-pass */
63 puo = &qo; /* check-should-fail */
64 puo = pqo; /* check-should-fail */
68 * check-name: C11 _Atomic type qualifier
69 * check-command: sparse -Wno-decl $file
71 * check-error-start
72 c11-atomic.c:9:6: error: symbol 'f00' redeclared with different type (incompatible argument 1 (different modifiers)):
73 c11-atomic.c:9:6: void extern [addressable] [toplevel] f00( ... )
74 c11-atomic.c:1:6: note: previously declared as:
75 c11-atomic.c:1:6: void extern [addressable] [toplevel] f00( ... )
76 c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (incompatible argument 1 (different modifiers)):
77 c11-atomic.c:11:6: void extern [addressable] [toplevel] f02( ... )
78 c11-atomic.c:3:6: note: previously declared as:
79 c11-atomic.c:3:6: void extern [addressable] [toplevel] f02( ... )
80 c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (incompatible argument 1 (different modifiers)):
81 c11-atomic.c:12:6: void extern [addressable] [toplevel] f03( ... )
82 c11-atomic.c:4:6: note: previously declared as:
83 c11-atomic.c:4:6: void extern [addressable] [toplevel] f03( ... )
84 c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers)
85 c11-atomic.c:33:13: expected int *[assigned] puo
86 c11-atomic.c:33:13: got int const *
87 c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers)
88 c11-atomic.c:34:13: expected int *[assigned] puo
89 c11-atomic.c:34:13: got int const *[assigned] pqo
90 c11-atomic.c:43:13: warning: incorrect type in assignment (different modifiers)
91 c11-atomic.c:43:13: expected int [atomic] *[assigned] pqo
92 c11-atomic.c:43:13: got int *
93 c11-atomic.c:44:13: warning: incorrect type in assignment (different modifiers)
94 c11-atomic.c:44:13: expected int [atomic] *[assigned] pqo
95 c11-atomic.c:44:13: got int *puo
96 c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers)
97 c11-atomic.c:48:13: expected int *[assigned] puo
98 c11-atomic.c:48:13: got int [atomic] *
99 c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers)
100 c11-atomic.c:49:13: expected int *[assigned] puo
101 c11-atomic.c:49:13: got int [atomic] *[assigned] pqo
102 c11-atomic.c:58:13: warning: incorrect type in assignment (different modifiers)
103 c11-atomic.c:58:13: expected int [atomic] *[assigned] pqo
104 c11-atomic.c:58:13: got int *
105 c11-atomic.c:59:13: warning: incorrect type in assignment (different modifiers)
106 c11-atomic.c:59:13: expected int [atomic] *[assigned] pqo
107 c11-atomic.c:59:13: got int *puo
108 c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers)
109 c11-atomic.c:63:13: expected int *[assigned] puo
110 c11-atomic.c:63:13: got int [atomic] *
111 c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers)
112 c11-atomic.c:64:13: expected int *[assigned] puo
113 c11-atomic.c:64:13: got int [atomic] *[assigned] pqo
114 * check-error-end