[bada452] | 1 | //
|
---|
[c0aa336] | 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.
|
---|
[cd28605] | 6 | //
|
---|
| 7 | // attributes.cfa --
|
---|
[bada452] | 8 | //
|
---|
[c0aa336] | 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Mon Feb 6 16:07:02 2017
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[cd28605] | 12 | // Last Modified On : Thu Feb 6 12:06:22 2025
|
---|
| 13 | // Update Count : 117
|
---|
[bada452] | 14 | //
|
---|
[c0aa336] | 15 |
|
---|
[bada452] | 16 | #pragma GCC diagnostic ignored "-Wattributes"
|
---|
[c0aa336] | 17 |
|
---|
| 18 | // label attribute
|
---|
| 19 | int la() {
|
---|
| 20 | L: __attribute__(( unused )) 1;
|
---|
[bada452] | 21 | return 1;
|
---|
[c0aa336] | 22 | }
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | // aggregate_name
|
---|
[aca0d2f] | 26 | static struct __attribute__(( unused )) {} Dummy;
|
---|
[c0aa336] | 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__
|
---|
[132d276] | 33 | struct __attribute__(( unused )) {} ( int );
|
---|
| 34 | struct __attribute__(( unused )) Agn4 {} ( int );
|
---|
[c0aa336] | 35 | #endif // __CFA__
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | // field_declaring_list
|
---|
[cd28605] | 39 | typedef short int shint;
|
---|
[c0aa336] | 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 ));
|
---|
[ea837e94] | 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 )) );
|
---|
[cd28605] | 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 ));
|
---|
[c0aa336] | 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 ));
|
---|
[ea837e94] | 70 | const __attribute__(( used )) int __attribute__(( used )) ( __attribute__(( used )) * vd9)() __attribute__(( used )), __attribute__(( unused )) (( __attribute__(( used )) * vd10)()) __attribute__(( used ));
|
---|
[c0aa336] | 71 |
|
---|
[cd28605] | 72 |
|
---|
[c0aa336] | 73 | // function_declarator
|
---|
| 74 | __attribute__(( unused )) int f1() __attribute__(( used ));
|
---|
[bada452] | 75 | __attribute__(( unused )) int f1() { return 1; }
|
---|
[c0aa336] | 76 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() __attribute__(( used ));
|
---|
[bada452] | 77 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() { return 0p; }
|
---|
[c0aa336] | 78 | __attribute__(( unused )) int (* __attribute__(( unused )) f3(int))[] __attribute__(( used ));
|
---|
[ea837e94] | 79 | __attribute__(( unused )) int ( __attribute__(( unused )) * __attribute__(( unused )) f4(int))[] __attribute__(( used ));
|
---|
[bada452] | 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; }
|
---|
[ea837e94] | 82 | __attribute__(( unused )) int (* __attribute__(( unused )) f7())(int) __attribute__(( used ));
|
---|
[bada452] | 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; }
|
---|
[c0aa336] | 86 |
|
---|
| 87 |
|
---|
| 88 | // variable_type_redeclarator
|
---|
| 89 | typedef int t1, t2, t3, t4, t5, t6, t7, t8;
|
---|
[bada452] | 90 | void vtr() {
|
---|
[c0aa336] | 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 ));
|
---|
[ea837e94] | 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 ));
|
---|
[c0aa336] | 98 | __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) ((t6))() __attribute__(( unused ));
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | // identifier_parameter_declarator
|
---|
[bada452] | 102 | void ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )),
|
---|
[c0aa336] | 103 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) );
|
---|
[bada452] | 104 | void ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )),
|
---|
[c0aa336] | 105 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) ) {}
|
---|
[bada452] | 106 | void ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )),
|
---|
[c0aa336] | 107 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) );
|
---|
[bada452] | 108 | void ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )),
|
---|
[c0aa336] | 109 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) ) {}
|
---|
[bada452] | 110 | void ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )),
|
---|
[c0aa336] | 111 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) );
|
---|
[bada452] | 112 | void ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )),
|
---|
[c0aa336] | 113 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) ) {}
|
---|
[bada452] | 114 | void ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )),
|
---|
[c0aa336] | 115 | __attribute__(( unused )) int __attribute__(( unused )) ((q)()) __attribute__(( unused )) );
|
---|
[bada452] | 116 | void ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )),
|
---|
[c0aa336] | 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
|
---|
[bada452] | 132 | void ad() {
|
---|
[c0aa336] | 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 {
|
---|
[bada452] | 167 | int __attribute__(( unused )) x;
|
---|
[e07caa2] | 168 | int __attribute__(( unused )) :4;
|
---|
| 169 | int __attribute__(( unused )) :4, __attribute__(( unused )) :6;
|
---|
[c0aa336] | 170 | };
|
---|
| 171 |
|
---|
[cd28605] | 172 |
|
---|
| 173 | // statments
|
---|
| 174 | void fred() {
|
---|
[0497b6ba] | 175 | int [[unused]] i;
|
---|
[77148b0] | 176 | // C23 attributes are parsed but not pushed through the compiler.
|
---|
| 177 | // int [[gnu::xxx]] j;
|
---|
[0497b6ba] | 178 | switch ( 3 ) {
|
---|
[cd28605] | 179 | __attribute__((unused)) int ret;
|
---|
[0497b6ba] | 180 | case 2:
|
---|
| 181 | 4;
|
---|
[cd28605] | 182 | __attribute__(( fallthrough ));
|
---|
| 183 | [[fallthrough]];
|
---|
[0497b6ba] | 184 | case 1:
|
---|
| 185 | 3;
|
---|
| 186 | }
|
---|
[cd28605] | 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;
|
---|
[0497b6ba] | 193 | }
|
---|
| 194 |
|
---|
[cd28605] | 195 | void mary() {
|
---|
| 196 | @[aligned(64)] struct S { int i; };
|
---|
[0497b6ba] | 197 | int @[unused] i;
|
---|
| 198 | switch ( 3 ) {
|
---|
| 199 | case 2:
|
---|
| 200 | 4;
|
---|
[cd28605] | 201 | __attribute__(( fallthrough ));
|
---|
| 202 | @[fallthrough];
|
---|
[0497b6ba] | 203 | case 1:
|
---|
| 204 | 3;
|
---|
| 205 | }
|
---|
[cd28605] | 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 );
|
---|
[0497b6ba] | 215 | }
|
---|
| 216 |
|
---|
[c0aa336] | 217 | // Local Variables: //
|
---|
| 218 | // tab-width: 4 //
|
---|
[dc8511c] | 219 | // compile-command: "cfa attributes.cfa" //
|
---|
[c0aa336] | 220 | // End: //
|
---|