[c0453ca3] | 1 | //
|
---|
[5ead9f9] | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
[c0453ca3] | 6 | //
|
---|
[dc8511c] | 7 | // functions.cfa --
|
---|
[c0453ca3] | 8 | //
|
---|
[5ead9f9] | 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Wed Aug 17 08:39:58 2016
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[56b47b9] | 12 | // Last Modified On : Tue Mar 5 11:02:25 2024
|
---|
| 13 | // Update Count : 34
|
---|
[c0453ca3] | 14 | //
|
---|
[5ead9f9] | 15 |
|
---|
[51b73452] | 16 | // ANSI function definitions
|
---|
| 17 |
|
---|
[56b47b9] | 18 | void h( void ) {}
|
---|
[51b73452] | 19 |
|
---|
| 20 | int f (
|
---|
[56b47b9] | 21 | int ( void ),
|
---|
| 22 | int ( int ),
|
---|
| 23 | int (( void )),
|
---|
| 24 | int (( int )),
|
---|
| 25 | void g( void )
|
---|
| 26 | ) {
|
---|
| 27 | (*g)();
|
---|
[a65d92e] | 28 | g();
|
---|
| 29 | g = h;
|
---|
[51b73452] | 30 | }
|
---|
| 31 |
|
---|
| 32 | int f1() {}
|
---|
| 33 | int (f2()) {}
|
---|
[56b47b9] | 34 | int (*f3())() {}
|
---|
[320eb73a] | 35 | int * ((f4())) {}
|
---|
[56b47b9] | 36 | int ((*f5()))() {}
|
---|
[320eb73a] | 37 | int * f6() {}
|
---|
[56b47b9] | 38 | int * ( f7)() {}
|
---|
[320eb73a] | 39 | int ** f8() {}
|
---|
[56b47b9] | 40 | int * const * ( f9)() {}
|
---|
[320eb73a] | 41 | int (* f10())[] {}
|
---|
| 42 | int (* f11())[][3] {}
|
---|
| 43 | int ((* f12())[])[3] {}
|
---|
[51b73452] | 44 |
|
---|
[55ba7339] | 45 | // "implicit int" otype specifier (not ANSI)
|
---|
[51b73452] | 46 |
|
---|
| 47 | fII1( int i ) {}
|
---|
| 48 | const fII2( int i ) {}
|
---|
| 49 | extern fII3( int i ) {}
|
---|
| 50 | extern const fII4( int i ) {}
|
---|
| 51 |
|
---|
[320eb73a] | 52 | * fII5() {}
|
---|
| 53 | const * fII6() {}
|
---|
| 54 | const long * fII7() {}
|
---|
| 55 | static const long * fII8() {}
|
---|
| 56 | const static long * fII9() {}
|
---|
[51b73452] | 57 |
|
---|
| 58 | // K&R function definitions
|
---|
| 59 |
|
---|
| 60 | fO1( i ) int i; {}
|
---|
| 61 | int fO2( i ) int i; {}
|
---|
| 62 | const fO3( i ) int i; {}
|
---|
| 63 | extern fO4( i ) int i; {}
|
---|
| 64 | extern const fO5( i ) int i; {}
|
---|
| 65 |
|
---|
| 66 | // Cforall extensions
|
---|
| 67 |
|
---|
[56b47b9] | 68 | [] f();
|
---|
| 69 | [void] f();
|
---|
| 70 | [int] f();
|
---|
| 71 | [] f( int );
|
---|
| 72 | [void] f( int );
|
---|
| 73 | [int] f( int );
|
---|
| 74 | [] f() {}
|
---|
| 75 | [void] fv() {}
|
---|
| 76 | [int] f() {}
|
---|
| 77 | [] f( int ) {}
|
---|
| 78 | [void] fv( int ) {}
|
---|
| 79 | [int] f( int ) {}
|
---|
| 80 |
|
---|
| 81 | [int x] f();
|
---|
| 82 | [] f( int x );
|
---|
| 83 | [void] fv( int x );
|
---|
| 84 | //[int x] f( int x );
|
---|
| 85 | //[int x] f() {}
|
---|
| 86 | [] f2( int x ) {}
|
---|
| 87 | [void] fv1( int x ) {}
|
---|
| 88 | //[int x] f( int x ) {}
|
---|
| 89 |
|
---|
| 90 | [int, int x] f();
|
---|
| 91 | [] f( int, int x );
|
---|
| 92 | [void] fv( int, int x );
|
---|
| 93 | [int, int x] f( int, int x );
|
---|
| 94 | [int, int x] f() {}
|
---|
| 95 | [] f( int, int x ) {}
|
---|
| 96 | [void] fv( int, int x ) {}
|
---|
| 97 | [int, int x] f( int, int x ) {}
|
---|
| 98 |
|
---|
| 99 | [int, int x, int] f();
|
---|
| 100 | [] f( int, int x, int );
|
---|
| 101 | [void] fv( int, int x, int );
|
---|
| 102 | [int, int x, int] f( int, int x, int );
|
---|
| 103 | [int, int x, int] f() {}
|
---|
| 104 | [] f( int, int x, int ) {}
|
---|
| 105 | [void] fv( int, int x, int ) {}
|
---|
| 106 | [int, int x, int] f( int, int x, int ) {}
|
---|
| 107 |
|
---|
| 108 | [int, int x, * int y] f();
|
---|
| 109 | [] f( int, int x, * int y );
|
---|
| 110 | [void] fv( int, int x, * int y );
|
---|
| 111 | [int, int x, * int y] f( int, int x, * int y );
|
---|
| 112 | [int, int x, * int y] f() {}
|
---|
| 113 | [] f( int, int x, * int y ) {}
|
---|
| 114 | [void] fv( int, int x, * int y ) {}
|
---|
| 115 | [int, int x, * int y] f( int, int x, * int y ) {}
|
---|
[51b73452] | 116 |
|
---|
[481115f] | 117 | // function prototypes
|
---|
| 118 |
|
---|
| 119 | [ int ] f11( int ), f12(); // => int f11( int ), f12( void );
|
---|
| 120 |
|
---|
| 121 | const double bar1(), bar2( int ), bar3( double ); // C version
|
---|
| 122 | [const double] foo(), foo( int ), foo( double ) { return 3.0; } // CFA version
|
---|
| 123 | struct S { int i; };
|
---|
| 124 | [S] rtn( int ) {}
|
---|
| 125 |
|
---|
[51b73452] | 126 |
|
---|
| 127 | [int] f(
|
---|
| 128 | int ( int, int p ),
|
---|
| 129 | [int](int)
|
---|
[56b47b9] | 130 | ) {
|
---|
| 131 | int (* (* pc )[][10])[][3];
|
---|
[a65d92e] | 132 | * [][10] * [][3] int p;
|
---|
[56b47b9] | 133 | * [] * [int]( int ) p;
|
---|
[51b73452] | 134 | }
|
---|
| 135 |
|
---|
[320eb73a] | 136 | static const int * f1() {}
|
---|
[c0453ca3] | 137 | static [ * const int ] f2() {}
|
---|
[51b73452] | 138 | static inline [ const * int ] f3() {}
|
---|
| 139 | static inline [ const [ * int, int ] ] f4() {}
|
---|
| 140 | static [ const [ * int, const int ] ] f5() {}
|
---|
| 141 |
|
---|
| 142 | // unnamed parameter
|
---|
| 143 |
|
---|
| 144 | int f(
|
---|
[a65d92e] | 145 | int (),
|
---|
| 146 |
|
---|
[320eb73a] | 147 | int * (),
|
---|
| 148 | int ** (),
|
---|
| 149 | int * const * (),
|
---|
[a65d92e] | 150 | int * const * const (),
|
---|
| 151 |
|
---|
| 152 | int ([]),
|
---|
| 153 | int ([10]),
|
---|
| 154 |
|
---|
[320eb73a] | 155 | int * ([]),
|
---|
| 156 | int * ([10]),
|
---|
| 157 | int ** ([]),
|
---|
| 158 | int ** ([10]),
|
---|
| 159 | int * const * ([]),
|
---|
| 160 | int * const * ([10]),
|
---|
[a65d92e] | 161 | int * const * const ([]),
|
---|
| 162 | int * const * const ([10])
|
---|
[56b47b9] | 163 | );
|
---|
[51b73452] | 164 |
|
---|
| 165 | int f(
|
---|
[a65d92e] | 166 | int (),
|
---|
| 167 |
|
---|
[320eb73a] | 168 | int * (),
|
---|
| 169 | int ** (),
|
---|
| 170 | int * const * (),
|
---|
[a65d92e] | 171 | int * const * const (),
|
---|
| 172 |
|
---|
| 173 | int ([]),
|
---|
| 174 | int ([10]),
|
---|
| 175 |
|
---|
[320eb73a] | 176 | int * ([]),
|
---|
| 177 | int * ([10]),
|
---|
| 178 | int ** ([]),
|
---|
| 179 | int ** ([10]),
|
---|
| 180 | int * const * ([]),
|
---|
| 181 | int * const * ([10]),
|
---|
[a65d92e] | 182 | int * const * const ([]),
|
---|
| 183 | int * const * const ([10])
|
---|
[56b47b9] | 184 | ) {}
|
---|
[51b73452] | 185 |
|
---|
| 186 | typedef int T;
|
---|
| 187 |
|
---|
[56b47b9] | 188 | int f( T ( *f ), T t ) {
|
---|
| 189 | T ( T );
|
---|
[51b73452] | 190 | }
|
---|
| 191 |
|
---|
| 192 | // errors
|
---|
| 193 |
|
---|
| 194 | //int f()[] {}
|
---|
| 195 | //int (f[])() {}
|
---|
| 196 | //int f[]() {}
|
---|
[320eb73a] | 197 | //int ((* f15())())[] {}
|
---|
[a65d92e] | 198 |
|
---|
| 199 | // Local Variables: //
|
---|
| 200 | // tab-width: 4 //
|
---|
[dc8511c] | 201 | // compile-command: "cfa functions.cfa" //
|
---|
[a65d92e] | 202 | // End: //
|
---|