| [c0aa336] | 1 | //                               -*- Mode: C -*- | 
|---|
|  | 2 | // | 
|---|
|  | 3 | // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo | 
|---|
|  | 4 | // | 
|---|
|  | 5 | // The contents of this file are covered under the licence agreement in the | 
|---|
|  | 6 | // file "LICENCE" distributed with Cforall. | 
|---|
|  | 7 | // | 
|---|
|  | 8 | // attributes.c -- | 
|---|
|  | 9 | // | 
|---|
|  | 10 | // Author           : Peter A. Buhr | 
|---|
|  | 11 | // Created On       : Mon Feb  6 16:07:02 2017 | 
|---|
|  | 12 | // Last Modified By : Peter A. Buhr | 
|---|
|  | 13 | // Last Modified On : Mon Feb  6 16:08:21 2017 | 
|---|
|  | 14 | // Update Count     : 2 | 
|---|
|  | 15 | // | 
|---|
|  | 16 |  | 
|---|
|  | 17 |  | 
|---|
|  | 18 | // label attribute | 
|---|
|  | 19 | int la() { | 
|---|
|  | 20 | L: __attribute__(( unused )) 1; | 
|---|
|  | 21 | } | 
|---|
|  | 22 |  | 
|---|
|  | 23 |  | 
|---|
|  | 24 | // aggregate_name | 
|---|
|  | 25 | struct __attribute__(( unused )) {}; | 
|---|
|  | 26 | struct __attribute__(( unused )) Agn1; | 
|---|
|  | 27 | struct __attribute__(( unused )) Agn2 {}; | 
|---|
|  | 28 | enum __attribute__(( unused )) { E1 }; | 
|---|
|  | 29 | enum __attribute__(( unused )) Agn3; | 
|---|
|  | 30 | enum __attribute__(( packed )) Agn3 { E2 }; | 
|---|
|  | 31 | #ifdef __CFA__ | 
|---|
|  | 32 | struct __attribute__(( unused )) ( int ) {}; | 
|---|
|  | 33 | struct __attribute__(( unused )) ( int ) {}; | 
|---|
|  | 34 | #endif // __CFA__ | 
|---|
|  | 35 |  | 
|---|
|  | 36 |  | 
|---|
|  | 37 | // field_declaring_list | 
|---|
|  | 38 | struct Fdl { | 
|---|
|  | 39 | int f1 __attribute__(( unused )); | 
|---|
|  | 40 | int __attribute__(( unused )) f2; | 
|---|
|  | 41 | int __attribute__(( unused )) f3 __attribute__(( unused )); | 
|---|
|  | 42 | __attribute__(( unused )) int f4; | 
|---|
|  | 43 | __attribute__(( unused )) int f5 __attribute__(( unused )); | 
|---|
|  | 44 | __attribute__(( used )) int f6 __attribute__(( packed )), f7 __attribute__(( unused )) __attribute__(( unused )), __attribute__(( used )) f8 __attribute__(( unused )); | 
|---|
|  | 45 | int __attribute__(( unused )); | 
|---|
|  | 46 | int ( ( * (f9) __attribute__(( unused )) ) __attribute__(( unused )) ); | 
|---|
|  | 47 | }; | 
|---|
|  | 48 |  | 
|---|
|  | 49 |  | 
|---|
|  | 50 | // asm_name_opt | 
|---|
|  | 51 | int f() asm( "xyz" ) __attribute__(( unused )); | 
|---|
|  | 52 |  | 
|---|
|  | 53 |  | 
|---|
|  | 54 | // variable_declarator | 
|---|
|  | 55 | const __attribute__(( used )) int vd1 __attribute__(( used )), __attribute__(( unused )) vd2; | 
|---|
|  | 56 | const __attribute__(( used )) int __attribute__(( used )) * __attribute__(( used )) vd3 __attribute__(( used )), __attribute__(( unused )) (* __attribute__(( unused )) (vd4)) __attribute__(( used )); | 
|---|
|  | 57 | const __attribute__(( used )) int __attribute__(( used )) vd5[5] __attribute__(( used )), __attribute__(( unused )) ((vd6)[5]) __attribute__(( used )); | 
|---|
|  | 58 | const __attribute__(( used )) int __attribute__(( used )) (* __attribute__(( used )) vd7)() __attribute__(( used )), __attribute__(( unused )) ((* __attribute__(( used )) vd8)()) __attribute__(( used )); | 
|---|
|  | 59 |  | 
|---|
|  | 60 |  | 
|---|
|  | 61 | // function_declarator | 
|---|
|  | 62 | __attribute__(( unused )) int f1() __attribute__(( used )); | 
|---|
|  | 63 | __attribute__(( unused )) int f1() {} | 
|---|
|  | 64 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() __attribute__(( used )); | 
|---|
|  | 65 | __attribute__(( unused )) int * __attribute__(( unused )) * const __attribute__(( unused )) f2() {} | 
|---|
|  | 66 | __attribute__(( unused )) int (* __attribute__(( unused )) f3(int))[] __attribute__(( used )); | 
|---|
|  | 67 | __attribute__(( unused )) int (* __attribute__(( unused )) f3(int p))[] {} | 
|---|
|  | 68 | __attribute__(( unused )) int (* __attribute__(( unused )) f4())(int) __attribute__(( used )); | 
|---|
|  | 69 | __attribute__(( unused )) int (* __attribute__(( unused )) f4())(int) {} | 
|---|
|  | 70 |  | 
|---|
|  | 71 | #ifdef __CFA__ | 
|---|
|  | 72 | extern "C" { | 
|---|
|  | 73 | #endif // __CFA__ | 
|---|
|  | 74 | typedef long int ptrdiff_t; | 
|---|
|  | 75 | typedef long unsigned int size_t; | 
|---|
|  | 76 | extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; | 
|---|
|  | 77 | extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); | 
|---|
|  | 78 | extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); | 
|---|
|  | 79 | extern int atexit0 (void (*__func) (void), void *, void *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); | 
|---|
|  | 80 | extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); | 
|---|
|  | 81 | extern int printf (__const char *__restrict __format, ...) __attribute__ ((format (printf, 1, 2))); | 
|---|
|  | 82 | #ifdef __CFA__ | 
|---|
|  | 83 | } | 
|---|
|  | 84 | #endif // __CFA__ | 
|---|
|  | 85 |  | 
|---|
|  | 86 |  | 
|---|
|  | 87 | // variable_type_redeclarator | 
|---|
|  | 88 | typedef int t1, t2, t3, t4, t5, t6, t7, t8; | 
|---|
|  | 89 | int vtr() { | 
|---|
|  | 90 | // redefine typedef name in new scope | 
|---|
|  | 91 | __attribute__(( unused )) int __attribute__(( unused )) t1 __attribute__(( used )); | 
|---|
|  | 92 | __attribute__(( unused )) int __attribute__(( unused )) (* (* t2 __attribute__(( unused )) ) __attribute__(( unused )) ) __attribute__(( unused )); | 
|---|
|  | 93 | __attribute__(( unused )) int __attribute__(( unused )) t3[5] __attribute__(( unused )); | 
|---|
|  | 94 | __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) t4[5]) __attribute__(( unused )) ) __attribute__(( unused )); | 
|---|
|  | 95 | __attribute__(( unused )) int __attribute__(( unused )) t5() __attribute__(( unused )); | 
|---|
|  | 96 | __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) ((t6))() __attribute__(( unused )); | 
|---|
|  | 97 | } | 
|---|
|  | 98 |  | 
|---|
|  | 99 |  | 
|---|
|  | 100 | // identifier_parameter_declarator | 
|---|
|  | 101 | int ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )), | 
|---|
|  | 102 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) ); | 
|---|
|  | 103 | int ipd1( __attribute__(( unused )) int __attribute__(( unused )) p __attribute__(( unused )), | 
|---|
|  | 104 | __attribute__(( unused )) int __attribute__(( unused )) q __attribute__(( unused )) ) {} | 
|---|
|  | 105 | int ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )), | 
|---|
|  | 106 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) ); | 
|---|
|  | 107 | int ipd2( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) p __attribute__(( unused )), | 
|---|
|  | 108 | __attribute__(( unused )) int __attribute__(( unused )) (* (q)) __attribute__(( unused )) ) {} | 
|---|
|  | 109 | int ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )), | 
|---|
|  | 110 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) ); | 
|---|
|  | 111 | int ipd3( __attribute__(( unused )) int __attribute__(( unused )) p[] __attribute__(( unused )), | 
|---|
|  | 112 | __attribute__(( unused )) int __attribute__(( unused )) ((q)[]) __attribute__(( unused )) ) {} | 
|---|
|  | 113 | int ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )), | 
|---|
|  | 114 | __attribute__(( unused )) int __attribute__(( unused )) ((q)()) __attribute__(( unused )) ); | 
|---|
|  | 115 | int ipd4( __attribute__(( unused )) int __attribute__(( unused )) p() __attribute__(( unused )), | 
|---|
|  | 116 | __attribute__(( unused )) int __attribute__(( unused )) ((q)()) __attribute__(( unused )) ) {} | 
|---|
|  | 117 |  | 
|---|
|  | 118 |  | 
|---|
|  | 119 | // type_parameter_redeclarator | 
|---|
|  | 120 | typedef int Foo; | 
|---|
|  | 121 | int tpr1( __attribute__(( unused )) int __attribute__(( unused )) Foo __attribute__(( unused )) ); | 
|---|
|  | 122 | int tpr2( __attribute__(( unused )) int __attribute__(( unused )) (* __attribute__(( unused )) (* __attribute__(( unused )) Foo) __attribute__(( unused )) ) __attribute__(( unused )) ); | 
|---|
|  | 123 | int tpr3( __attribute__(( unused )) int __attribute__(( unused )) Foo[]  __attribute__(( unused ))); | 
|---|
|  | 124 | int tpr4( __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) Foo[5] __attribute__(( unused )) ) ); | 
|---|
|  | 125 | int tpr5( __attribute__(( unused )) int __attribute__(( unused )) (*Foo)() __attribute__(( unused )) ); | 
|---|
|  | 126 | int tpr6( __attribute__(( unused )) int __attribute__(( unused )) Foo() __attribute__(( unused )) ); | 
|---|
|  | 127 | int tpr7( __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) Foo( __attribute__(( unused )) int __attribute__(( unused )) ) ) ); | 
|---|
|  | 128 |  | 
|---|
|  | 129 |  | 
|---|
|  | 130 | // abstract_declarator | 
|---|
|  | 131 | int ad() { | 
|---|
|  | 132 | typeof( int __attribute__(( used )) ) ad1 __attribute__(( unused )); | 
|---|
|  | 133 | typeof( int __attribute__(( unused )) * __attribute__(( unused )) ) ad2 __attribute__(( unused )); | 
|---|
|  | 134 | typeof( int __attribute__(( unused )) [5] ) __attribute__(( unused )) ad3 __attribute__(( unused )); | 
|---|
|  | 135 | typeof( __attribute__(( unused )) int __attribute__(( unused )) (*)[10] __attribute__(( unused )) ) __attribute__(( unused )) ad4 __attribute__(( unused )), ad5 __attribute__(( used )); | 
|---|
|  | 136 | typeof( __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )) ) __attribute__(( unused )) ad6 __attribute__(( unused )); | 
|---|
|  | 137 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) ); | 
|---|
|  | 138 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) (* __attribute__(( unused )) (* __attribute__(( unused )) ) ) ); | 
|---|
|  | 139 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) [5] __attribute__(( unused )) ); | 
|---|
|  | 140 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) (*)[10] __attribute__(( unused )) ); | 
|---|
|  | 141 | sizeof( __attribute__(( unused )) int __attribute__(( unused )) () __attribute__(( unused )) ); | 
|---|
|  | 142 | sizeof( struct { int i; } __attribute__(( unused )) ); | 
|---|
|  | 143 | sizeof( enum { R } __attribute__(( unused )) ); | 
|---|
|  | 144 | } | 
|---|
|  | 145 |  | 
|---|
|  | 146 |  | 
|---|
|  | 147 | // abstract_parameter_declarator | 
|---|
|  | 148 | int apd1( __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )), | 
|---|
|  | 149 | __attribute__(( unused )) int __attribute__(( unused )) * __attribute__(( unused )) ); | 
|---|
|  | 150 | int apd2( __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) ) __attribute__(( unused )) ), | 
|---|
|  | 151 | __attribute__(( unused )) int __attribute__(( unused )) (* (* __attribute__(( unused )) ) __attribute__(( unused )) ) ); | 
|---|
|  | 152 | int apd3( __attribute__(( unused )) int __attribute__(( unused )) ([]) __attribute__(( unused )), | 
|---|
|  | 153 | __attribute__(( unused )) int __attribute__(( unused )) ([]) __attribute__(( unused )) ); | 
|---|
|  | 154 | int apd4( __attribute__(( unused )) int __attribute__(( unused )) ()  __attribute__(( unused )), | 
|---|
|  | 155 | __attribute__(( unused )) int __attribute__(( unused )) ()  __attribute__(( unused )) ); | 
|---|
|  | 156 | int apd5( __attribute__(( unused )) int __attribute__(( unused )) (( __attribute__(( unused )) int )) __attribute__(( unused )), | 
|---|
|  | 157 | __attribute__(( unused )) int __attribute__(( unused )) ( __attribute__(( unused )) int ) __attribute__(( unused )) ); | 
|---|
|  | 158 | int apd6( __attribute__(( unused )) int __attribute__(( unused )) (*)()  __attribute__(( unused )), | 
|---|
|  | 159 | __attribute__(( unused )) int __attribute__(( unused )) (*)()  __attribute__(( unused )) ); | 
|---|
|  | 160 | int apd7( __attribute__(( unused )) int __attribute__(( unused )) ((*)( __attribute__(( unused )) int ) ) __attribute__(( unused )), | 
|---|
|  | 161 | __attribute__(( unused )) int __attribute__(( unused )) ((*)( __attribute__(( unused )) int ) ) __attribute__(( unused )) ); | 
|---|
|  | 162 |  | 
|---|
|  | 163 |  | 
|---|
|  | 164 | // variable_abstract_declarator | 
|---|
|  | 165 | struct Vad { | 
|---|
|  | 166 | int __attribute__(( unused )); | 
|---|
|  | 167 | int __attribute__(( unused )) * __attribute__(( unused )); | 
|---|
|  | 168 | int __attribute__(( unused )) [10] __attribute__(( unused )); | 
|---|
|  | 169 | int __attribute__(( unused )) (*)() __attribute__(( unused )); | 
|---|
|  | 170 | }; | 
|---|
|  | 171 |  | 
|---|
|  | 172 | // Local Variables: // | 
|---|
|  | 173 | // tab-width: 4 // | 
|---|
|  | 174 | // compile-command: "cfa attributes.c" // | 
|---|
|  | 175 | // End: // | 
|---|