Changeset 0b2961f for src/Tests/SynTree


Ignore:
Timestamp:
Jun 9, 2015, 3:19:04 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

fix warnings from prelude.cf, work on regression testing

Location:
src/Tests/SynTree
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/Tests/SynTree/Constant0-1.c

    r81419b5 r0b2961f  
    1111int 0, 1;
    1212const int 0, 1;
     13int (0), (1);
     14int ((0)), ((1));
    1315static const int 0, 1;
    1416struct { int i; } 0;
     
    1820// pointer
    1921
    20 int 1, * 0;
    21 int (1), ((1)), * (0), (* 0), ((* 0));
    22 int * const (0), (* const 0), ((* const 0));
    23 struct { int i; } * 0;
     22int *0, *1;
     23int *(0), *(1);
     24int (*0), (*1);
     25int ((*0)), ((*1));
     26int * const (0), * const 1;
     27int (* const 0), (* const 1);
     28int ((* const 0)), ((* const 1));
     29struct { int i; } *0;
    2430
    2531// Cforall style
     
    3440static const * int x, 0;
    3541const * * int x, 0;
     42
     43int main() {
     44    int 1, * 0;
     45    * int x, 0;
     46}
  • src/Tests/SynTree/DeclarationSpecifier.c

    r81419b5 r0b2961f  
    1111const short volatile int static x7;
    1212short int volatile static const x8;
     13static short int volatile static const x9;              // duplicate static
    1314
    1415const volatile struct { int i; } x10;
     
    2021struct { int i; } const static volatile x16;
    2122struct { int i; } const volatile static x17;
     23struct { int i; } const static volatile static x18;     // duplicate static
     24struct { int i; } const static volatile static volatile x19; // duplicate static & volatile
    2225
    2326const Int volatile x20;
     
    2932const volatile Int static x26;
    3033Int volatile static const x27;
     34static Int volatile static const x28;                   // duplicate static
    3135
    3236const volatile struct { Int i; } x29;
  • src/Tests/SynTree/Forall.c

    r81419b5 r0b2961f  
    99
    1010context sumable( type T ) {
    11     const T 0;
    12     T ?+?(T, T);
    13     T ?++(T);
    14     [T] ?+=?(T,T);
     11        const T 0;
     12        T ?+?(T, T);
     13        T ?++(T);
     14        [T] ?+=?(T,T);
    1515};
    1616
     
    3232        int i;
    3333        for ( i = 0; i < n; i += 1 )
    34             total = total + a[i];
     34                total = total + a[i];
    3535        return total;
    3636}
     
    4141}
    4242
     43forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
     44T min( T t1, T t2 ) {
     45        return t1 < t2 ? t1 : t2;
     46}
     47
    4348int main() {
    44     int x = 1, y = 2, a[10];
    45     float f;
     49        int x = 1, y = 2, a[10];
     50        float f;
    4651
    47     swap( x, y );
    48     twice( x, y );
    49     f = min( 4.0, 3.0 );
    50     sum( 10, a );
     52        swap( x, y );
     53        twice( x );
     54        f = min( 4.0, 3.0 );
     55        sum( 10, a );
    5156}
    5257
  • src/Tests/SynTree/Functions.c

    r81419b5 r0b2961f  
    152152typedef int T;
    153153
    154 int f( T (T), T T ) {
     154int f( T (*f), T t ) {
    155155        T (T);
    156156}
  • src/Tests/SynTree/Initialization.c

    r81419b5 r0b2961f  
    11// Cforall extensions
    22
    3 int * x21 = 0, x22 = 0;
     3int * x11 = 0, x12 = 0;
    44int * x21 = 0, x22 = 0;
    55
     
    2727};
    2828
     29struct point { int x; int z; struct {int y1, y2, y3;} y; int w;};
     30struct quintet { int v, w, x, y, z;};
     31
     32int 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
    2939// Local Variables: //
    3040// tab-width: 4 //
  • src/Tests/SynTree/Scope.c

    r81419b5 r0b2961f  
    77y q;
    88
    9 y w(y y, u v) {
     9y w( y y, u v ) {
    1010        type x | { x t(u); };
    1111        u u = y;
     
    1515y p;
    1616
    17 context has_u( type z )
    18 {
     17context has_u( type z ) {
    1918        z u(z);
    2019};
    2120
    2221forall( type t | has_u( t ) )
    23 y q( t the_t )
    24 {
     22y q( t the_t ) {
    2523        t y = u( the_t );
    2624}
     
    2927        int y;
    3028        typedef char x;
    31 
    3229        {
    3330                x y;
    3431                typedef x z;
    35 
    3632                {
    3733                        z x;
     
    3935                        y z = x;
    4036                }
    41 
    4237                z x = y;
    4338        }
    44 
    4539        x q = y;
    4640}
     
    5650}
    5751
    58 y q( i )
    59     int i;
     52y q( i )                                                                                                /* K&R style */
     53        int i;
    6054{
    6155        switch ( i ) {
  • src/Tests/SynTree/Tuple.c

    r81419b5 r0b2961f  
    11int f( int, int );
    22int g( int, int, int );
    3 static [ int, int, int, int ] h( int a, int b, * int c, [] char d );
     3static [ int, int *, * int, int ] h( int a, int b, * int c, [] char d );
    44
    55struct inner {
     
    3030
    3131        [ x, y, z ] = [ p, f( 17 ), 3 ];
     32        [ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17 ), 3 ]);
    3233        r = [ x, y, z ];
    3334}
     
    4041        f( t1 );
    4142        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 ];
    4843
    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 ];
    5659
    5760        s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
    5861        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 ] );
    6165        rc = 0;
    6266}
  • src/Tests/SynTree/TypeGenerator.c

    r81419b5 r0b2961f  
    99[int] h( * List(int) p ); // new declaration syntax
    1010
    11 struct(type T | addable(T) ) node { T data; struct(T) node *next; };
     11struct(type T) S1;                      // forward definition
     12struct(type T) S1 { T i; };             // actual definition
     13struct(int) S1 v1, *p;                  // expansion and instantiation
     14struct(type T)(int) S2 { T i; } v2;     // actual definition, expansion and instantiation
     15struct(type T)(int) { T i; } v2;        // anonymous actual definition, expansion and instantiation
     16
     17struct( type T | addable(T) ) node { T data; struct(T) node *next; };
    1218type List(type T) = struct(T) node *;
    1319List(int) my_list;
  • src/Tests/SynTree/Typedef.c

    r81419b5 r0b2961f  
    22
    33void f( void ) {
    4         int T( T );
    5         T( 3 );
     4    int T( T );
     5    T( 3 );
    66}
    77
    88struct {
    9         T (T);
     9    T (T);
    1010} fred = { 3 };
    1111
     
    1414
    1515int g(void) {
    16         double a;
     16    double a;
    1717}
    1818a c;
    1919
    20 // typedef x = 3, y = 3;  /* GCC */
     20typedef typeof(3) x, y;  // GCC
    2121
    22 // x p;
    23 // y q;
     22x p;
     23y q;
    2424
    2525int main() {
    26 //    typedef z = p = 3;
     26    typedef typeof(3) z, p;
     27    z w;
     28    p x;
    2729}
    2830
     
    3032
    3133typedef [10] * int arrayOf10Pointers;
    32 arrayOf10Pointers x;
     34arrayOf10Pointers array;
    3335typedef const * int constantPointer;
    3436typedef * [ int ]( [] int ) funcPtr;
  • src/Tests/SynTree/VariableDeclarator.c

    r81419b5 r0b2961f  
    4040int * const * const (f34[10]);
    4141
    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]);
     42int (*f35)[];
     43int (*f36)[10];
     44int (**f37)[];
     45int (**f38)[10];
     46int (* const *f39)[];
     47int (* const *f40)[10];
     48int (* const * const f41)[];
     49int (* const * const f42)[10];
    5050
    5151int f43[][3];
     
    108108// Cforall extensions
    109109
    110 * [20] double z;
    111 [20] * char w;
     110* int cf3;
     111* * int cf4;
     112* const * int cf5;
     113const * const * int cf6;
     114
     115[] int cf15;
     116[10] int cf16;
     117
     118[] * int cf19;
     119[10] * int cf20;
     120int **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;
     133const * const * [] int cf41;
     134const * 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);
    112155
    113156// function pointer
Note: See TracChangeset for help on using the changeset viewer.