- Timestamp:
- Apr 19, 2017, 10:15:45 AM (9 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:
- cd348e7
- Parents:
- 221c2de7 (diff), de4ce0e (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. - Location:
- src
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelGenerator.cc
r221c2de7 r154fdc8 20 20 #include "SynTree/Label.h" 21 21 #include "SynTree/Attribute.h" 22 #include "SynTree/Statement.h" 22 23 23 24 namespace ControlStruct { … … 31 32 } 32 33 33 Label LabelGenerator::newLabel( std::string suffix ) {34 Label LabelGenerator::newLabel( std::string suffix, Statement * stmt ) { 34 35 std::ostringstream os; 35 36 os << "__L" << current++ << "__" << suffix; 37 if ( stmt && ! stmt->get_labels().empty() ) { 38 os << "_" << stmt->get_labels().front() << "__"; 39 } 36 40 std::string ret = os.str(); 37 41 Label l( ret ); -
src/ControlStruct/LabelGenerator.h
r221c2de7 r154fdc8 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelGenerator.h -- 7 // LabelGenerator.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 24 24 public: 25 25 static LabelGenerator *getGenerator(); 26 Label newLabel(std::string suffix = "");26 Label newLabel(std::string suffix, Statement * stmt = nullptr); 27 27 void reset() { current = 0; } 28 28 void rewind() { current--; } -
src/ControlStruct/MLEMutator.cc
r221c2de7 r154fdc8 56 56 bool labeledBlock = !(cmpndStmt->get_labels().empty()); 57 57 if ( labeledBlock ) { 58 Label brkLabel = generator->newLabel("blockBreak" );58 Label brkLabel = generator->newLabel("blockBreak", cmpndStmt); 59 59 enclosingControlStructures.push_back( Entry( cmpndStmt, brkLabel ) ); 60 60 } // if … … 80 80 // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested 81 81 // loops 82 Label brkLabel = generator->newLabel("loopBreak" );83 Label contLabel = generator->newLabel("loopContinue" );82 Label brkLabel = generator->newLabel("loopBreak", loopStmt); 83 Label contLabel = generator->newLabel("loopContinue", loopStmt); 84 84 enclosingControlStructures.push_back( Entry( loopStmt, brkLabel, contLabel ) ); 85 85 loopStmt->set_body ( loopStmt->get_body()->acceptMutator( *this ) ); 86 86 87 assert( ! enclosingControlStructures.empty() ); 87 88 Entry &e = enclosingControlStructures.back(); 88 89 // sanity check that the enclosing loops have been popped correctly … … 108 109 bool labeledBlock = !(ifStmt->get_labels().empty()); 109 110 if ( labeledBlock ) { 110 Label brkLabel = generator->newLabel("blockBreak" );111 Label brkLabel = generator->newLabel("blockBreak", ifStmt); 111 112 enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) ); 112 113 } // if 113 114 114 115 Parent::mutate( ifStmt ); 115 116 116 117 if ( labeledBlock ) { 117 118 if ( ! enclosingControlStructures.back().useBreakExit().empty() ) { … … 126 127 Statement *MLEMutator::handleSwitchStmt( SwitchClass *switchStmt ) { 127 128 // generate a label for breaking out of a labeled switch 128 Label brkLabel = generator->newLabel("switchBreak" );129 Label brkLabel = generator->newLabel("switchBreak", switchStmt); 129 130 enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) ); 130 131 mutateAll( switchStmt->get_statements(), *this ); … … 158 159 159 160 std::list< Entry >::reverse_iterator targetEntry; 160 if ( branchStmt->get_type() == BranchStmt::Goto ) { 161 return branchStmt; 162 } else if ( branchStmt->get_type() == BranchStmt::Continue) { 163 // continue target must be a loop 164 if ( branchStmt->get_target() == "" ) { 165 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } ); 166 } else { 167 // labelled continue - lookup label in table ot find attached control structure 168 targetEntry = std::find( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), (*targetTable)[branchStmt->get_target()] ); 169 } // if 170 if ( targetEntry == enclosingControlStructures.rend() || ! isLoop( targetEntry->get_controlStructure() ) ) { 171 throw SemanticError( "'continue' target must be an enclosing loop: " + originalTarget ); 172 } // if 173 } else if ( branchStmt->get_type() == BranchStmt::Break ) { 174 if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" ); 175 targetEntry = enclosingControlStructures.rbegin(); 176 } else { 177 assert( false ); 178 } // if 179 180 if ( branchStmt->get_target() != "" && targetTable->find( branchStmt->get_target() ) == targetTable->end() ) { 181 throw SemanticError("The label defined in the exit loop statement does not exist: " + originalTarget ); // shouldn't happen (since that's already checked) 182 } // if 161 switch ( branchStmt->get_type() ) { 162 case BranchStmt::Goto: 163 return branchStmt; 164 case BranchStmt::Continue: 165 case BranchStmt::Break: { 166 bool isContinue = branchStmt->get_type() == BranchStmt::Continue; 167 // unlabeled break/continue 168 if ( branchStmt->get_target() == "" ) { 169 if ( isContinue ) { 170 // continue target is outermost loop 171 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } ); 172 } else { 173 // break target is outmost control structure 174 if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" ); 175 targetEntry = enclosingControlStructures.rbegin(); 176 } // if 177 } else { 178 // labeled break/continue - lookup label in table to find attached control structure 179 targetEntry = std::find( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), (*targetTable)[branchStmt->get_target()] ); 180 } // if 181 // ensure that selected target is valid 182 if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isLoop( targetEntry->get_controlStructure() ) ) ) { 183 throw SemanticError( toString( (isContinue ? "'continue'" : "'break'"), " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), originalTarget ) ); 184 } // if 185 break; 186 } 187 default: 188 assert( false ); 189 } // switch 183 190 184 191 // branch error checks, get the appropriate label name and create a goto … … 197 204 } // switch 198 205 199 if ( branchStmt->get_target() == "" && branchStmt->get_type() != BranchStmt::Continue ) { 200 // unlabelled break/continue - can keep branch as break/continue for extra semantic information, but add 201 // exitLabel as its destination so that label passes can easily determine where the break/continue goes to 202 branchStmt->set_target( exitLabel ); 203 return branchStmt; 204 } else { 205 // labelled break/continue - can't easily emulate this with break and continue, so transform into a goto 206 delete branchStmt; 207 return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto ); 208 } // if 206 // transform break/continue statements into goto to simplify later handling of branches 207 delete branchStmt; 208 return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto ); 209 209 } 210 210 -
src/GenPoly/Box.cc
r221c2de7 r154fdc8 34 34 #include "Parser/ParseNode.h" 35 35 36 #include "SynTree/Attribute.h" 36 37 #include "SynTree/Constant.h" 37 38 #include "SynTree/Declaration.h" … … 165 166 using Parent::mutate; 166 167 168 PolyGenericCalculator(); 169 167 170 template< typename DeclClass > 168 171 DeclClass *handleDecl( DeclClass *decl, Type *type ); … … 198 201 ScopedSet< std::string > knownLayouts; ///< Set of generic type layouts known in the current scope, indexed by sizeofName 199 202 ScopedSet< std::string > knownOffsets; ///< Set of non-generic types for which the offset array exists in the current scope, indexed by offsetofName 203 UniqueName bufNamer; ///< Namer for VLA buffers 200 204 }; 201 205 … … 1452 1456 ////////////////////////////////////////// PolyGenericCalculator //////////////////////////////////////////////////// 1453 1457 1458 PolyGenericCalculator::PolyGenericCalculator() 1459 : Parent(), knownLayouts(), knownOffsets(), bufNamer( "_buf" ) {} 1460 1454 1461 void PolyGenericCalculator::beginTypeScope( Type *ty ) { 1455 1462 scopeTyVars.beginScope(); … … 1528 1535 if ( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl *>( declStmt->get_decl() ) ) { 1529 1536 if ( findGeneric( objectDecl->get_type() ) ) { 1530 // change initialization of a polymorphic value object 1531 // to allocate storage with alloca1537 // change initialization of a polymorphic value object to allocate via a VLA 1538 // (alloca was previously used, but can't be safely used in loops) 1532 1539 Type *declType = objectDecl->get_type(); 1533 UntypedExpr *alloc = new UntypedExpr( new NameExpr( "__builtin_alloca" ) ); 1534 alloc->get_args().push_back( new NameExpr( sizeofName( mangleType( declType ) ) ) ); 1540 std::string bufName = bufNamer.newName(); 1541 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1542 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1543 true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 ); 1544 stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) ); 1535 1545 1536 1546 delete objectDecl->get_init(); 1537 1547 1538 std::list<Expression*> designators; 1539 objectDecl->set_init( new SingleInit( alloc, designators, false ) ); // not constructed 1548 objectDecl->set_init( new SingleInit( new NameExpr( bufName ) ) ); 1540 1549 } 1541 1550 } -
src/Parser/ParseNode.h
r221c2de7 r154fdc8 107 107 public: 108 108 ExpressionNode( Expression * expr = nullptr ) : expr( expr ) {} 109 ExpressionNode( const ExpressionNode &other );110 109 virtual ~ExpressionNode() {} 111 virtual ExpressionNode * clone() const override { return expr ? new ExpressionNode( expr->clone()) : nullptr; }110 virtual ExpressionNode * clone() const override { return expr ? static_cast<ExpressionNode*>((new ExpressionNode( expr->clone() ))->set_next( maybeClone( get_next() ) )) : nullptr; } 112 111 113 112 bool get_extension() const { return extension; } -
src/ResolvExpr/AlternativeFinder.cc
r221c2de7 r154fdc8 211 211 } 212 212 213 // std::unordered_map< Expression *, UniqueExpr * > ; 213 void AlternativeFinder::addAnonConversions( const Alternative & alt ) { 214 // adds anonymous member interpretations whenever an aggregate value type is seen. 215 Expression * expr = alt.expr->clone(); 216 std::unique_ptr< Expression > manager( expr ); // RAII for expr 217 alt.env.apply( expr->get_result() ); 218 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( expr->get_result() ) ) { 219 NameExpr nameExpr( "" ); 220 addAggMembers( structInst, expr, alt.cost+Cost( 0, 0, 1 ), alt.env, &nameExpr ); 221 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( expr->get_result() ) ) { 222 NameExpr nameExpr( "" ); 223 addAggMembers( unionInst, expr, alt.cost+Cost( 0, 0, 1 ), alt.env, &nameExpr ); 224 } // if 225 } 214 226 215 227 template< typename StructOrUnionType > … … 220 232 std::list< Declaration* > members; 221 233 aggInst->lookup( name, members ); 234 222 235 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) { 223 236 if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) { 224 237 alternatives.push_back( Alternative( new MemberExpr( dwt, expr->clone() ), env, newCost ) ); 225 238 renameTypes( alternatives.back().expr ); 239 addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression. 226 240 } else { 227 241 assert( false ); … … 730 744 if ( candidates.empty() && ! errors.isEmpty() ) { throw errors; } 731 745 746 // compute conversionsion costs 732 747 for ( AltList::iterator withFunc = candidates.begin(); withFunc != candidates.end(); ++withFunc ) { 733 748 Cost cvtCost = computeConversionCost( *withFunc, indexer ); … … 751 766 } // if 752 767 } // for 768 // function may return struct or union value, in which case we need to add alternatives for implicit conversions to each of the anonymous members 769 for ( const Alternative & alt : alternatives ) { 770 addAnonConversions( alt ); 771 } 772 753 773 candidates.clear(); 754 774 candidates.splice( candidates.end(), alternatives ); … … 885 905 ) 886 906 renameTypes( alternatives.back().expr ); 887 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) { 888 NameExpr nameExpr( "" ); 889 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr ); 890 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) { 891 NameExpr nameExpr( "" ); 892 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr ); 893 } // if 907 addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression. 894 908 } // for 895 909 } -
src/ResolvExpr/AlternativeFinder.h
r221c2de7 r154fdc8 78 78 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out ); 79 79 80 /// Adds alternatives for anonymous members 81 void addAnonConversions( const Alternative & alt ); 80 82 /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member 81 83 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ); -
src/SymTab/Autogen.cc
r221c2de7 r154fdc8 498 498 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) ); 499 499 if ( returnVal ) { 500 if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, back_inserter( funcDecl->get_statements()->get_kids() ) ); 501 else funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 500 funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 502 501 } 503 502 } -
src/SymTab/Validate.cc
r221c2de7 r154fdc8 208 208 }; 209 209 210 class ArrayLength : public Visitor { 211 public: 212 /// for array types without an explicit length, compute the length and store it so that it 213 /// is known to the rest of the phases. For example, 214 /// int x[] = { 1, 2, 3 }; 215 /// int y[][2] = { { 1, 2, 3 }, { 1, 2, 3 } }; 216 /// here x and y are known at compile-time to have length 3, so change this into 217 /// int x[3] = { 1, 2, 3 }; 218 /// int y[3][2] = { { 1, 2, 3 }, { 1, 2, 3 } }; 219 static void computeLength( std::list< Declaration * > & translationUnit ); 220 221 virtual void visit( ObjectDecl * objDecl ); 222 }; 223 210 224 class CompoundLiteral final : public GenPoly::DeclMutator { 211 225 Type::StorageClasses storageClasses; … … 235 249 acceptAll( translationUnit, pass3 ); 236 250 VerifyCtorDtorAssign::verify( translationUnit ); 251 ArrayLength::computeLength( translationUnit ); 237 252 } 238 253 … … 869 884 } 870 885 } 886 887 void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) { 888 ArrayLength len; 889 acceptAll( translationUnit, len ); 890 } 891 892 void ArrayLength::visit( ObjectDecl * objDecl ) { 893 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 894 if ( at->get_dimension() != nullptr ) return; 895 if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->get_init() ) ) { 896 at->set_dimension( new ConstantExpr( Constant::from_ulong( init->get_initializers().size() ) ) ); 897 } 898 } 899 } 871 900 } // namespace SymTab 872 901 -
src/SynTree/Expression.cc
r221c2de7 r154fdc8 339 339 return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() ); 340 340 } else { 341 assertf( false, "makeSub expects struct or union type for aggregate ");341 assertf( false, "makeSub expects struct or union type for aggregate, but got: %s", toString( t ).c_str() ); 342 342 } 343 343 } -
src/libcfa/Makefile.am
r221c2de7 r154fdc8 41 41 CC = ${abs_top_srcdir}/src/driver/cfa 42 42 43 headers = limits stdlib math iostream fstream iterator rational assert containers/ vector43 headers = limits stdlib math iostream fstream iterator rational assert containers/pair containers/vector 44 44 45 45 # not all platforms support concurrency, add option do disable it -
src/libcfa/Makefile.in
r221c2de7 r154fdc8 99 99 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 100 100 libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \ 101 fstream.c iterator.c rational.c assert.c containers/vector.c \ 102 concurrency/coroutine.c concurrency/thread.c \ 103 concurrency/kernel.c concurrency/monitor.c \ 104 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c 101 fstream.c iterator.c rational.c assert.c containers/pair.c \ 102 containers/vector.c concurrency/coroutine.c \ 103 concurrency/thread.c concurrency/kernel.c \ 104 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 105 concurrency/invoke.c 105 106 am__dirstamp = $(am__leading_dot)dirstamp 106 107 @BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \ … … 113 114 libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 114 115 libcfa_d_a-assert.$(OBJEXT) \ 116 containers/libcfa_d_a-pair.$(OBJEXT) \ 115 117 containers/libcfa_d_a-vector.$(OBJEXT) $(am__objects_1) 116 118 @BUILD_CONCURRENCY_TRUE@am__objects_3 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \ … … 126 128 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 127 129 libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \ 128 fstream.c iterator.c rational.c assert.c containers/vector.c \ 129 concurrency/coroutine.c concurrency/thread.c \ 130 concurrency/kernel.c concurrency/monitor.c \ 131 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c 130 fstream.c iterator.c rational.c assert.c containers/pair.c \ 131 containers/vector.c concurrency/coroutine.c \ 132 concurrency/thread.c concurrency/kernel.c \ 133 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 134 concurrency/invoke.c 132 135 @BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \ 133 136 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-thread.$(OBJEXT) \ … … 138 141 libcfa_a-fstream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \ 139 142 libcfa_a-rational.$(OBJEXT) libcfa_a-assert.$(OBJEXT) \ 143 containers/libcfa_a-pair.$(OBJEXT) \ 140 144 containers/libcfa_a-vector.$(OBJEXT) $(am__objects_5) 141 145 @BUILD_CONCURRENCY_TRUE@am__objects_7 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \ … … 176 180 $(am__libcfa_a_SOURCES_DIST) 177 181 am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \ 178 fstream iterator rational assert containers/ vector \179 con currency/coroutine concurrency/thread concurrency/kernel\180 concurrency/ monitor ${shell echo stdhdr/*} \182 fstream iterator rational assert containers/pair \ 183 containers/vector concurrency/coroutine concurrency/thread \ 184 concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \ 181 185 concurrency/invoke.h 182 186 HEADERS = $(nobase_cfa_include_HEADERS) … … 310 314 AM_CCASFLAGS = @CFA_FLAGS@ 311 315 headers = limits stdlib math iostream fstream iterator rational assert \ 312 containers/ vector $(am__append_3)316 containers/pair containers/vector $(am__append_3) 313 317 libobjs = ${headers:=.o} 314 318 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ … … 400 404 @$(MKDIR_P) containers/$(DEPDIR) 401 405 @: > containers/$(DEPDIR)/$(am__dirstamp) 406 containers/libcfa_d_a-pair.$(OBJEXT): containers/$(am__dirstamp) \ 407 containers/$(DEPDIR)/$(am__dirstamp) 402 408 containers/libcfa_d_a-vector.$(OBJEXT): containers/$(am__dirstamp) \ 403 409 containers/$(DEPDIR)/$(am__dirstamp) … … 428 434 libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \ 429 435 libhdr/$(DEPDIR)/$(am__dirstamp) 436 containers/libcfa_a-pair.$(OBJEXT): containers/$(am__dirstamp) \ 437 containers/$(DEPDIR)/$(am__dirstamp) 430 438 containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \ 431 439 containers/$(DEPDIR)/$(am__dirstamp) … … 458 466 -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT) 459 467 -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT) 468 -rm -f containers/libcfa_a-pair.$(OBJEXT) 460 469 -rm -f containers/libcfa_a-vector.$(OBJEXT) 470 -rm -f containers/libcfa_d_a-pair.$(OBJEXT) 461 471 -rm -f containers/libcfa_d_a-vector.$(OBJEXT) 462 472 -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT) … … 497 507 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@ 498 508 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread.Po@am__quote@ 509 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-pair.Po@am__quote@ 499 510 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@ 511 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-pair.Po@am__quote@ 500 512 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@ 501 513 @AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@ … … 681 693 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 682 694 695 containers/libcfa_d_a-pair.o: containers/pair.c 696 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c 697 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po 698 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.o' libtool=no @AMDEPBACKSLASH@ 699 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 700 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c 701 702 containers/libcfa_d_a-pair.obj: containers/pair.c 703 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 704 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po 705 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.obj' libtool=no @AMDEPBACKSLASH@ 706 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 707 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 708 683 709 containers/libcfa_d_a-vector.o: containers/vector.c 684 710 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-vector.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-vector.Tpo -c -o containers/libcfa_d_a-vector.o `test -f 'containers/vector.c' || echo '$(srcdir)/'`containers/vector.c … … 904 930 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 905 931 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 932 933 containers/libcfa_a-pair.o: containers/pair.c 934 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c 935 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po 936 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.o' libtool=no @AMDEPBACKSLASH@ 937 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 938 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c 939 940 containers/libcfa_a-pair.obj: containers/pair.c 941 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 942 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po 943 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.obj' libtool=no @AMDEPBACKSLASH@ 944 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 945 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 906 946 907 947 containers/libcfa_a-vector.o: containers/vector.c -
src/libcfa/stdlib.c
r221c2de7 r154fdc8 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Apr 1 18:31:26201713 // Update Count : 18 112 // Last Modified On : Sun Apr 16 10:41:05 2017 13 // Update Count : 189 14 14 // 15 15 … … 78 78 } // posix_memalign 79 79 80 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params); } )80 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) 81 81 T * new( Params p ) { 82 return ((T *)malloc()){ p };82 return ((T *)malloc()){ p }; 83 83 } 84 84 … … 229 229 forall( otype T | { int ?<?( T, T ); } ) 230 230 unsigned int bsearch( T key, const T * arr, size_t dimension ) { 231 int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; } 232 T *result = (T *)bsearch( &key, arr, dimension, sizeof(T), comp ); 231 T *result = bsearch( key, arr, dimension ); 233 232 return result ? result - arr : dimension; // pointer subtraction includes sizeof(T) 234 233 } // bsearch -
src/prelude/prelude.cf
r221c2de7 r154fdc8 217 217 signed int ?<?( _Bool, _Bool ), ?<=?( _Bool, _Bool ), 218 218 ?>?( _Bool, _Bool ), ?>=?( _Bool, _Bool ); 219 signed int ?<?( char, char ), ?<=?( char, char ), 220 ?>?( char, char ), ?>=?( char, char ); 221 signed int ?<?( signed char, signed char ), ?<=?( signed char, signed char ), 222 ?>?( signed char, signed char ), ?>=?( signed char, signed char ); 219 223 signed int ?<?( unsigned char, unsigned char ), ?<=?( unsigned char, unsigned char ), 220 224 ?>?( unsigned char, unsigned char ), ?>=?( unsigned char, unsigned char ); 225 signed int ?<?( signed short, signed short ), ?<=?( signed short, signed short ), 226 ?>?( signed short, signed short ), ?>=?( signed short, signed short ); 227 signed int ?<?( unsigned short, unsigned short ), ?<=?( unsigned short, unsigned short ), 228 ?>?( unsigned short, unsigned short ), ?>=?( unsigned short, unsigned short ); 221 229 signed int ?<?( signed int, signed int ), ?<=?( signed int, signed int ), 222 230 ?>?( signed int, signed int ), ?>=?( signed int, signed int ); … … 265 273 266 274 signed int ?==?( _Bool, _Bool ), ?!=?( _Bool, _Bool ); 275 signed int ?==?( char, char ), ?!=?( char, char ); 276 signed int ?==?( signed char, signed char ), ?!=?( signed char, signed char ); 277 signed int ?==?( unsigned char, unsigned char ), ?!=?( unsigned char, unsigned char ); 278 signed int ?==?( signed short, signed short ), ?!=?( signed short, signed short ); 279 signed int ?==?( unsigned short, unsigned short ), ?!=?( unsigned short, unsigned short ); 267 280 signed int ?==?( signed int, signed int ), ?!=?( signed int, signed int ); 268 281 signed int ?==?( unsigned int, unsigned int ), ?!=?( unsigned int, unsigned int );
Note:
See TracChangeset
for help on using the changeset viewer.