Changeset b81fd95
- Timestamp:
- Jul 29, 2020, 11:29:01 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0c760db
- Parents:
- 1d17939
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/locks.hfa
r1d17939 rb81fd95 130 130 pthread_mutex_init(&lock, &mattr); 131 131 132 pthread_cond_init (&cond, 0p);132 pthread_cond_init (&cond, (const pthread_condattr_t *)0p); // workaround trac#208: cast should not be required 133 133 val = 0; 134 134 } -
libcfa/src/concurrency/kernel.cfa
r1d17939 rb81fd95 1075 1075 1076 1076 void kernel_abort_msg( void * kernel_data, char * abort_text, int abort_text_size ) { 1077 $thread * thrd = kernel_data;1077 $thread * thrd = ( $thread * ) kernel_data; 1078 1078 1079 1079 if(thrd) { -
libcfa/src/concurrency/preemption.cfa
r1d17939 rb81fd95 481 481 sigset_t oldset; 482 482 int ret; 483 ret = pthread_sigmask(0, 0p, &oldset);483 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 484 484 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 485 485 -
libcfa/src/containers/list.hfa
r1d17939 rb81fd95 22 22 \ 23 23 static inline NODE& $tempcv_e2n(ELEM &node) { \ 24 return node; \24 return ( NODE & ) node; \ 25 25 } \ 26 26 \ … … 187 187 $next_link(singleton_to_insert) = $next_link(list_pos); 188 188 if ($next_link(list_pos).is_terminator) { 189 dlist(Tnode, Telem) *list = $next_link(list_pos).terminator;189 dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator; 190 190 $dlinks(Telem) *list_links = & list->$links; 191 191 $mgd_link(Telem) *list_last = & list_links->prev; … … 210 210 $prev_link(singleton_to_insert) = $prev_link(list_pos); 211 211 if ($prev_link(list_pos).is_terminator) { 212 dlist(Tnode, Telem) *list = $prev_link(list_pos).terminator;212 dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator; 213 213 $dlinks(Telem) *list_links = & list->$links; 214 214 $mgd_link(Telem) *list_first = & list_links->next; … … 275 275 276 276 if ( $prev_link(list_pos).is_terminator ) { 277 dlist(Tnode, Telem) * tgt_before = $prev_link(list_pos).terminator;277 dlist(Tnode, Telem) * tgt_before = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator; 278 278 $dlinks(Telem) * links_before = & tgt_before->$links; 279 279 &incoming_from_prev = & links_before->next; … … 285 285 286 286 if ( $next_link(list_pos).is_terminator ) { 287 dlist(Tnode, Telem) * tgt_after = $next_link(list_pos).terminator;287 dlist(Tnode, Telem) * tgt_after = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator; 288 288 $dlinks(Telem) * links_after = & tgt_after->$links; 289 289 &incoming_from_next = & links_after->prev; -
libcfa/src/iostream.hfa
r1d17939 rb81fd95 363 363 _Istream_Cstr excl( const char scanset[], char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : true } }; } 364 364 _Istream_Cstr & excl( const char scanset[], _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; } 365 _Istream_Cstr ignore( c onst char s[] ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; }365 _Istream_Cstr ignore( char s[] ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; } 366 366 _Istream_Cstr & ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; } 367 367 _Istream_Cstr wdi( unsigned int w, char s[] ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; } -
libcfa/src/stdlib.hfa
r1d17939 rb81fd95 232 232 size_t osize = malloc_size( ptr ); // current allocation 233 233 size_t nsize = dim * sizeof(T); // new allocation 234 T * nptr = realloc( ptr, align, nsize ); // CFA realloc234 T * nptr = alloc_align( ptr, align, nsize ); // CFA alloc_align 235 235 if ( nsize > osize ) { // larger ? 236 236 memset( (char *)nptr + osize, (int)fill, nsize - osize ); // initialize added storage … … 243 243 size_t nsize = dim * sizeof(T); // new allocation 244 244 size_t ndim = nsize / sizeof(T); // new dimension 245 T * nptr = realloc( ptr, align, nsize ); // CFA realloc245 T * nptr = alloc_align( ptr, align, nsize ); // CFA alloc_align 246 246 if ( ndim > odim ) { // larger ? 247 247 for ( i; odim ~ ndim ) { -
src/Concurrency/Keywords.cc
r1d17939 rb81fd95 510 510 new CastExpr( 511 511 new VariableExpr( func->get_functionType()->get_parameters().front() ), 512 func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone() 512 func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone(), 513 false 513 514 ) 514 515 ) … … 888 889 new SingleInit( new UntypedExpr( 889 890 new NameExpr( "get_monitor" ), 890 { new CastExpr( new VariableExpr( args.front() ), arg_type ) }891 { new CastExpr( new VariableExpr( args.front() ), arg_type, false ) } 891 892 )) 892 893 ); … … 909 910 { 910 911 new SingleInit( new AddressExpr( new VariableExpr( monitors ) ) ), 911 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )912 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone(), false ) ) 912 913 }, 913 914 noDesignators, … … 946 947 return new SingleInit( new UntypedExpr( 947 948 new NameExpr( "get_monitor" ), 948 { new CastExpr( new VariableExpr( var ), type ) }949 { new CastExpr( new VariableExpr( var ), type, false ) } 949 950 ) ); 950 951 }) … … 970 971 new SingleInit( new VariableExpr( monitors ) ), 971 972 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ), 972 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )973 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone(), false ) ) 973 974 }, 974 975 noDesignators, -
src/Concurrency/Waitfor.cc
r1d17939 rb81fd95 384 384 decl_monitor 385 385 ) 386 ) 386 ), 387 false 387 388 ); 388 389 … … 408 409 new CompoundStmt({ 409 410 makeAccStatement( acceptables, index, "is_dtor", detectIsDtor( clause.target.function ) , indexer ), 410 makeAccStatement( acceptables, index, "func" , new CastExpr( clause.target.function, fptr_t ), indexer ),411 makeAccStatement( acceptables, index, "func" , new CastExpr( clause.target.function, fptr_t, false ) , indexer ), 411 412 makeAccStatement( acceptables, index, "data" , new VariableExpr( monitors ) , indexer ), 412 413 makeAccStatement( acceptables, index, "size" , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ), … … 531 532 decl_mask 532 533 ) 533 ) 534 ), 535 false 534 536 ), 535 537 timeout -
src/Parser/ExpressionNode.cc
r1d17939 rb81fd95 427 427 if ( str[1] == '8' ) goto Default; // utf-8 characters => array of char 428 428 // lookup type of associated typedef 429 strtype = new TypeInstType( Type::Qualifiers( Type::Const), "char16_t", false );429 strtype = new TypeInstType( Type::Qualifiers( ), "char16_t", false ); 430 430 break; 431 431 case 'U': 432 strtype = new TypeInstType( Type::Qualifiers( Type::Const), "char32_t", false );432 strtype = new TypeInstType( Type::Qualifiers( ), "char32_t", false ); 433 433 break; 434 434 case 'L': 435 strtype = new TypeInstType( Type::Qualifiers( Type::Const), "wchar_t", false );435 strtype = new TypeInstType( Type::Qualifiers( ), "wchar_t", false ); 436 436 break; 437 437 Default: // char default string type 438 438 default: 439 strtype = new BasicType( Type::Qualifiers( Type::Const), BasicType::Char );439 strtype = new BasicType( Type::Qualifiers( ), BasicType::Char ); 440 440 } // switch 441 441 ArrayType * at = new ArrayType( noQualifiers, strtype, -
src/ResolvExpr/AlternativeFinder.cc
r1d17939 rb81fd95 1216 1216 unify( castExpr->result, alt.expr->result, alt.env, needAssertions, 1217 1217 haveAssertions, openVars, indexer ); 1218 Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), 1219 indexer, alt.env ); 1218 Cost thisCost = 1219 castExpr->isGenerated 1220 ? conversionCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), indexer, alt.env ) 1221 : castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), indexer, alt.env ); 1220 1222 PRINT( 1221 1223 std::cerr << "working on cast with result: " << castExpr->result << std::endl; … … 1698 1700 1699 1701 // unification run for side-effects 1700 unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer ); 1702 bool canUnify = unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer ); 1703 (void) canUnify; 1701 1704 // xxx - do some inspecting on this line... why isn't result bound to initAlt.type? 1702 1705 1703 Cost thisCost = c astCost( alt.expr->result, toType, alt.expr->get_lvalue(),1706 Cost thisCost = computeConversionCost( alt.expr->result, toType, alt.expr->get_lvalue(), 1704 1707 indexer, newEnv ); 1708 1709 PRINT( 1710 Cost legacyCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(), 1711 indexer, newEnv ); 1712 std::cerr << "Considering initialization:"; 1713 std::cerr << std::endl << " FROM: "; alt.expr->result->print(std::cerr); 1714 std::cerr << std::endl << " TO: "; toType ->print(std::cerr); 1715 std::cerr << std::endl << " Unification " << (canUnify ? "succeeded" : "failed"); 1716 std::cerr << std::endl << " Legacy cost " << legacyCost; 1717 std::cerr << std::endl << " New cost " << thisCost; 1718 std::cerr << std::endl; 1719 ) 1720 1705 1721 if ( thisCost != Cost::infinity ) { 1706 1722 // count one safe conversion for each value that is thrown away -
src/SynTree/Expression.h
r1d17939 rb81fd95 206 206 public: 207 207 Expression * arg; 208 bool isGenerated = true; // cast generated implicitly by code generation or explicit in program 208 209 // Inidicates cast is introduced by the CFA type system. 210 // true for casts that the resolver introduces to force a return type 211 // false for casts from user code 212 // false for casts from desugaring advanced CFA features into simpler CFA 213 // example 214 // int * p; // declaration 215 // (float *) p; // use, with subject cast 216 // subject cast isGenerated means we are considering an interpretation with a type mismatch 217 // subject cast not isGenerated means someone in charge wants it that way 218 bool isGenerated = true; 209 219 210 220 CastExpr( Expression * arg, bool isGenerated = true ); -
tests/avltree/avl1.cfa
r1d17939 rb81fd95 24 24 tree(K, V) * create(K key, V value) { 25 25 // infinite loop trying to resolve ... t = malloc(); 26 tree(K, V) * t = malloc(sizeof(tree(K,V)));26 tree(K, V) * t = ( tree(K, V) * ) malloc(sizeof(tree(K,V))); 27 27 (*t){ key, value }; 28 28 return t; -
tests/bugs/66.cfa
r1d17939 rb81fd95 5 5 6 6 int main() { 7 int * next = (void*)0;7 int * next = 0p; 8 8 if( next ) { 9 9 return 1; -
tests/concurrent/signal/block.cfa
r1d17939 rb81fd95 82 82 if( !is_empty( cond ) ) { 83 83 84 $thread * next = front( cond );84 $thread * next = ( $thread * ) front( cond ); 85 85 86 86 if( ! signal_block( cond ) ) { -
tests/exceptions/conditional.cfa
r1d17939 rb81fd95 17 17 }; 18 18 19 voidnum_error_msg(num_error * this) {19 const char * num_error_msg(num_error * this) { 20 20 if ( ! this->msg ) { 21 21 static const char * base = "Num Error with code: X"; -
tests/exceptions/defaults.cfa
r1d17939 rb81fd95 13 13 } 14 14 15 c har * get_log_message(log_message * this) {15 const char * get_log_message(log_message * this) { 16 16 return this->msg; 17 17 } … … 28 28 // We can catch log: 29 29 try { 30 throwResume (log_message){ (char *)"Should be printed.\n"};30 throwResume (log_message){"Should be printed.\n"}; 31 31 } catchResume (log_message * this) { 32 32 printf("%s", this->virtual_table->msg(this)); 33 33 } 34 34 // But we don't have to: 35 throwResume (log_message){ (char *)"Should not be printed.\n"};35 throwResume (log_message){"Should not be printed.\n"}; 36 36 } 37 37 -
tests/io2.cfa
r1d17939 rb81fd95 121 121 122 122 [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 }; 123 sout | [ 3, 4, "a", 7.2 ];123 sout | [ 3, 4, (const char*)"a", 7.2 ]; // workaround trac#207: the const cast should not be needed 124 124 sout | t3; 125 125 sepSetTuple( sout, " " ); -
tests/searchsort.cfa
r1d17939 rb81fd95 38 38 } // for 39 39 sout | nl; 40 for ( i; 0 ~ size ) { // C version 40 for ( i; 0 ~ size ) { // C version, returns void* 41 41 int key = size - i; 42 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );42 int * v = ( int * ) bsearch( &key, iarr, size, sizeof( iarr[0] ), comp ); 43 43 sout | key | ':' | *v | ", "; 44 44 } // for
Note: See TracChangeset
for help on using the changeset viewer.