Changeset 1ba5803 for src/tests


Ignore:
Timestamp:
Nov 22, 2017, 5:06:06 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8dceeb7
Parents:
f203a7a (diff), 4d5e57b (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 'fix-bug-51'

Location:
src/tests
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/completeTypeError.txt

    rf203a7a r1ba5803  
    1 completeTypeError.c:34:1 error: No reasonable alternatives for expression Applying untyped:
     1completeTypeError.c:33:1 error: No reasonable alternatives for expression Applying untyped:
    22  Name: *?
    33...to:
    44  Name: v
    55
     6completeTypeError.c:34:1 error: No reasonable alternatives for expression Applying untyped:
     7  Name: *?
     8...to:
     9  Name: y
     10
     11completeTypeError.c:35:1 error: No reasonable alternatives for expression Applying untyped:
     12  Name: foo
     13...to:
     14  Name: v
    615
    716completeTypeError.c:36:1 error: No reasonable alternatives for expression Applying untyped:
     
    1019  Name: v
    1120
    12 
    1321completeTypeError.c:37:1 error: No reasonable alternatives for expression Applying untyped:
    1422  Name: quux
    1523...to:
    1624  Name: v
    17 
    1825
    1926completeTypeError.c:58:1 error: No reasonable alternatives for expression Applying untyped:
     
    2229  Name: y
    2330
    24 
    2531completeTypeError.c:59:1 error: No reasonable alternatives for expression Applying untyped:
    2632  Name: quux
    2733...to:
    2834  Name: y
    29 
    3035
    3136completeTypeError.c:60:1 error: No reasonable alternatives for expression Applying untyped:
     
    3439  Name: y
    3540
    36 
    3741completeTypeError.c:72:1 error: No reasonable alternatives for expression Applying untyped:
    3842  Name: baz
     
    4044  Name: z
    4145
    42 
  • src/tests/Makefile.am

    rf203a7a r1ba5803  
    141141typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@
    142142        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     143
     144alloc-ERROR: alloc.c @CFA_BINDIR@/@CFA_NAME@
     145        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    rf203a7a r1ba5803  
    895895        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    896896
     897alloc-ERROR: alloc.c @CFA_BINDIR@/@CFA_NAME@
     898        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     899
    897900# Tell versions [3.59,3.63) of GNU make to not export all variables.
    898901# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/tests/alloc.c

    rf203a7a r1ba5803  
    3232        // allocation, non-array types
    3333
    34         p = (void *)malloc( sizeof(*p) );                   // C malloc, type unsafe
     34        p = (int *)(void *)malloc( sizeof(*p) );                   // C malloc, type unsafe
    3535        *p = 0xdeadbeef;
    3636        printf( "C   malloc %#x\n", *p );
     
    5454        printf( "\n" );
    5555
    56         p = calloc( dim, sizeof( *p ) );                    // C array calloc, type unsafe
     56        p = (int *)calloc( dim, sizeof( *p ) );                    // C array calloc, type unsafe
    5757        printf( "C   array calloc, fill 0\n" );
    5858        for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); }
     
    8383        printf( "\n" );
    8484
    85         p = (void *)realloc( p, dim * sizeof(*p) );         // C realloc
     85        p = (int *)(void *)realloc( p, dim * sizeof(*p) );         // C realloc
    8686        for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; }
    8787        printf( "C   realloc\n" );
     
    256256        stp = malloc();
    257257        printf( "\nSHOULD FAIL\n" );
     258#ifdef ERR1
    258259        p = alloc( stp, dim * sizeof(*stp) );
    259260        p = memset( stp, 10 );
    260261        p = memcpy( &st1, &st );
     262#endif
    261263} // main
    262264
  • src/tests/completeTypeError.c

    rf203a7a r1ba5803  
    1212        void *v;
    1313
    14         // A * x;
    15         // A * y;
    16         // B * x;
    17         // B * z;
     14        A * x;
     15        A * y;
     16        B * x;
     17        B * z;
    1818
    1919        // okay
    2020        *i;
    21         // *x; // picks B
    22         // *z;
     21        *x; // picks B
     22        *z;
    2323        foo(i);
    2424        bar(i);
     
    2929        bar(v);
    3030        qux(v);
    31         foo(v); // questionable, but works at the moment for C compatibility
    3231
    3332        // bad
    3433        *v;
    35         // *y;
     34        *y;
     35        foo(v);
    3636        baz(v);
    3737        quux(v);
  • src/tests/dtor-early-exit.c

    rf203a7a r1ba5803  
    2222
    2323struct A {
    24         char * name;
     24        const char * name;
    2525        int * x;
    2626};
  • src/tests/init_once.c

    rf203a7a r1ba5803  
    7272        insert( &constructed, &x );
    7373
    74         x.x = malloc(sizeof(int));
     74        x.x = (int *)malloc(sizeof(int));
    7575}
    7676
  • src/tests/multiDimension.c

    rf203a7a r1ba5803  
    77  printf("default constructing\n");
    88  (this.a){ 123 };
    9   this.ptr = malloc(sizeof(int));
     9  this.ptr = (int *)malloc(sizeof(int));
    1010}
    1111
     
    1313  printf("copy constructing\n");
    1414  (this.a){ other.a };
    15   this.ptr = malloc(sizeof(int));
     15  this.ptr = (int *)malloc(sizeof(int));
    1616}
    1717
     
    1919  printf("constructing with %d\n", a);
    2020  (this.a){ a };
    21   this.ptr = malloc(sizeof(int));
     21  this.ptr = (int *)malloc(sizeof(int));
    2222}
    2323
  • src/tests/tupleVariadic.c

    rf203a7a r1ba5803  
    7373        [a0, a1, a2, a3] = args;
    7474        a.size = 4;
    75         a.data = malloc(sizeof(int)*a.size);
     75        a.data = (int *)malloc(sizeof(int)*a.size);
    7676        a.data[0] = a0;
    7777        a.data[1] = a1;
  • src/tests/vector/vector_int.c

    rf203a7a r1ba5803  
    2727        vec.last = -1;
    2828        vec.capacity = reserve;
    29         vec.data = malloc( sizeof( int ) * reserve );
     29        vec.data = (int *)malloc( sizeof( int ) * reserve );
    3030}
    3131
     
    3333        vec.last = other.last;
    3434        vec.capacity = other.capacity;
    35         vec.data = malloc( sizeof( int ) * other.capacity );
     35        vec.data = (int *)malloc( sizeof( int ) * other.capacity );
    3636        for (int i = 0; i < vec.last; i++) {
    3737                vec.data[i] = other.data[i];
     
    4545void reserve( vector_int *vec, int reserve ) {
    4646        if ( reserve > vec->capacity ) {
    47                 vec->data = realloc( vec->data, sizeof( int ) * reserve );
     47                vec->data = (int *)realloc( vec->data, sizeof( int ) * reserve );
    4848                vec->capacity = reserve;
    4949        }
     
    5454        if ( vec->last == vec->capacity ) {
    5555                vec->capacity *= 2;
    56                 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity );
     56                vec->data = (int *)realloc( vec->data, sizeof( int ) * vec->capacity );
    5757        }
    5858        vec->data[ vec->last ] = element;
Note: See TracChangeset for help on using the changeset viewer.