source: tests/functions.cfa @ 58b2638

ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change on this file since 58b2638 was dc8511c, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

first attempt at updating suffixes for test programs

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[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
[dc8511c]12// Last Modified On : Tue Nov  6 17:54:09 2018
13// Update Count     : 13
[c0453ca3]14//
[5ead9f9]15
[51b7345]16// ANSI function definitions
17
18void h(void) {}
19
20int f (
[a65d92e]21        int (void),
22        int (int),
23        int ((void)),
24        int ((int)),
25        void g(void)
26        ) {
[320eb73a]27        (* g)();
[a65d92e]28        g();
29        g = h;
[51b7345]30}
31
32int f1() {}
33int (f2()) {}
[320eb73a]34int (* f3())() {}
35int * ((f4())) {}
36int ((* f5()))() {}
37int * f6() {}
38int * (f7)() {}
39int ** f8() {}
40int * const * (f9)() {}
41int (* f10())[] {}
42int (* f11())[][3] {}
43int ((* f12())[])[3] {}
[51b7345]44
[55ba7339]45// "implicit int" otype specifier (not ANSI)
[51b7345]46
47fII1( int i ) {}
48const fII2( int i ) {}
49extern fII3( int i ) {}
50extern const fII4( int i ) {}
51
[320eb73a]52* fII5() {}
53const * fII6() {}
54const long * fII7() {}
55static const long * fII8() {}
56const static long * fII9() {}
[51b7345]57
58// K&R function definitions
59
60fO1( i ) int i; {}
61int fO2( i ) int i; {}
62const fO3( i ) int i; {}
63extern fO4( i ) int i; {}
64extern const fO5( i ) int i; {}
65
66// Cforall extensions
67
[481115f]68// [] f( );
[51b7345]69[int] f( );
[481115f]70// [] f(int);
[51b7345]71[int] f(int);
[481115f]72// [] f( ) {}
[51b7345]73[int] f( ) {}
[481115f]74// [] f(int) {}
[51b7345]75[int] f(int) {}
76
77[int x] f( );
[481115f]78// [] f(int x);
79//[int x] f(int x);
80//[int x] f( ) {}
81// [] f(int x) {}
82//[int x] f(int x) {}
[51b7345]83
84[int, int x] f( );
[481115f]85// [] f(int, int x);
[51b7345]86[int, int x] f(int, int x);
87[int, int x] f( ) {}
[481115f]88// [] f(int, int x) {}
[51b7345]89[int, int x] f(int, int x) {}
90
91[int, int x, int] f( );
[481115f]92// [] f(int, int x, int);
[51b7345]93[int, int x, int] f(int, int x, int);
94[int, int x, int] f( ) {}
[481115f]95// [] f(int, int x, int) {}
[51b7345]96[int, int x, int] f(int, int x, int) {}
97
98[int, int x, * int y] f( );
[481115f]99// [] f(int, int x, * int y);
[51b7345]100[int, int x, * int y] f(int, int x, * int y);
101[int, int x, * int y] f( ) {}
[481115f]102// [] f(int, int x, * int y) {}
[51b7345]103[int, int x, * int y] f(int, int x, * int y) {}
104
[481115f]105// function prototypes
106
107[ int ] f11( int ), f12();  // => int f11( int ), f12( void );
108
109const double bar1(), bar2( int ), bar3( double );               // C version
110[const double] foo(), foo( int ), foo( double ) { return 3.0; } // CFA version
111struct S { int i; };
112[S] rtn( int ) {}
113
[51b7345]114
115[int] f(
116        int ( int, int p ),
117        [int](int)
[a65d92e]118        ) {
[320eb73a]119        int (* (* pc)[][10])[][3];
[a65d92e]120        * [][10] * [][3] int p;
121        * [] * [int](int) p;
[51b7345]122}
123
[320eb73a]124static const int * f1() {}
[c0453ca3]125static [ * const int ] f2() {}
[51b7345]126static inline [ const * int ] f3() {}
127static inline [ const [ * int, int ] ] f4() {}
128static [ const [ * int, const int ] ] f5() {}
129
130// unnamed parameter
131
132int f(
[a65d92e]133        int (),
134
[320eb73a]135        int * (),
136        int ** (),
137        int * const * (),
[a65d92e]138        int * const * const (),
139
140        int ([]),
141        int ([10]),
142
[320eb73a]143        int * ([]),
144        int * ([10]),
145        int ** ([]),
146        int ** ([10]),
147        int * const * ([]),
148        int * const * ([10]),
[a65d92e]149        int * const * const ([]),
150        int * const * const ([10])
151        );
[51b7345]152
153int f(
[a65d92e]154        int (),
155
[320eb73a]156        int * (),
157        int ** (),
158        int * const * (),
[a65d92e]159        int * const * const (),
160
161        int ([]),
162        int ([10]),
163
[320eb73a]164        int * ([]),
165        int * ([10]),
166        int ** ([]),
167        int ** ([10]),
168        int * const * ([]),
169        int * const * ([10]),
[a65d92e]170        int * const * const ([]),
171        int * const * const ([10])
172        ) {
[51b7345]173}
174
175typedef int T;
176
[320eb73a]177int f( T (* f), T t ) {
[a65d92e]178        T (T);
[51b7345]179}
180
181// errors
182
183//int f()[] {}
184//int (f[])() {}
185//int f[]() {}
[320eb73a]186//int ((* f15())())[] {}
[a65d92e]187
188// Local Variables: //
189// tab-width: 4 //
[dc8511c]190// compile-command: "cfa functions.cfa" //
[a65d92e]191// End: //
Note: See TracBrowser for help on using the repository browser.