blob: 17720861ffb73f2edaef08516150ff323ee4e6a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
void f00(int _Atomic dst);
void f01(int _Atomic *dst);
void f02(int _Atomic *dst);
void f03(int _Atomic *dst);
int _Atomic qo;
int uo;
void f00(int dst) { } /* check-should-pass */
void f01(typeof(&qo) dst) { } /* check-should-pass */
void f02(int *dst) { } /* check-should-fail */
void f03(typeof(&uo) dst) { } /* check-should-fail */
void foo(void)
{
qo = uo; /* check-should-pass */
uo = qo; /* check-should-pass */
}
void ref(void)
{
const int qo;
int uo;
extern const int *pqo;
extern int *puo;
pqo = &qo; /* check-should-pass */
pqo = &uo; /* check-should-pass */
pqo = puo;
puo = &uo; /* check-should-pass */
puo = &qo; /* check-should-fail */
puo = pqo; /* check-should-fail */
}
void bar(void)
{
extern int _Atomic *pqo;
extern int *puo;
pqo = &qo; /* check-should-pass */
pqo = &uo; /* check-should-pass */
pqo = puo;
puo = &uo; /* check-should-pass */
puo = &qo; /* check-should-fail */
puo = pqo; /* check-should-fail */
}
void baz(void)
{
extern typeof(&qo) pqo;
extern typeof(&uo) puo;
pqo = &qo; /* check-should-pass */
pqo = &uo; /* check-should-pass */
pqo = puo;
puo = &uo; /* check-should-pass */
puo = &qo; /* check-should-fail */
puo = pqo; /* check-should-fail */
}
/*
* check-name: C11 _Atomic type qualifier
* check-command: sparse -Wno-decl $file
*
* check-error-start
c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (incompatible argument 1 (different modifiers)):
c11-atomic.c:11:6: void extern [addressable] [toplevel] f02( ... )
c11-atomic.c:3:6: note: previously declared as:
c11-atomic.c:3:6: void extern [addressable] [toplevel] f02( ... )
c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (incompatible argument 1 (different modifiers)):
c11-atomic.c:12:6: void extern [addressable] [toplevel] f03( ... )
c11-atomic.c:4:6: note: previously declared as:
c11-atomic.c:4:6: void extern [addressable] [toplevel] f03( ... )
c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:33:13: expected int *extern [assigned] puo
c11-atomic.c:33:13: got int const *
c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:34:13: expected int *extern [assigned] puo
c11-atomic.c:34:13: got int const *extern [assigned] pqo
c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:48:13: expected int *extern [assigned] puo
c11-atomic.c:48:13: got int [atomic] *
c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:49:13: expected int *extern [assigned] puo
c11-atomic.c:49:13: got int [atomic] *extern [assigned] pqo
c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:63:13: expected int *extern [assigned] puo
c11-atomic.c:63:13: got int [atomic] *
c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:64:13: expected int *extern [assigned] puo
c11-atomic.c:64:13: got int [atomic] *extern [assigned] pqo
* check-error-end
*/
|