Changeset cdbfab0
- Timestamp:
- Nov 17, 2017, 4:57:57 PM (7 years ago)
- 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:
- 4d5e57b
- Parents:
- 0fe4e62
- Location:
- src
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel
r0fe4e62 rcdbfab0 120 120 #ifdef __CFA_DEBUG__ 121 121 // Last function to enable preemption on this processor 122 c har * last_enable;122 const char * last_enable; 123 123 #endif 124 124 }; -
src/libcfa/concurrency/monitor.c
r0fe4e62 rcdbfab0 823 823 this.monitor_count = thrd->monitors.size; 824 824 825 this.monitors = malloc( this.monitor_count * sizeof( *this.monitors ) );825 this.monitors = (monitor_desc **)malloc( this.monitor_count * sizeof( *this.monitors ) ); 826 826 for( int i = 0; i < this.monitor_count; i++ ) { 827 827 this.monitors[i] = thrd->monitors.list[i]; -
src/libcfa/stdhdr/stddef.h
r0fe4e62 rcdbfab0 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // stddef.h -- 8 // 6 // 7 // stddef.h -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Jul 4 23:25:26 2016 … … 12 12 // Last Modified On : Tue Jul 5 20:40:01 2016 13 13 // Update Count : 12 14 // 14 // 15 15 16 16 extern "C" { 17 #include_next <stddef.h> // has internal check for multiple expansion 17 #include_next <stddef.h> // has internal check for multiple expansion 18 #undef NULL 19 #define NULL 0 // define NULL as 0 rather than (void*)0 to take advantage of zero_t 18 20 } // extern "C" 19 21 -
src/libcfa/stdlib
r0fe4e62 rcdbfab0 77 77 //printf( "X8\n" ); 78 78 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 79 return memset( ptr, (int)fill, sizeof(T) ); // initial with fill value79 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initial with fill value 80 80 } // alloc 81 81 … … 87 87 //printf( "X10\n" ); 88 88 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 89 return memset( ptr, (int)fill, dim * sizeof(T) );89 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); 90 90 } // alloc 91 91 92 92 static inline forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim ) { 93 93 //printf( "X11\n" ); 94 return ( void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc94 return (T *)(void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc 95 95 } // alloc 96 96 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ); … … 103 103 //printf( "X14\n" ); 104 104 T * ptr = (T *)memalign( align, sizeof(T) ); 105 return memset( ptr, (int)fill, sizeof(T) );105 return (T *)memset( ptr, (int)fill, sizeof(T) ); 106 106 } // align_alloc 107 107 … … 113 113 //printf( "X16\n" ); 114 114 T * ptr = (T *)memalign( align, dim * sizeof(T) ); 115 return memset( ptr, (int)fill, dim * sizeof(T) );115 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); 116 116 } // align_alloc 117 117 … … 120 120 static inline forall( dtype T | sized(T) ) T * memset( T * dest, char c ) { 121 121 //printf( "X17\n" ); 122 return memset( dest, c, sizeof(T) );122 return (T *)memset( dest, c, sizeof(T) ); 123 123 } // memset 124 124 extern "C" { void * memcpy( void * dest, const void * src, size_t size ); } // use default C routine for void * 125 125 static inline forall( dtype T | sized(T) ) T * memcpy( T * dest, const T * src ) { 126 126 //printf( "X18\n" ); 127 return memcpy( dest, src, sizeof(T) );127 return (T *)memcpy( dest, src, sizeof(T) ); 128 128 } // memcpy 129 129 … … 131 131 static inline forall( dtype T | sized(T) ) T * memset( T dest[], size_t dim, char c ) { 132 132 //printf( "X19\n" ); 133 return ( void *)memset( dest, c, dim * sizeof(T) ); // C memset133 return (T *)(void *)memset( dest, c, dim * sizeof(T) ); // C memset 134 134 } // memset 135 135 static inline forall( dtype T | sized(T) ) T * memcpy( T dest[], const T src[], size_t dim ) { 136 136 //printf( "X20\n" ); 137 return ( void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy137 return (T *)(void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy 138 138 } // memcpy 139 139 -
src/prelude/prelude.cf
r0fe4e62 rcdbfab0 403 403 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile &, const volatile DT * ); 404 404 405 forall( dtype DT ) DT * ?=?( DT * &, void * );406 forall( dtype DT ) DT * ?=?( DT * volatile &, void * );407 forall( dtype DT ) const DT * ?=?( const DT * &, void * );408 forall( dtype DT ) const DT * ?=?( const DT * volatile &, void * );409 forall( dtype DT ) const DT * ?=?( const DT * &, const void * );410 forall( dtype DT ) const DT * ?=?( const DT * volatile &, const void * );411 forall( dtype DT ) volatile DT * ?=?( volatile DT * &, void * );412 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile &, void * );413 forall( dtype DT ) volatile DT * ?=?( volatile DT * &, volatile void * );414 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile &, volatile void * );415 416 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * &, void * );417 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile &, void * );418 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * &, const void * );419 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile &, const void * );420 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * &, volatile void * );421 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile &, volatile void * );422 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * &, const volatile void * );423 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile &, const volatile void * );424 425 405 forall( dtype DT ) void * ?=?( void * &, DT * ); 426 406 forall( dtype DT ) void * ?=?( void * volatile &, DT * ); … … 441 421 forall( dtype DT ) const volatile void * ?=?( const volatile void * &, const volatile DT * ); 442 422 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const volatile DT * ); 443 444 void * ?=?( void * &, void * );445 void * ?=?( void * volatile &, void * );446 const void * ?=?( const void * &, void * );447 const void * ?=?( const void * volatile &, void * );448 const void * ?=?( const void * &, const void * );449 const void * ?=?( const void * volatile &, const void * );450 volatile void * ?=?( volatile void * &, void * );451 volatile void * ?=?( volatile void * volatile &, void * );452 volatile void * ?=?( volatile void * &, volatile void * );453 volatile void * ?=?( volatile void * volatile &, volatile void * );454 const volatile void * ?=?( const volatile void * &, void * );455 const volatile void * ?=?( const volatile void * volatile &, void * );456 const volatile void * ?=?( const volatile void * &, const void * );457 const volatile void * ?=?( const volatile void * volatile &, const void * );458 const volatile void * ?=?( const volatile void * &, volatile void * );459 const volatile void * ?=?( const volatile void * volatile &, volatile void * );460 const volatile void * ?=?( const volatile void * &, const volatile void * );461 const volatile void * ?=?( const volatile void * volatile &, const volatile void * );462 423 463 424 //forall( dtype DT ) DT * ?=?( DT * &, zero_t ); … … 781 742 forall( dtype DT ) void ?{}( const volatile DT * &, const volatile DT * ); 782 743 783 forall( dtype DT ) void ?{}( DT * &, void * );784 forall( dtype DT ) void ?{}( const DT * &, void * );785 forall( dtype DT ) void ?{}( const DT * &, const void * );786 forall( dtype DT ) void ?{}( volatile DT * &, void * );787 forall( dtype DT ) void ?{}( volatile DT * &, volatile void * );788 789 forall( dtype DT ) void ?{}( const volatile DT * &, void * );790 forall( dtype DT ) void ?{}( const volatile DT * &, const void * );791 forall( dtype DT ) void ?{}( const volatile DT * &, volatile void * );792 forall( dtype DT ) void ?{}( const volatile DT * &, const volatile void * );793 794 744 forall( dtype DT ) void ?{}( void * &, DT * ); 795 745 forall( dtype DT ) void ?{}( const void * &, DT * ); … … 802 752 forall( dtype DT ) void ?{}( const volatile void * &, const volatile DT * ); 803 753 804 void ?{}( void * &, void * );805 void ?{}( const void * &, void * );806 void ?{}( const void * &, const void * );807 void ?{}( volatile void * &, void * );808 void ?{}( volatile void * &, volatile void * );809 void ?{}( const volatile void * &, void * );810 void ?{}( const volatile void * &, const void * );811 void ?{}( const volatile void * &, volatile void * );812 void ?{}( const volatile void * &, const volatile void * );813 814 754 //forall( dtype DT ) void ?{}( DT * &, zero_t ); 815 755 //forall( dtype DT ) void ?{}( DT * volatile &, zero_t ); -
src/tests/Makefile.am
r0fe4e62 rcdbfab0 141 141 typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@ 142 142 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 143 144 alloc-ERROR: alloc.c @CFA_BINDIR@/@CFA_NAME@ 145 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} -
src/tests/Makefile.in
r0fe4e62 rcdbfab0 895 895 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 896 896 897 alloc-ERROR: alloc.c @CFA_BINDIR@/@CFA_NAME@ 898 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 899 897 900 # Tell versions [3.59,3.63) of GNU make to not export all variables. 898 901 # Otherwise a system limit (for SysV at least) may be exceeded. -
src/tests/alloc.c
r0fe4e62 rcdbfab0 32 32 // allocation, non-array types 33 33 34 p = ( void *)malloc( sizeof(*p) ); // C malloc, type unsafe34 p = (int *)(void *)malloc( sizeof(*p) ); // C malloc, type unsafe 35 35 *p = 0xdeadbeef; 36 36 printf( "C malloc %#x\n", *p ); … … 54 54 printf( "\n" ); 55 55 56 p = calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe56 p = (int *)calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe 57 57 printf( "C array calloc, fill 0\n" ); 58 58 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } … … 83 83 printf( "\n" ); 84 84 85 p = ( void *)realloc( p, dim * sizeof(*p) ); // C realloc85 p = (int *)(void *)realloc( p, dim * sizeof(*p) ); // C realloc 86 86 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; } 87 87 printf( "C realloc\n" ); … … 256 256 stp = malloc(); 257 257 printf( "\nSHOULD FAIL\n" ); 258 #ifdef ERR1 258 259 p = alloc( stp, dim * sizeof(*stp) ); 259 260 p = memset( stp, 10 ); 260 261 p = memcpy( &st1, &st ); 262 #endif 261 263 } // main 262 264 -
src/tests/dtor-early-exit.c
r0fe4e62 rcdbfab0 22 22 23 23 struct A { 24 c har * name;24 const char * name; 25 25 int * x; 26 26 }; -
src/tests/init_once.c
r0fe4e62 rcdbfab0 72 72 insert( &constructed, &x ); 73 73 74 x.x = malloc(sizeof(int));74 x.x = (int *)malloc(sizeof(int)); 75 75 } 76 76 -
src/tests/multiDimension.c
r0fe4e62 rcdbfab0 7 7 printf("default constructing\n"); 8 8 (this.a){ 123 }; 9 this.ptr = malloc(sizeof(int));9 this.ptr = (int *)malloc(sizeof(int)); 10 10 } 11 11 … … 13 13 printf("copy constructing\n"); 14 14 (this.a){ other.a }; 15 this.ptr = malloc(sizeof(int));15 this.ptr = (int *)malloc(sizeof(int)); 16 16 } 17 17 … … 19 19 printf("constructing with %d\n", a); 20 20 (this.a){ a }; 21 this.ptr = malloc(sizeof(int));21 this.ptr = (int *)malloc(sizeof(int)); 22 22 } 23 23 -
src/tests/tupleVariadic.c
r0fe4e62 rcdbfab0 73 73 [a0, a1, a2, a3] = args; 74 74 a.size = 4; 75 a.data = malloc(sizeof(int)*a.size);75 a.data = (int *)malloc(sizeof(int)*a.size); 76 76 a.data[0] = a0; 77 77 a.data[1] = a1; -
src/tests/vector/vector_int.c
r0fe4e62 rcdbfab0 27 27 vec.last = -1; 28 28 vec.capacity = reserve; 29 vec.data = malloc( sizeof( int ) * reserve );29 vec.data = (int *)malloc( sizeof( int ) * reserve ); 30 30 } 31 31 … … 33 33 vec.last = other.last; 34 34 vec.capacity = other.capacity; 35 vec.data = malloc( sizeof( int ) * other.capacity );35 vec.data = (int *)malloc( sizeof( int ) * other.capacity ); 36 36 for (int i = 0; i < vec.last; i++) { 37 37 vec.data[i] = other.data[i]; … … 45 45 void reserve( vector_int *vec, int reserve ) { 46 46 if ( reserve > vec->capacity ) { 47 vec->data = realloc( vec->data, sizeof( int ) * reserve );47 vec->data = (int *)realloc( vec->data, sizeof( int ) * reserve ); 48 48 vec->capacity = reserve; 49 49 } … … 54 54 if ( vec->last == vec->capacity ) { 55 55 vec->capacity *= 2; 56 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity );56 vec->data = (int *)realloc( vec->data, sizeof( int ) * vec->capacity ); 57 57 } 58 58 vec->data[ vec->last ] = element;
Note: See TracChangeset
for help on using the changeset viewer.