]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/typeof-2.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / typeof-2.c
CommitLineData
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
7extern int i;
8
9extern int * p;
10
11extern int _Atomic const ci;
768ce4f0 12extern __typeof (ci) ci;
9698b078
SH
13
14extern int _Atomic volatile vi;
768ce4f0 15extern __typeof (vi) vi;
9698b078
SH
16
17extern int * _Atomic restrict ri;
768ce4f0
MU
18extern __typeof (ri) ri;
19
20/* Check that the qualifiers are discarded for atomic types. */
9698b078
SH
21
22void 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
36extern int const j;
37
38extern int volatile k;
39
40extern int * restrict q;
41
42extern int const nci;
43extern __typeof (nci) j;
44
45extern int volatile nvi;
46extern __typeof (nvi) k;
47
48extern int * restrict nri;
49extern __typeof (nri) q;
50
768ce4f0
MU
51/* Check that the qualifiers are discarded for non-atomic types. */
52
88d24a09
SH
53void 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}