Imported Upstream version 2.9.0
[debian/cc1111] / support / valdiag / tests / restrict.c
1
2 /* The restrict keyword can only qualify pointers */
3
4 #ifdef TEST1_C99
5 restrict a;             /* ERROR */
6 #endif
7
8 #ifdef TEST2_C99
9 restrict int a;         /* ERROR */
10 #endif
11
12 #ifdef TEST3_C99
13 restrict int a[10];     /* ERROR */
14 #endif
15
16 #ifdef TEST4_C99
17 restrict int * a;       /* ERROR */
18 #endif
19
20 #ifdef TEST5_C99
21 restrict struct
22   {
23     int a;
24     int b;
25   } x;                  /* ERROR */
26 #endif
27
28 #ifdef TEST6_C99
29 restrict int func(void) {       /* ERROR */
30   return 0;
31 }
32 #endif
33
34 #ifdef TEST7_C99
35 void func(restrict int x) {     /* ERROR */
36   x;                            /* IGNORE */
37 }
38 #endif
39
40
41 #ifdef TEST_GOOD1_C99
42 int * restrict a;
43 #endif
44
45 #ifdef TEST_GOOD2_C99
46 int * func(int * restrict x)
47 {
48   return x;
49 }
50 #endif
51
52 #ifdef TEST_GOOD3_C99
53 void func(int * restrict x)
54 {
55   x;                            /* IGNORE */
56 }
57 #endif