Changeset 7ff30d07 for src/tests


Ignore:
Timestamp:
Jun 14, 2016, 1:23:18 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, with_gc
Children:
545ef59, c738ca4, ee51534
Parents:
6cbc25a (diff), c8c03683 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Conflicts:

Makefile.in
aclocal.m4
configure
src/Makefile.in
src/Tests/Context.c
src/driver/Makefile.in
src/examples/Makefile.in
src/examples/ctxts.c
src/examples/esskaykay.c
src/libcfa/Makefile.in

Location:
src/tests
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/tests/Array.c

    r6cbc25a r7ff30d07  
    11//Testing array declarations
    22int a1[];
    3 int a2[*];
    4 double a4[3.0];
     3//int a2[*];
     4//double a4[3.0];
    55
    66int m1[][3];
    7 int m2[*][*];
     7//int m2[*][*];
    88int m4[3][3];
    99
     
    1111
    1212int fred() {
    13         int a1[];
    14         int a2[*];
     13//      int a1[];
     14//      int a2[*];
    1515        int a4[3];
    1616        int T[3];
  • src/tests/Forall.c

    r6cbc25a r7ff30d07  
    77
    88void g1() {
    9         forall( type T ) T f( T );
     9        forall( otype T ) T f( T );
    1010        void f( int );
    1111        void h( void (*p)(void) );
     
    2424
    2525void g2() {
    26         forall( type T ) void f( T, T );
    27         forall( type T, type U ) void f( T, U );
     26        forall( otype T ) void f( T, T );
     27        forall( otype T, otype U ) void f( T, U );
    2828 
    2929        int x;
     
    3737}
    3838
    39 typedef forall ( type T ) int (*f)( int );
     39typedef forall ( otype T ) int (*f)( int );
    4040
    41 forall( type T )
     41forall( otype T )
    4242void swap( T left, T right ) {
    4343        T temp = left;
     
    4646}
    4747
    48 context sumable( type T ) {
     48context sumable( otype T ) {
    4949        const T 0;
    5050        T ?+?(T, T);
     
    5353};
    5454
    55 type T1 | { const T1 0; T1 ?+?(T1, T1); T1 ?++(T1); [T1] ?+=?(T1,T1); },
    56         T2(type P1, type P2 ),
     55otype T1 | { const T1 0; T1 ?+?(T1, T1); T1 ?++(T1); [T1] ?+=?(T1,T1); },
     56        T2(otype P1, otype P2 ),
    5757        T3 | sumable(T3);
    5858
    59 type T2(type P1, type P2) | sumable(T2(P1,P2)) = struct { P1 i; P2 j; };
     59otype T2(otype P1, otype P2) | sumable(T2(P1,P2)) = struct { P1 i; P2 j; };
    6060
    6161T2(int, int) w1;
    6262typedef T2(int, int) w2;
    6363w2 g2;
    64 type w3 = T2(int, int);
     64otype w3 = T2(int, int);
    6565w3 g3;
    6666
    67 forall( type T | sumable( T ) )
     67forall( otype T | sumable( T ) )
    6868T sum( int n, T a[] ) {
    6969        T total = 0;
     
    7474}
    7575
    76 forall( type T | { const T 0; T ?+?(T, T); T ?++(T); [T] ?+=?(T,T); } )
     76forall( otype T | { const T 0; T ?+?(T, T); T ?++(T); [T] ?+=?(T,T); } )
    7777T twice( T t ) {
    7878        return t + t;
    7979}
    8080
    81 forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
     81forall( otype T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
    8282T min( T t1, T t2 ) {
    8383        return t1 < t2 ? t1 : t2;
  • src/tests/Functions.c

    r6cbc25a r7ff30d07  
    2828int ((*f12())[])[3] {}
    2929
    30 // "implicit int" type specifier (not ANSI)
     30// "implicit int" otype specifier (not ANSI)
    3131
    3232fII1( int i ) {}
  • src/tests/GccExtensions.c

    r6cbc25a r7ff30d07  
    1919    __signed s2;
    2020
    21     __typeof(s1) t1;
    22     __typeof__(s1) t2;
     21    __otypeof(s1) t1;
     22    __otypeof__(s1) t2;
    2323
    2424    __volatile int v1;
  • src/tests/Scope.c

    r6cbc25a r7ff30d07  
    33typedef float t;
    44y z;
    5 type u = struct { int a; double b; };
     5otype u = struct { int a; double b; };
    66int f( int y );
    77y q;
    88
    99y w( y y, u v ) {
    10         type x | { x t(u); };
     10        otype x | { x t(u); };
    1111        u u = y;
    1212        x z = t(u);
     
    1515y p;
    1616
    17 context has_u( type z ) {
     17context has_u( otype z ) {
    1818        z u(z);
    1919};
    2020
    21 forall( type t | has_u( t ) )
     21forall( otype t | has_u( t ) )
    2222y q( t the_t ) {
    2323        t y = u( the_t );
  • src/tests/Subrange.c

    r6cbc25a r7ff30d07  
    1 // A small context defining the notion of an ordered type.  (The standard
     1// A small context defining the notion of an ordered otype.  (The standard
    22// library should probably contain a context for this purpose.)
    3 context ordered(type T) {
     3context ordered(otype T) {
    44    int ?<?(T, T), ?<=?(T, T);
    55};
    66
    7 // A subrange type resembling an Ada subtype with a base type and a range
     7// A subrange otype resembling an Ada subotype with a base otype and a range
    88// constraint.
    9 type subrange(type base_t | ordered(base_t), base_t low = 0, base_t high = 8) = base_t;
     9otype subrange(otype base_t | ordered(base_t), base_t low = 0, base_t high = 8) = base_t;
    1010
    11 // Note that subrange() can be applied to floating-point and pointer types, not
    12 // just integral types.
    13 //   This requires a "type generator" extension to Cforall.  Type generators
    14 // must accept type and non-type parameters, which is beyond what we discussed
     11// Note that subrange() can be applied to floating-point and pointer otypes, not
     12// just integral otypes.
     13//   This requires a "otype generator" extension to Cforall.  Type generators
     14// must accept otype and non-otype parameters, which is beyond what we discussed
    1515// previously.  Type parameters must be usable in the declaration of
    1616// subsequent parameters: parameter T is used to declare parameters "low"
     
    2222subrange(int, 0, (rand() & 0xF) ) foo;
    2323
    24 // What sorts of expressions can be used as arguments of type generators?  Is
     24// What sorts of expressions can be used as arguments of otype generators?  Is
    2525// "subrange(int, 0, rand() & 0xF)" legal?  Probably.  The nearest C equivalent
    2626// to the "low" and "high" arguments is the array size in a variable-length
     
    2828
    2929// Convenient access to subrange bounds, for instance for iteration:
    30 forall (type T, T low, T high)
     30forall (otype T, T low, T high)
    3131T lbound( subrange(T, low, high) v) {
    3232    return low;
    3333}
    3434
    35 forall (type T, T low, T high)
     35forall (otype T, T low, T high)
    3636T hbound( subrange(T, low, high) v) {
    3737    return high;
     
    4141unsigned lday = lbound(day_of_month);
    4242
    43 // Assignment from the base type, with bounds checking.  I'll ignore the issue
     43// Assignment from the base otype, with bounds checking.  I'll ignore the issue
    4444// of exception handling here.  Inlining allows the compiler to eliminate
    4545// bounds checks.
    46 forall (type T | ordered(T), T low, T high)
     46forall (otype T | ordered(T), T low, T high)
    4747inline subrange(T, low, high) ?=?(subrange(T, low, high)* target, T source) {
    4848    if (low <= source && source <= high) *((T*)target) = source;
     
    5151}
    5252
    53 // Assignment between subranges with a common base type.  The bounds check
     53// Assignment between subranges with a common base otype.  The bounds check
    5454// compares range bounds so that the compiler can optimize checks away when the
    5555// ranges are known to overlap.
    56 forall (type T | ordered(T), T t_low, T t_high, T s_low, T s_high)
     56forall (otype T | ordered(T), T t_low, T t_high, T s_low, T s_high)
    5757inline subrange(T, t_low, t_high) ?=?(subrange(T, t_low, t_high)* target,
    5858                                      subrange(T, s_low, s_high) source) {
  • src/tests/TypeGenerator.c

    r6cbc25a r7ff30d07  
    1 context addable( type T ) {
     1context addable( otype T ) {
    22        T ?+?( T,T );
    33        T ?=?( T*, T);
    44};
    55
    6 type List1( type T | addable( T ) ) = struct { T data; List1( T ) *next; } *;
     6otype List1( otype T | addable( T ) ) = struct { T data; List1( T ) *next; } *;
    77typedef List1( int ) ListOfIntegers;
    88//List1( int ) li;
     
    1111[int] h( * List1( int ) p );                                                    // new declaration syntax
    1212
    13 struct( type T ) S2 { T i; };                                                   // actual definition
     13struct( otype T ) S2 { T i; };                                                  // actual definition
    1414struct( int ) S3 v1, *p;                                                                // expansion and instantiation
    15 struct( type T )( int ) S24 { T i; } v2;                                // actual definition, expansion and instantiation
    16 struct( type T )( int ) { T i; } v2;                                    // anonymous actual definition, expansion and instantiation
     15struct( otype T )( int ) S24 { T i; } v2;                               // actual definition, expansion and instantiation
     16struct( otype T )( int ) { T i; } v2;                                   // anonymous actual definition, expansion and instantiation
    1717
    18 struct( type T | addable( T ) ) node { T data; struct( T ) node *next; };
    19 type List( type T ) = struct( T ) node *;
     18struct( otype T | addable( T ) ) node { T data; struct( T ) node *next; };
     19otype List( otype T ) = struct( T ) node *;
    2020List( int ) my_list;
    2121
    22 type Complex | addable( Complex );
     22otype Complex | addable( Complex );
    2323
    2424int main() {
  • src/tests/Typedef.c

    r6cbc25a r7ff30d07  
    1818a c;
    1919
    20 typedef typeof(3) x, y;  // GCC
     20typedef otypeof(3) x, y;  // GCC
    2121
    2222x p;
     
    2424
    2525int main() {
    26     typedef typeof(3) z, p;
     26    typedef otypeof(3) z, p;
    2727    z w;
    2828    p x;
  • src/tests/Typeof.c

    r6cbc25a r7ff30d07  
    11int main() {
    22    int *v1;
    3     typeof(v1) v2;
    4     typeof(*v1) v3[4];
     3    otypeof(v1) v2;
     4    otypeof(*v1) v3[4];
    55    char *v4[4];
    6     typeof(typeof(char *)[4]) v5;
    7     typeof (int *) v6;
    8     typeof( int ( int, int p ) ) *v7;
    9     typeof( [int] ( int, int p ) ) *v8;
     6    otypeof(otypeof(char *)[4]) v5;
     7    otypeof (int *) v6;
     8    otypeof( int ( int, int p ) ) *v7;
     9    otypeof( [int] ( int, int p ) ) *v8;
    1010}
  • src/tests/io.c

    r6cbc25a r7ff30d07  
    1111// Created On       : Wed Mar  2 16:56:02 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu May 26 10:06:00 2016
    14 // Update Count     : 28
     13// Last Modified On : Wed Jun  8 22:52:04 2016
     14// Update Count     : 30
    1515//
    1616
     
    3434        long double _Complex ldc;
    3535        char s1[10], s2[10];
     36
     37        int x = 3, y = 5, z = 7;
     38        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
     39        sout | 1 | 2 | 3 | endl;
     40        sout | '1' | '2' | '3' | endl;
     41        sout | 1 | "" | 2 | "" | 3 | endl;
     42        sout | endl;
    3643
    3744        ifstream in;                                                                                            // create / open file
Note: See TracChangeset for help on using the changeset viewer.