1 | //
|
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
|
---|
3 | //
|
---|
4 | // The contents of this file are covered under the licence agreement in the
|
---|
5 | // file "LICENCE" distributed with Cforall.
|
---|
6 | //
|
---|
7 | // attributes.cfa --
|
---|
8 | //
|
---|
9 | // Author : Peter A. Buhr
|
---|
10 | // Created On : Mon Feb 6 16:07:02 2017
|
---|
11 | // Last Modified By : Peter A. Buhr
|
---|
12 | // Last Modified On : Thu Feb 6 12:06:22 2025
|
---|
13 | // Update Count : 117
|
---|
14 | //
|
---|
15 |
|
---|
16 | #pragma GCC diagnostic ignored "-Wattributes"
|
---|
17 |
|
---|
18 | // label attribute
|
---|
19 | int la() {
|
---|
20 | L: __attribute__(( unused )) 1;
|
---|
21 | return 1;
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | // aggregate_name
|
---|
26 | static struct __attribute__(( unused )) {} Dummy;
|
---|
27 | struct __attribute__(( unused )) Agn1;
|
---|
28 | struct __attribute__(( unused )) Agn2 {};
|
---|
29 | enum __attribute__(( unused )) { E1 };
|
---|
30 | enum __attribute__(( unused )) Agn3;
|
---|
31 | enum __attribute__(( packed )) Agn3 { E2 };
|
---|
32 | #ifdef __CFA__
|
---|
33 | struct __attribute__(( unused )) {} ( int );
|
---|
34 | struct __attribute__(( unused )) Agn4 {} ( int );
|
---|
35 | #endif // __CFA__
|
---|
36 |
|
---|
37 |
|
---|
38 | // field_declaring_list
|
---|
39 | typedef short int shint;
|
---|
40 | struct Fdl {
|
---|
41 | int f1 __attribute__(( unused ));
|
---|
42 | int __attribute__(( unused )) f2;
|
---|
43 | int __attribute__(( unused )) f3 __attribute__(( unused ));
|
---|
44 | __attribute__(( unused )) int f4;
|
---|
45 | __attribute__(( unused )) int f5 __attribute__(( unused ));
|
---|
46 | __attribute__(( used )) int f6 __attribute__(( packed )), f7 __attribute__(( unused )) __attribute__(( unused )), __attribute__(( used )) f8 __attribute__(( unused ));
|
---|
47 | int * f9 __attribute__(( unused ));
|
---|
48 | __attribute__(( used )) int __attribute__(( unused )) * f10;
|
---|
49 | int ( ( * f11 __attribute__(( unused )) ) __attribute__(( unused )) );
|
---|
50 | int ( ( __attribute__(( unused )) * f12 __attribute__(( unused )) ) __attribute__(( unused )) );
|
---|
51 | int ( ( __attribute__(( unused )) * (f13) __attribute__(( unused )) ) __attribute__(( unused )) );
|
---|
52 | int ( ( ( __attribute__(( unused )) * (f14) ) __attribute__(( unused )) ) __attribute__(( unused )) );
|
---|
53 | // shint __attribute__(( used )) shi1;
|
---|
54 | // shint __attribute__(( used )) shi2 __attribute__(( used ));
|
---|
55 | __attribute__(( used )) shint shi3;
|
---|
56 | __attribute__(( used )) shint shi4 __attribute__(( used ));
|
---|
57 | // __attribute__(( used )) shint __attribute__(( used )) shi5 __attribute__(( used ));
|
---|
58 | };
|
---|
59 |
|
---|
60 |
|
---|
61 | // asm_name_opt
|
---|
62 | int f() asm( "xyz" ) __attribute__(( unused ));
|
---|
63 |
|
---|
64 |
|
---|
65 | // variable_declarator
|
---|
66 | const __attribute__(( used )) int vd1 __attribute__(( used )), __attribute__(( unused )) vd2;
|
---|
67 | const __attribute__(( used )) int __attribute__(( used )) * __attribute__(( used )) vd3 __attribute__(( used )), __attribute__(( unused )) (* __attribute__(( unused )) (vd4)) __attribute__(( used ));
|
---|
68 | const __attribute__(( used )) int __attribute__(( used )) vd5[5] __attribute__(( used )), __attribute__(( unused )) ((vd6)[5]) __attribute__(( used ));
|
---|
69 | const __attribute__(( used )) int __attribute__(( used )) (* __attribute__(( used )) vd7)() __attribute__(( used )), __attribute__(( unused )) ((* __attribute__(( used )) vd8)()) __attribute__(( used ));
|
---|
70 | const __attribute__(( used )) int __attribute__(( used )) ( __attribute__(( used )) * vd9)() __attribute__(( used )), __attribute__(( unused )) (( __attribute__(( used )) * vd10)()) __attribute__(( used ));
|
---|
71 |
|
---|
72 |
|
---|
73 | // function_declarator
|
---|
74 | __attribute__(( unused )) int f1() __attribute__(( used ));
|
---|
75 | __attribute__(( unused )) int f1() { return 1; }
|
---|
76 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() __attribute__(( used ));
|
---|
77 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() { return 0p; }
|
---|
78 | __attribute__(( unused )) int (* __attribute__(( unused )) f3(int))[] __attribute__(( used ));
|
---|
79 | __attribute__(( unused )) int ( __attribute__(( unused )) * __attribute__(( unused )) f4(int))[] __attribute__(( used ));
|
---|
80 | __attribute__(( unused )) int (* __attribute__(( unused )) f5(int p))[] { (void)p; return 0p; }
|
---|
81 | __attribute__(( unused )) int ( __attribute__(( unused )) * (f6)(int p))[] { (void)p; return 0p; }
|
---|
82 | __attribute__(( unused )) int (* __attribute__(( unused )) f7())(int) __attribute__(( used ));
|
---|
83 | __attribute__(( unused )) int (* __attribute__(( unused )) f8())(int) { return 0p; }
|
---|
84 | __attribute__(( unused )) int ( __attribute__(( unused )) * f9())(int) { return 0p; }
|
---|
85 | __attribute__(( unused )) int ( __attribute__(( unused )) * (f10)())(int) { return 0p; }
|
---|
86 |
|
---|
87 |
|
---|
88 | // variable_type_redeclarator
|
---|
89 | typedef int t1, t2, t3, t4, t5, t6, t7, t8;
|
---|
90 | void vtr() {
|
---|
91 | // redefine typedef name in new scope
|
---|
92 | __attribute__(( unused )) int __attribute__(( unused )) t1 __attribute__(( used ));
|
---|
93 | __attribute__(( unused )) int __attribute__(( unused )) (* (* t2 __attribute__(( unused )) ) __attribute__(( unused )) ) __attribute__(( unused ));
|
---|
94 | __attribute__(( unused )) int __attribute__(( unused )) t3[5] __attribute__(( unused ));
|
---|
95 | __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) t4[5]) __attribute__(( unused )) ) __attribute__(( unused ));
|
---|
96 | __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) * ( __attribute__(( unused )) * t5[5]) __attribute__(( unused )) ) __attribute__(( unused ));
|
---|
97 | __attribute__(( unused )) int __attribute__(( unused )) t6() __attribute__(( unused ));
|
---|
98 | __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) ((t6))() __attribute__(( unused ));
|
---|
99 | }
|
---|
100 |
|
---|
101 | // identifier_parameter_declarator
|
---|
102 | void ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )),
|
---|
103 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) );
|
---|
104 | void ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )),
|
---|
105 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) ) {}
|
---|
106 | void ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )),
|
---|
107 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) );
|
---|
108 | void ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )),
|
---|
109 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) ) {}
|
---|
110 | void ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )),
|
---|
111 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) );
|
---|
112 | void ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )),
|
---|
113 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) ) {}
|
---|
114 | void ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )),
|
---|
115 | __attribute__(( unused )) int __attribute__(( unused )) ((q)()) __attribute__(( unused )) );
|
---|
116 | void ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )),
|
---|
117 | __attribute__(( unused )) int __attribute__(( unused )) ((q)()) __attribute__(( unused )) ) {}
|
---|
118 |
|
---|
119 |
|
---|
120 | // type_parameter_redeclarator
|
---|
121 | typedef int Foo;
|
---|
122 | int tpr1( __attribute__(( unused )) int __attribute__(( unused )) Foo __attribute__(( unused )) );
|
---|
123 | int tpr2( __attribute__(( unused )) int __attribute__(( unused )) (* __attribute__(( unused )) (* __attribute__(( unused )) Foo) __attribute__(( unused )) ) __attribute__(( unused )) );
|
---|
124 | int tpr3( __attribute__(( unused )) int __attribute__(( unused )) Foo[] __attribute__(( unused )));
|
---|
125 | int tpr4( __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) Foo[5] __attribute__(( unused )) ) );
|
---|
126 | int tpr5( __attribute__(( unused )) int __attribute__(( unused )) (*Foo)() __attribute__(( unused )) );
|
---|
127 | int tpr6( __attribute__(( unused )) int __attribute__(( unused )) Foo() __attribute__(( unused )) );
|
---|
128 | int tpr7( __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) Foo( __attribute__(( unused )) int __attribute__(( unused )) ) ) );
|
---|
129 |
|
---|
130 |
|
---|
131 | // abstract_declarator
|
---|
132 | void ad() {
|
---|
133 | typeof( int __attribute__(( used )) ) ad1 __attribute__(( unused ));
|
---|
134 | typeof( int __attribute__(( unused )) * __attribute__(( unused )) ) ad2 __attribute__(( unused ));
|
---|
135 | typeof( int __attribute__(( unused )) [5] ) __attribute__(( unused )) ad3 __attribute__(( unused ));
|
---|
136 | typeof( __attribute__(( unused )) int __attribute__(( unused )) (*)[10] __attribute__(( unused )) ) __attribute__(( unused )) ad4 __attribute__(( unused )), ad5 __attribute__(( used ));
|
---|
137 | typeof( __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )) ) __attribute__(( unused )) ad6 __attribute__(( unused ));
|
---|
138 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) );
|
---|
139 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) (* __attribute__(( unused )) (* __attribute__(( unused )) ) ) );
|
---|
140 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) [5] __attribute__(( unused )) );
|
---|
141 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) (*)[10] __attribute__(( unused )) );
|
---|
142 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )) );
|
---|
143 | sizeof( struct { int i; } __attribute__(( unused )) );
|
---|
144 | sizeof( enum { R } __attribute__(( unused )) );
|
---|
145 | }
|
---|
146 |
|
---|
147 |
|
---|
148 | // abstract_parameter_declarator
|
---|
149 | int apd1( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )),
|
---|
150 | __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) );
|
---|
151 | int apd2( __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) ) __attribute__(( unused )) ),
|
---|
152 | __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) ) __attribute__(( unused )) ) );
|
---|
153 | int apd3( __attribute__(( unused )) int __attribute__(( unused )) ([]) __attribute__(( unused )),
|
---|
154 | __attribute__(( unused )) int __attribute__(( unused )) ([]) __attribute__(( unused )) );
|
---|
155 | int apd4( __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )),
|
---|
156 | __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )) );
|
---|
157 | int apd5( __attribute__(( unused )) int __attribute__(( unused )) (( __attribute__(( unused )) int )) __attribute__(( unused )),
|
---|
158 | __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) int ) __attribute__(( unused )) );
|
---|
159 | int apd6( __attribute__(( unused )) int __attribute__(( unused )) (*)() __attribute__(( unused )),
|
---|
160 | __attribute__(( unused )) int __attribute__(( unused )) (*)() __attribute__(( unused )) );
|
---|
161 | int apd7( __attribute__(( unused )) int __attribute__(( unused )) ((*)( __attribute__(( unused )) int ) ) __attribute__(( unused )),
|
---|
162 | __attribute__(( unused )) int __attribute__(( unused )) ((*)( __attribute__(( unused )) int ) ) __attribute__(( unused )) );
|
---|
163 |
|
---|
164 |
|
---|
165 | // variable_abstract_declarator
|
---|
166 | struct Vad {
|
---|
167 | int __attribute__(( unused )) x;
|
---|
168 | int __attribute__(( unused )) :4;
|
---|
169 | int __attribute__(( unused )) :4, __attribute__(( unused )) :6;
|
---|
170 | };
|
---|
171 |
|
---|
172 |
|
---|
173 | // statments
|
---|
174 | void fred() {
|
---|
175 | int [[unused]] i;
|
---|
176 | // C23 attributes are parsed but not pushed through the compiler.
|
---|
177 | // int [[gnu::xxx]] j;
|
---|
178 | switch ( 3 ) {
|
---|
179 | __attribute__((unused)) int ret;
|
---|
180 | case 2:
|
---|
181 | 4;
|
---|
182 | __attribute__(( fallthrough ));
|
---|
183 | [[fallthrough]];
|
---|
184 | case 1:
|
---|
185 | 3;
|
---|
186 | }
|
---|
187 | L : __attribute__(( unused )) goto L;
|
---|
188 | L1 : [[ unused ]] L2 : [[ unused ]] goto L2;
|
---|
189 | __attribute__(( unused )) return;
|
---|
190 | [[ noreturn ]] return;
|
---|
191 | __attribute__(( noreturn )) return;
|
---|
192 | [[ GNU::fred ]] i += 1;
|
---|
193 | }
|
---|
194 |
|
---|
195 | void mary() {
|
---|
196 | @[aligned(64)] struct S { int i; };
|
---|
197 | int @[unused] i;
|
---|
198 | switch ( 3 ) {
|
---|
199 | case 2:
|
---|
200 | 4;
|
---|
201 | __attribute__(( fallthrough ));
|
---|
202 | @[fallthrough];
|
---|
203 | case 1:
|
---|
204 | 3;
|
---|
205 | }
|
---|
206 | L : __attribute__(( unused )) goto L;
|
---|
207 | L1 : @[ unused ] L2 : @[ unused ] goto L2;
|
---|
208 | __attribute__(( unused )) return;
|
---|
209 | @[ noreturn ] return;
|
---|
210 | __attribute__(( noreturn )) return;
|
---|
211 | }
|
---|
212 |
|
---|
213 | [[ noreturn ]] void jack() {
|
---|
214 | exit( -1 );
|
---|
215 | }
|
---|
216 |
|
---|
217 | // Local Variables: //
|
---|
218 | // tab-width: 4 //
|
---|
219 | // compile-command: "cfa attributes.cfa" //
|
---|
220 | // End: //
|
---|