Changeset 0b2961f
- Timestamp:
- Jun 9, 2015, 3:19:04 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 8a95629
- Parents:
- 81419b5
- Location:
- src
- Files:
-
- 32 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tests/SynTree/Constant0-1.c
r81419b5 r0b2961f 11 11 int 0, 1; 12 12 const int 0, 1; 13 int (0), (1); 14 int ((0)), ((1)); 13 15 static const int 0, 1; 14 16 struct { int i; } 0; … … 18 20 // pointer 19 21 20 int 1, * 0; 21 int (1), ((1)), * (0), (* 0), ((* 0)); 22 int * const (0), (* const 0), ((* const 0)); 23 struct { int i; } * 0; 22 int *0, *1; 23 int *(0), *(1); 24 int (*0), (*1); 25 int ((*0)), ((*1)); 26 int * const (0), * const 1; 27 int (* const 0), (* const 1); 28 int ((* const 0)), ((* const 1)); 29 struct { int i; } *0; 24 30 25 31 // Cforall style … … 34 40 static const * int x, 0; 35 41 const * * int x, 0; 42 43 int main() { 44 int 1, * 0; 45 * int x, 0; 46 } -
src/Tests/SynTree/DeclarationSpecifier.c
r81419b5 r0b2961f 11 11 const short volatile int static x7; 12 12 short int volatile static const x8; 13 static short int volatile static const x9; // duplicate static 13 14 14 15 const volatile struct { int i; } x10; … … 20 21 struct { int i; } const static volatile x16; 21 22 struct { int i; } const volatile static x17; 23 struct { int i; } const static volatile static x18; // duplicate static 24 struct { int i; } const static volatile static volatile x19; // duplicate static & volatile 22 25 23 26 const Int volatile x20; … … 29 32 const volatile Int static x26; 30 33 Int volatile static const x27; 34 static Int volatile static const x28; // duplicate static 31 35 32 36 const volatile struct { Int i; } x29; -
src/Tests/SynTree/Forall.c
r81419b5 r0b2961f 9 9 10 10 context sumable( type T ) { 11 12 13 14 11 const T 0; 12 T ?+?(T, T); 13 T ?++(T); 14 [T] ?+=?(T,T); 15 15 }; 16 16 … … 32 32 int i; 33 33 for ( i = 0; i < n; i += 1 ) 34 34 total = total + a[i]; 35 35 return total; 36 36 } … … 41 41 } 42 42 43 forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } ) 44 T min( T t1, T t2 ) { 45 return t1 < t2 ? t1 : t2; 46 } 47 43 48 int main() { 44 45 49 int x = 1, y = 2, a[10]; 50 float f; 46 51 47 48 twice( x, y);49 50 52 swap( x, y ); 53 twice( x ); 54 f = min( 4.0, 3.0 ); 55 sum( 10, a ); 51 56 } 52 57 -
src/Tests/SynTree/Functions.c
r81419b5 r0b2961f 152 152 typedef int T; 153 153 154 int f( T ( T), T T) {154 int f( T (*f), T t ) { 155 155 T (T); 156 156 } -
src/Tests/SynTree/Initialization.c
r81419b5 r0b2961f 1 1 // Cforall extensions 2 2 3 int * x 21 = 0, x22 = 0;3 int * x11 = 0, x12 = 0; 4 4 int * x21 = 0, x22 = 0; 5 5 … … 27 27 }; 28 28 29 struct point { int x; int z; struct {int y1, y2, y3;} y; int w;}; 30 struct quintet { int v, w, x, y, z;}; 31 32 int main() { 33 struct point p1 = { x : 3 }; 34 struct point p2 = { 3, 4 }; 35 struct point p3 = { .[x,z] : 5, y : { .[y3,y1] : 6, 17 } }; 36 struct point p4 = { w : 5, 4 }; 37 } 38 29 39 // Local Variables: // 30 40 // tab-width: 4 // -
src/Tests/SynTree/Scope.c
r81419b5 r0b2961f 7 7 y q; 8 8 9 y w( y y, u v) {9 y w( y y, u v ) { 10 10 type x | { x t(u); }; 11 11 u u = y; … … 15 15 y p; 16 16 17 context has_u( type z ) 18 { 17 context has_u( type z ) { 19 18 z u(z); 20 19 }; 21 20 22 21 forall( type t | has_u( t ) ) 23 y q( t the_t ) 24 { 22 y q( t the_t ) { 25 23 t y = u( the_t ); 26 24 } … … 29 27 int y; 30 28 typedef char x; 31 32 29 { 33 30 x y; 34 31 typedef x z; 35 36 32 { 37 33 z x; … … 39 35 y z = x; 40 36 } 41 42 37 z x = y; 43 38 } 44 45 39 x q = y; 46 40 } … … 56 50 } 57 51 58 y q( i ) 59 52 y q( i ) /* K&R style */ 53 int i; 60 54 { 61 55 switch ( i ) { -
src/Tests/SynTree/Tuple.c
r81419b5 r0b2961f 1 1 int f( int, int ); 2 2 int g( int, int, int ); 3 static [ int, int ,int, int ] h( int a, int b, * int c, [] char d );3 static [ int, int *, * int, int ] h( int a, int b, * int c, [] char d ); 4 4 5 5 struct inner { … … 30 30 31 31 [ x, y, z ] = [ p, f( 17 ), 3 ]; 32 [ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17 ), 3 ]); 32 33 r = [ x, y, z ]; 33 34 } … … 40 41 f( t1 ); 41 42 g( t1, 3 ); 42 [ 3,5 ];43 [ a,b ] = 3;44 [ a,b ] = [ 4.6 ];45 [ a,b ] = [ c,d ] = [ 3,5 ];46 [ a,b,[ c ] ] = [ 2,[ a,b ] ];47 [ a,b ] = 3 > 4 ? [ b,6 ] : [ 7,8 ];48 43 49 t1 = [ a,b ]; 50 t1 = t2 = [ a,b ]; 51 [ a,b ] = [ c,d ] = d += c += 1; 52 [ a,b ] = [ c,d ] = t1; 53 [ a,b ] = t1 = [ c,d ]; 54 [ a,b ] = t1 = t2 = [ c,d ]; 55 t1 = [ 3,4 ] = [ 3,4 ] = t1 = [ 3,4 ]; 44 [ , , , ]; /* empty tuple */ 45 [ 3, 5 ]; 46 [ a, b ] = 3; 47 [ a, b ] = [ 4.6 ]; 48 [ a, b ] = [ c, d ] = [ 3, 5 ]; 49 [ a, b, [ c ] ] = [ 2,[ a, b ] ]; 50 [ a, b ] = 3 > 4 ? [ b, 6 ] : [ 7, 8 ]; 51 52 t1 = [ a, b ]; 53 t1 = t2 = [ a, b ]; 54 [ a, b ] = [ c, d ] = d += c += 1; 55 [ a, b ] = [ c, d ] = t1; 56 [ a, b ] = t1 = [ c, d ]; 57 [ a, b ] = t1 = t2 = [ c, d ]; 58 t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ]; 56 59 57 60 s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ]; 58 61 s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, 0, "abc" ); 59 sp->[ f4,f1 ] = sp->[ f1,f4 ]; 60 printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3,f2 ], f1 ] ); 62 [ a, , b, ] = h( 3, 3, 0, "abc" ); /* ignore some results */ 63 sp->[ f4,f1 ] = sp->[ f1, f4 ]; 64 printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] ); 61 65 rc = 0; 62 66 } -
src/Tests/SynTree/TypeGenerator.c
r81419b5 r0b2961f 9 9 [int] h( * List(int) p ); // new declaration syntax 10 10 11 struct(type T | addable(T) ) node { T data; struct(T) node *next; }; 11 struct(type T) S1; // forward definition 12 struct(type T) S1 { T i; }; // actual definition 13 struct(int) S1 v1, *p; // expansion and instantiation 14 struct(type T)(int) S2 { T i; } v2; // actual definition, expansion and instantiation 15 struct(type T)(int) { T i; } v2; // anonymous actual definition, expansion and instantiation 16 17 struct( type T | addable(T) ) node { T data; struct(T) node *next; }; 12 18 type List(type T) = struct(T) node *; 13 19 List(int) my_list; -
src/Tests/SynTree/Typedef.c
r81419b5 r0b2961f 2 2 3 3 void f( void ) { 4 5 4 int T( T ); 5 T( 3 ); 6 6 } 7 7 8 8 struct { 9 9 T (T); 10 10 } fred = { 3 }; 11 11 … … 14 14 15 15 int g(void) { 16 16 double a; 17 17 } 18 18 a c; 19 19 20 // typedef x = 3, y = 3; /* GCC */ 20 typedef typeof(3) x, y; // GCC 21 21 22 //x p;23 //y q;22 x p; 23 y q; 24 24 25 25 int main() { 26 // typedef z = p = 3; 26 typedef typeof(3) z, p; 27 z w; 28 p x; 27 29 } 28 30 … … 30 32 31 33 typedef [10] * int arrayOf10Pointers; 32 arrayOf10Pointers x;34 arrayOf10Pointers array; 33 35 typedef const * int constantPointer; 34 36 typedef * [ int ]( [] int ) funcPtr; -
src/Tests/SynTree/VariableDeclarator.c
r81419b5 r0b2961f 40 40 int * const * const (f34[10]); 41 41 42 int (*f35 []);43 int (*f36 [10]);44 int (**f37 []);45 int (**f38 [10]);46 int (* const *f39 []);47 int (* const *f40 [10]);48 int (* const * const f41 []);49 int (* const * const f42 [10]);42 int (*f35)[]; 43 int (*f36)[10]; 44 int (**f37)[]; 45 int (**f38)[10]; 46 int (* const *f39)[]; 47 int (* const *f40)[10]; 48 int (* const * const f41)[]; 49 int (* const * const f42)[10]; 50 50 51 51 int f43[][3]; … … 108 108 // Cforall extensions 109 109 110 * [20] double z; 111 [20] * char w; 110 * int cf3; 111 * * int cf4; 112 * const * int cf5; 113 const * const * int cf6; 114 115 [] int cf15; 116 [10] int cf16; 117 118 [] * int cf19; 119 [10] * int cf20; 120 int **cf21[]; 121 [10] * * int cf22; 122 [] * const * int cf23; 123 [10] * const * int cf24; 124 [] const * const * int cf25; 125 [10] const * const * int cf26; 126 127 * [] int cf35; 128 * [10] int cf36; 129 * * [] int cf37; 130 * * [10] int cf38; 131 * const * [] int cf39; 132 * const * [10] int cf40; 133 const * const * [] int cf41; 134 const * const * [10] int cf42; 135 136 [][3] int cf43; 137 [3][3] int cf44; 138 139 [][3] * int cf49; 140 [3][3] * int cf50; 141 [][3] * * int cf51; 142 [3][3] * * int cf52; 143 [][3] const * int cf53; 144 [3][3] * const * int cf54; 145 [][3] const * const * int cf55; 146 [3][3] const * const * int cf56; 147 148 [int] cf65(int); 149 [int] cf66(int); 150 151 [* int] cf67(int); 152 [* * int] cf68(int); 153 [const * * int] cf69(int); 154 [const * const * int] cf70(int); 112 155 113 156 // function pointer -
src/libcfa/prelude.cf
r81419b5 r0b2961f 8 8 // Created On : Sat Nov 29 07:23:41 2014 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : T hu Jun 4 22:53:04201511 // Update Count : 7 410 // Last Modified On : Tue Jun 9 14:43:47 2015 11 // Update Count : 75 12 12 // 13 13 … … 407 407 const volatile void * ?=?( const volatile void * volatile *, const volatile void * ); 408 408 409 forall( dtype DT ) DT * ?=?( DT * *, forall( dtype DT2 ) const DT2 * );410 forall( dtype DT ) DT * ?=?( DT * volatile *, forall( dtype DT2 ) const DT2 * );409 //forall( dtype DT ) DT * ?=?( DT * *, forall( dtype DT2 ) const DT2 * ); 410 //forall( dtype DT ) DT * ?=?( DT * volatile *, forall( dtype DT2 ) const DT2 * ); 411 411 forall( dtype DT ) const DT * ?=?( const DT * *, forall( dtype DT2 ) const DT2 * ); 412 412 forall( dtype DT ) const DT * ?=?( const DT * volatile *, forall( dtype DT2 ) const DT2 * ); 413 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, forall( dtype DT2 ) const DT2 * );414 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, forall( dtype DT2 ) const DT2 * );413 //forall( dtype DT ) volatile DT * ?=?( volatile DT * *, forall( dtype DT2 ) const DT2 * ); 414 //forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, forall( dtype DT2 ) const DT2 * ); 415 415 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, forall( dtype DT2 ) const DT2 * ); 416 416 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, forall( dtype DT2 ) const DT2 * );
Note: See TracChangeset
for help on using the changeset viewer.