]>
Commit | Line | Data |
---|---|---|
768ce4f0 | 1 | /* Test qualifier preservation of typeof and discarded for __auto_type. */ |
9698b078 SH |
2 | /* { dg-do compile } */ |
3 | /* { dg-options "-std=c11" } */ | |
4 | ||
768ce4f0 | 5 | /* Check that the qualifiers are preserved for atomic types. */ |
88d24a09 | 6 | |
9698b078 SH |
7 | extern int i; |
8 | ||
9 | extern int * p; | |
10 | ||
11 | extern int _Atomic const ci; | |
768ce4f0 | 12 | extern __typeof (ci) ci; |
9698b078 SH |
13 | |
14 | extern int _Atomic volatile vi; | |
768ce4f0 | 15 | extern __typeof (vi) vi; |
9698b078 SH |
16 | |
17 | extern int * _Atomic restrict ri; | |
768ce4f0 MU |
18 | extern __typeof (ri) ri; |
19 | ||
20 | /* Check that the qualifiers are discarded for atomic types. */ | |
9698b078 SH |
21 | |
22 | void f(void) | |
23 | { | |
24 | __auto_type aci = ci; | |
25 | int *paci = &aci; | |
26 | ||
27 | __auto_type avi = vi; | |
28 | int *pavi = &avi; | |
29 | ||
30 | __auto_type ari = ri; | |
31 | int **pari = &ari; | |
32 | } | |
88d24a09 SH |
33 | |
34 | /* Check that the qualifiers are preserved for non-atomic types. */ | |
35 | ||
36 | extern int const j; | |
37 | ||
38 | extern int volatile k; | |
39 | ||
40 | extern int * restrict q; | |
41 | ||
42 | extern int const nci; | |
43 | extern __typeof (nci) j; | |
44 | ||
45 | extern int volatile nvi; | |
46 | extern __typeof (nvi) k; | |
47 | ||
48 | extern int * restrict nri; | |
49 | extern __typeof (nri) q; | |
50 | ||
768ce4f0 MU |
51 | /* Check that the qualifiers are discarded for non-atomic types. */ |
52 | ||
88d24a09 SH |
53 | void g(void) |
54 | { | |
55 | __auto_type aci = nci; | |
768ce4f0 | 56 | int *paci = &aci; |
88d24a09 SH |
57 | |
58 | __auto_type avi = nvi; | |
768ce4f0 | 59 | int *pavi = &avi; |
88d24a09 SH |
60 | |
61 | __auto_type ari = nri; | |
768ce4f0 | 62 | int **pari = &ari; |
88d24a09 | 63 | } |