- Timestamp:
- May 15, 2017, 3:27:47 PM (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:
- db0fa7c
- Parents:
- dbfb35d (diff), 9ff8310 (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:
-
- 5 added
- 2 deleted
- 40 edited
-
CodeGen/CodeGenerator.cc (modified) (9 diffs)
-
CodeGen/CodeGenerator.h (modified) (7 diffs)
-
CodeGen/GenType.cc (modified) (8 diffs)
-
CodeGen/GenType.h (modified) (1 diff)
-
CodeGen/Generate.cc (modified) (3 diffs)
-
CodeGen/Generate.h (modified) (1 diff)
-
CodeGen/LineStream.cc (deleted)
-
CodeGen/LineStream.h (deleted)
-
Common/utility.h (modified) (4 diffs)
-
GenPoly/Box.cc (modified) (11 diffs)
-
InitTweak/FixInit.cc (modified) (6 diffs)
-
InitTweak/GenInit.cc (modified) (1 diff)
-
libcfa/Makefile.am (modified) (2 diffs)
-
libcfa/Makefile.in (modified) (2 diffs)
-
libcfa/gmp (added)
-
libcfa/iostream.c (modified) (2 diffs)
-
libcfa/rational (modified) (2 diffs)
-
libcfa/rational.c (modified) (12 diffs)
-
libcfa/stdlib (modified) (3 diffs)
-
libcfa/stdlib.c (modified) (10 diffs)
-
main.cc (modified) (7 diffs)
-
prelude/Makefile.am (modified) (1 diff)
-
prelude/Makefile.in (modified) (1 diff)
-
tests/.expect/32/KRfunctions.txt (modified) (1 diff)
-
tests/.expect/32/attributes.txt (modified) (7 diffs)
-
tests/.expect/32/declarationSpecifier.txt (modified) (24 diffs)
-
tests/.expect/32/extension.txt (modified) (2 diffs)
-
tests/.expect/32/gccExtensions.txt (modified) (4 diffs)
-
tests/.expect/64/KRfunctions.txt (modified) (1 diff)
-
tests/.expect/64/attributes.txt (modified) (7 diffs)
-
tests/.expect/64/declarationSpecifier.txt (modified) (24 diffs)
-
tests/.expect/64/extension.txt (modified) (2 diffs)
-
tests/.expect/64/gccExtensions.txt (modified) (4 diffs)
-
tests/.expect/concurrent/sched-int-wait.txt (modified) (1 diff)
-
tests/.expect/genericUnion.txt (added)
-
tests/.expect/gmp.txt (added)
-
tests/.expect/memberCtors-ERR1.txt (modified) (1 diff)
-
tests/.expect/memberCtors.txt (modified) (4 diffs)
-
tests/.expect/rational.txt (modified) (1 diff)
-
tests/Makefile.am (modified) (3 diffs)
-
tests/Makefile.in (modified) (3 diffs)
-
tests/genericUnion.c (added)
-
tests/gmp.c (added)
-
tests/memberCtors.c (modified) (1 diff)
-
tests/rational.c (modified) (3 diffs)
-
tests/sched-int-wait.c (modified) (2 diffs)
-
tests/test.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rdbfb35d r3bd1eb4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus May 9 16:50:00 201712 // Last Modified On : Wed May 10 14:45:00 2017 13 13 // Update Count : 484 14 14 // … … 41 41 namespace CodeGen { 42 42 int CodeGenerator::tabsize = 4; 43 44 // Pseudo Function: output << lineDirective(currentNode);45 struct lineDirective {46 CodeLocation const & loc;47 lineDirective(CodeLocation const & location) : loc(location) {}48 lineDirective(BaseSyntaxNode const * node) : loc(node->location) {}49 };50 std::ostream & operator<<(std::ostream & out, lineDirective const & ld) {51 if (ld.loc.isSet())52 return out << "\n# " << ld.loc.linenumber << " \""53 << ld.loc.filename << "\"\n";54 return out << "\n// Unset Location\n";55 }56 43 57 44 // the kinds of statements that would ideally be followed by whitespace … … 102 89 } 103 90 104 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ) {} 91 CodeGenerator::LineMarker::LineMarker( 92 CodeLocation const & loc, bool toPrint) : 93 loc(loc), toPrint(toPrint) 94 {} 95 96 CodeGenerator::LineMarker CodeGenerator::lineDirective( 97 BaseSyntaxNode const * node) { 98 return LineMarker(node->location, lineMarks); 99 } 100 101 std::ostream & operator<<(std::ostream & out, 102 CodeGenerator::LineMarker const & marker) { 103 if (marker.toPrint && marker.loc.isSet()) { 104 return out << "\n# " << marker.loc.linenumber << " \"" 105 << marker.loc.filename << "\"\n"; 106 } else if (marker.toPrint) { 107 return out << "\n/* Missing CodeLocation */\n"; 108 } else { 109 return out; 110 } 111 } 112 113 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {} 105 114 106 115 CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp ) … … 143 152 // *** Declarations 144 153 void CodeGenerator::visit( FunctionDecl * functionDecl ) { 145 output << lineDirective( functionDecl );146 147 154 extension( functionDecl ); 148 155 genAttributes( functionDecl->get_attributes() ); … … 168 175 } 169 176 170 output << lineDirective( objectDecl );171 172 177 extension( objectDecl ); 173 178 genAttributes( objectDecl->get_attributes() ); … … 221 226 222 227 void CodeGenerator::visit( StructDecl * structDecl ) { 223 output << lineDirective( structDecl );224 225 228 extension( structDecl ); 226 229 handleAggregate( structDecl, "struct " ); … … 228 231 229 232 void CodeGenerator::visit( UnionDecl * unionDecl ) { 230 output << lineDirective( unionDecl );231 232 233 extension( unionDecl ); 233 234 handleAggregate( unionDecl, "union " ); … … 708 709 void CodeGenerator::visit( UntypedTupleExpr * tupleExpr ) { 709 710 assertf( ! genC, "UntypedTupleExpr should not reach code generation." ); 711 extension( tupleExpr ); 710 712 output << "["; 711 713 genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() ); … … 715 717 void CodeGenerator::visit( TupleExpr * tupleExpr ) { 716 718 assertf( ! genC, "TupleExpr should not reach code generation." ); 719 extension( tupleExpr ); 717 720 output << "["; 718 721 genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() ); 719 722 output << "]"; 723 } 724 725 void CodeGenerator::visit( TupleIndexExpr * tupleExpr ) { 726 assertf( ! genC, "TupleIndexExpr should not reach code generation." ); 727 extension( tupleExpr ); 728 tupleExpr->get_tuple()->accept( *this ); 729 output << "." << tupleExpr->get_index(); 720 730 } 721 731 -
src/CodeGen/CodeGenerator.h
rdbfb35d r3bd1eb4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Ma r 1 16:20:04201713 // Update Count : 5 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 10 10:57:00 2017 13 // Update Count : 51 14 14 // 15 15 … … 25 25 #include "SymTab/Indexer.h" 26 26 27 #include "Common/utility.h" 28 27 29 namespace CodeGen { 28 30 class CodeGenerator : public Visitor { … … 30 32 static int tabsize; 31 33 32 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false );34 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false ); 33 35 CodeGenerator( std::ostream &os, std::string, int indent = 0, bool infun = false ); 34 36 CodeGenerator( std::ostream &os, char *, int indent = 0, bool infun = false ); … … 74 76 virtual void visit( UntypedTupleExpr *tupleExpr ); 75 77 virtual void visit( TupleExpr *tupleExpr ); 78 virtual void visit( TupleIndexExpr * tupleExpr ); 76 79 virtual void visit( TypeExpr *typeExpr ); 77 80 virtual void visit( AsmExpr * ); … … 110 113 }; 111 114 115 struct LineMarker { 116 CodeLocation const & loc; 117 bool toPrint; 118 119 LineMarker(CodeLocation const & loc, bool toPrint); 120 }; 121 122 LineMarker lineDirective(BaseSyntaxNode const * node); 123 112 124 void asmName( DeclarationWithType *decl ); 113 125 … … 122 134 bool pretty = false; // pretty print 123 135 bool genC = false; // true if output has to be C code 136 bool lineMarks = false; 124 137 125 138 void printDesignators( std::list< Expression * > & ); … … 149 162 /// returns C-compatible name of declaration 150 163 std::string genName( DeclarationWithType * decl ); 164 165 std::ostream & operator<<(std::ostream &, 166 CodeGenerator::LineMarker const &); 151 167 } // namespace CodeGen 152 168 -
src/CodeGen/GenType.cc
rdbfb35d r3bd1eb4 28 28 class GenType : public Visitor { 29 29 public: 30 GenType( const std::string &typeString, bool pretty = false, bool genC = false );30 GenType( const std::string &typeString, bool pretty = false, bool genC = false, bool lineMarks = false ); 31 31 std::string get_typeString() const { return typeString; } 32 32 void set_typeString( const std::string &newValue ) { typeString = newValue; } … … 54 54 bool pretty = false; // pretty print 55 55 bool genC = false; // generating C code? 56 bool lineMarks = false; 56 57 }; 57 58 58 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC ) {59 GenType gt( baseString, pretty, genC );59 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks ) { 60 GenType gt( baseString, pretty, genC, lineMarks ); 60 61 std::ostringstream os; 61 62 62 63 if ( ! type->get_attributes().empty() ) { 63 CodeGenerator cg( os, pretty, genC );64 CodeGenerator cg( os, pretty, genC, lineMarks ); 64 65 cg.genAttributes( type->get_attributes() ); 65 66 } // if … … 73 74 } 74 75 75 GenType::GenType( const std::string &typeString, bool pretty, bool genC ) : typeString( typeString ), pretty( pretty ), genC( genC) {}76 GenType::GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {} 76 77 77 78 void GenType::visit( VoidType *voidType ) { … … 114 115 } // if 115 116 if ( dimension != 0 ) { 116 CodeGenerator cg( os, pretty, genC );117 CodeGenerator cg( os, pretty, genC, lineMarks ); 117 118 dimension->accept( cg ); 118 119 } else if ( isVarLen ) { … … 168 169 } // if 169 170 } else { 170 CodeGenerator cg( os, pretty, genC );171 CodeGenerator cg( os, pretty, genC, lineMarks ); 171 172 os << "(" ; 172 173 … … 191 192 // assertf( ! genC, "Aggregate type parameters should not reach code generation." ); 192 193 std::ostringstream os; 193 CodeGenerator cg( os, pretty, genC );194 CodeGenerator cg( os, pretty, genC, lineMarks ); 194 195 os << "forall("; 195 196 cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() ); … … 202 203 if ( ! refType->get_parameters().empty() ) { 203 204 std::ostringstream os; 204 CodeGenerator cg( os, pretty, genC );205 CodeGenerator cg( os, pretty, genC, lineMarks ); 205 206 os << "("; 206 207 cg.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() ); … … 242 243 for ( Type * t : *tupleType ) { 243 244 i++; 244 os << genType( t, "", pretty, genC ) << (i == tupleType->size() ? "" : ", ");245 os << genType( t, "", pretty, genC, lineMarks ) << (i == tupleType->size() ? "" : ", "); 245 246 } 246 247 os << "]"; -
src/CodeGen/GenType.h
rdbfb35d r3bd1eb4 21 21 22 22 namespace CodeGen { 23 std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false );23 std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false, bool lineMarks = false ); 24 24 std::string genPrettyType( Type * type, const std::string & baseString ); 25 25 } // namespace CodeGen -
src/CodeGen/Generate.cc
rdbfb35d r3bd1eb4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jun 4 14:04:25 201513 // Update Count : 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 19 13:05:00 2017 13 // Update Count : 6 14 14 // 15 15 … … 31 31 32 32 namespace CodeGen { 33 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC ) {34 CodeGen::CodeGenerator cgv( os, pretty, generateC );33 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks ) { 34 CodeGen::CodeGenerator cgv( os, pretty, generateC, lineMarks ); 35 35 for ( auto & dcl : translationUnit ) { 36 36 if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) { 37 os << cgv.lineDirective(dcl); 37 38 dcl->accept(cgv); 38 39 if ( doSemicolon( dcl ) ) { … … 48 49 os << CodeGen::genPrettyType( type, "" ); 49 50 } else { 50 CodeGen::CodeGenerator cgv( os, true, false );51 CodeGen::CodeGenerator cgv( os, true, false, false ); 51 52 node->accept( cgv ); 52 53 } -
src/CodeGen/Generate.h
rdbfb35d r3bd1eb4 24 24 namespace CodeGen { 25 25 /// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.) 26 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false );26 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false ); 27 27 28 28 /// Generate code for a single node -- helpful for debugging in gdb -
src/Common/utility.h
rdbfb35d r3bd1eb4 322 322 std::string filename; 323 323 324 /// Create a new unset CodeLocation.324 /// Create a new unset CodeLocation. 325 325 CodeLocation() 326 326 : linenumber( -1 ) … … 328 328 {} 329 329 330 /// Create a new CodeLocation with the given values.330 /// Create a new CodeLocation with the given values. 331 331 CodeLocation( const char* filename, int lineno ) 332 332 : linenumber( lineno ) … … 334 334 {} 335 335 336 bool isSet () const {337 return -1 != linenumber;338 }339 340 bool isUnset () const {341 return !isSet();342 }336 bool isSet () const { 337 return -1 != linenumber; 338 } 339 340 bool isUnset () const { 341 return !isSet(); 342 } 343 343 344 344 void unset () { … … 353 353 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : ""; 354 354 } 355 355 356 #endif // _UTILITY_H 356 357 -
src/GenPoly/Box.cc
rdbfb35d r3bd1eb4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:06:37201713 // Update Count : 3 3912 // Last Modified On : Sat May 13 09:26:38 2017 13 // Update Count : 341 14 14 // 15 15 … … 706 706 Type *concrete = env->lookup( typeInst->get_name() ); 707 707 if ( concrete == 0 ) { 708 return typeInst; 708 709 // xxx - should this be an assertion? 709 std::string x = env ? toString( *env ) : "missing env";710 throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr );710 // std::string x = env ? toString( *env ) : "missing env"; 711 // throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr ); 711 712 } // if 712 713 return concrete; … … 764 765 } else { 765 766 arg = new AddressExpr( arg ); 767 } 768 if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) { 769 // silence warnings by casting boxed parameters when the actual type does not match up with the formal type. 770 arg = new CastExpr( arg, param->clone() ); 766 771 } 767 772 } else { … … 902 907 } // if 903 908 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); 904 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 905 deref->get_args().push_back( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 909 UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 906 910 assign->get_args().push_back( deref ); 907 911 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); … … 1217 1221 1218 1222 Statement * Pass1::mutate( ReturnStmt *returnStmt ) { 1219 // maybe need access to the env when mutating the expr1220 if ( Expression * expr = returnStmt->get_expr() ) {1221 if ( expr->get_env() ) {1222 env = expr->get_env();1223 }1224 }1225 1226 1223 if ( retval && returnStmt->get_expr() ) { 1227 1224 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() ); … … 1302 1299 FunctionType * ftype = functionDecl->get_functionType(); 1303 1300 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { 1304 if ( functionDecl->get_name() != "?=?" && ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx - remove check for ?=? once reference types are in;remove check for prefix once thunks properly use ctor/dtors1301 if ( ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx - remove check for prefix once thunks properly use ctor/dtors 1305 1302 assert( ftype->get_returnVals().size() == 1 ); 1306 1303 DeclarationWithType * retval = ftype->get_returnVals().front(); … … 1539 1536 Type *declType = objectDecl->get_type(); 1540 1537 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) ) ), 1538 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1539 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1543 1540 true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 ); 1544 1541 stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) ); … … 1578 1575 } 1579 1576 1580 /// Returns an expression dereferenced n times1581 Expression *makeDerefdVar( Expression *derefdVar, long n ) {1582 for ( int i = 1; i < n; ++i ) {1583 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );1584 derefExpr->get_args().push_back( derefdVar );1585 // xxx - should set results on derefExpr1586 derefdVar = derefExpr;1587 }1588 return derefdVar;1589 }1590 1591 1577 Expression *PolyGenericCalculator::mutate( MemberExpr *memberExpr ) { 1592 1578 // mutate, exiting early if no longer MemberExpr … … 1595 1581 if ( ! memberExpr ) return expr; 1596 1582 1597 // get declaration for base struct, exiting early if not found1598 int varDepth;1599 VariableExpr *varExpr = getBaseVar( memberExpr->get_aggregate(), &varDepth );1600 if ( ! varExpr ) return memberExpr;1601 ObjectDecl *objectDecl = dynamic_cast< ObjectDecl* >( varExpr->get_var() );1602 if ( ! objectDecl ) return memberExpr;1603 1604 1583 // only mutate member expressions for polymorphic types 1605 1584 int tyDepth; 1606 Type *objectType = hasPolyBase( objectDecl->get_type(), scopeTyVars, &tyDepth );1585 Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth ); 1607 1586 if ( ! objectType ) return memberExpr; 1608 1587 findGeneric( objectType ); // ensure layout for this type is available … … 1622 1601 fieldLoc->get_args().push_back( aggr ); 1623 1602 fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); 1603 fieldLoc->set_result( memberExpr->get_result()->clone() ); 1624 1604 newMemberExpr = fieldLoc; 1625 1605 } else if ( dynamic_cast< UnionInstType* >( objectType ) ) { 1626 // union members are all at offset zero, so build appropriately-dereferenced variable 1627 newMemberExpr = makeDerefdVar( varExpr->clone(), varDepth ); 1606 // union members are all at offset zero, so just use the aggregate expr 1607 Expression * aggr = memberExpr->get_aggregate()->clone(); 1608 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1609 aggr->set_env( nullptr ); 1610 newMemberExpr = aggr; 1611 newMemberExpr->set_result( memberExpr->get_result()->clone() ); 1628 1612 } else return memberExpr; 1629 1613 assert( newMemberExpr ); … … 1633 1617 // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue 1634 1618 CastExpr *ptrCastExpr = new CastExpr( newMemberExpr, new PointerType( Type::Qualifiers(), memberType->clone() ) ); 1635 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 1636 derefExpr->get_args().push_back( ptrCastExpr ); 1619 UntypedExpr *derefExpr = UntypedExpr::createDeref( ptrCastExpr ); 1637 1620 newMemberExpr = derefExpr; 1638 1621 } -
src/InitTweak/FixInit.cc
rdbfb35d r3bd1eb4 361 361 FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) ); 362 362 assert( ftype ); 363 if ( (isConstructor( funcDecl->get_name() ) || funcDecl->get_name() == "?=?") && ftype->get_parameters().size() == 2 ) {363 if ( isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) { 364 364 Type * t1 = ftype->get_parameters().front()->get_type(); 365 365 Type * t2 = ftype->get_parameters().back()->get_type(); … … 367 367 368 368 if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) { 369 // optimization: don't need to copy construct in order to call a copy constructor or 370 // assignment operator 369 // optimization: don't need to copy construct in order to call a copy constructor 371 370 return appExpr; 372 371 } // if … … 636 635 assert( ! stmtExpr->get_returnDecls().empty() ); 637 636 body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) ); 638 } 639 stmtExpr->get_returnDecls().clear(); 640 stmtExpr->get_dtors().clear(); 637 stmtExpr->get_returnDecls().clear(); 638 stmtExpr->get_dtors().clear(); 639 } 640 assert( stmtExpr->get_returnDecls().empty() ); 641 assert( stmtExpr->get_dtors().empty() ); 641 642 return stmtExpr; 642 643 } … … 655 656 unqExpr->set_result( maybeClone( unqExpr->get_expr()->get_result() ) ); 656 657 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression 657 stmtsToAdd .splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );658 stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] ); 658 659 } 659 660 if ( addDeref.count( unqExpr->get_id() ) ) { … … 667 668 stmtsToAdd.splice( stmtsToAdd.end(), fixer.stmtsToAdd ); 668 669 unqMap[unqExpr->get_id()] = unqExpr; 670 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression 671 stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] ); 672 } else { // remember dtors for last instance of unique expr 673 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter; 674 } 669 675 if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) { 670 676 // unique expression is now a dereference, because the inner expression is an lvalue returning function call. … … 675 681 getCallArg( deref, 0 ) = unqExpr; 676 682 addDeref.insert( unqExpr->get_id() ); 677 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression678 stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );679 } else { // remember dtors for last instance of unique expr680 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;681 }682 683 return deref; 683 684 } -
src/InitTweak/GenInit.cc
rdbfb35d r3bd1eb4 142 142 // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address 143 143 // is being returned 144 // Note: under the assumption that assignments return *this, checking for ?=? here is an optimization, since it shouldn't be necessary to copy construct `this`. This is a temporary optimization until reference types are added, at which point this should be removed, along with the analogous optimization in copy constructor generation. 145 if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_lvalue() ) { 144 if ( returnStmt->get_expr() && returnVals.size() == 1 && ! returnVals.front()->get_type()->get_lvalue() ) { 146 145 // explicitly construct the return value using the return expression and the retVal object 147 146 assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() ); -
src/libcfa/Makefile.am
rdbfb35d r3bd1eb4 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : S at Mar 25 18:00:10201714 ## Update Count : 21 213 ## Last Modified On : Sun May 14 21:04:21 2017 14 ## Update Count : 214 15 15 ############################################################################### 16 16 … … 76 76 77 77 cfa_includedir = $(CFA_INCDIR) 78 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h78 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h 79 79 80 80 CLEANFILES = libcfa-prelude.c -
src/libcfa/Makefile.in
rdbfb35d r3bd1eb4 183 183 containers/vector concurrency/coroutine concurrency/thread \ 184 184 concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \ 185 concurrency/invoke.h185 gmp concurrency/invoke.h 186 186 HEADERS = $(nobase_cfa_include_HEADERS) 187 187 ETAGS = etags … … 324 324 stdhdr = ${shell echo stdhdr/*} 325 325 cfa_includedir = $(CFA_INCDIR) 326 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h326 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h 327 327 CLEANFILES = libcfa-prelude.c 328 328 all: all-am -
src/libcfa/iostream.c
rdbfb35d r3bd1eb4 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 23 08:20:40201713 // Update Count : 36 712 // Last Modified On : Mon May 8 18:24:23 2017 13 // Update Count : 369 14 14 // 15 15 … … 160 160 [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open, 161 161 // closing delimiters, no space before 162 [','] : Close, ['.'] : Close, [' :'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,162 [','] : Close, ['.'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close, 163 163 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close, 164 164 [')'] : Close, [']'] : Close, ['}'] : Close, 165 165 // opening-closing delimiters, no space before or after 166 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, 166 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, [':'] : OpenClose, 167 167 [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace 168 168 }; // mask -
src/libcfa/rational
rdbfb35d r3bd1eb4 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Mon May 1 08:25:06201715 // Update Count : 3314 // Last Modified On : Sun May 14 16:49:13 2017 15 // Update Count : 78 16 16 // 17 17 … … 21 21 #include "iostream" 22 22 23 trait scalar( otype T ) { 24 }; 25 26 trait arithmetic( otype T | scalar( T ) ) { 27 int !?( T ); 28 int ?==?( T, T ); 29 int ?!=?( T, T ); 30 int ?<?( T, T ); 31 int ?<=?( T, T ); 32 int ?>?( T, T ); 33 int ?>=?( T, T ); 34 void ?{}( T *, zero_t ); 35 void ?{}( T *, one_t ); 36 T +?( T ); 37 T -?( T ); 38 T ?+?( T, T ); 39 T ?-?( T, T ); 40 T ?*?( T, T ); 41 T ?/?( T, T ); 42 T ?%?( T, T ); 43 T ?/=?( T *, T ); 44 T abs( T ); 45 }; 46 23 47 // implementation 24 typedef long int RationalImpl; 48 49 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 25 50 struct Rational { 26 RationalImpl numerator, denominator; // invariant: denominator > 051 RationalImpl numerator, denominator; // invariant: denominator > 0 27 52 }; // Rational 28 53 29 // constants 30 extern struct Rational 0; 31 extern struct Rational 1; 54 // constructors 32 55 33 // constructors 34 void ?{}( Rational * r ); 35 void ?{}( Rational * r, RationalImpl n ); 36 void ?{}( Rational * r, RationalImpl n, RationalImpl d ); 56 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 57 void ?{}( Rational(RationalImpl) * r ); 58 59 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 60 void ?{}( Rational(RationalImpl) * r, RationalImpl n ); 61 62 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 63 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ); 64 65 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 66 void ?{}( Rational(RationalImpl) * r, zero_t ); 67 68 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 69 void ?{}( Rational(RationalImpl) * r, one_t ); 37 70 38 71 // getter for numerator/denominator 39 RationalImpl numerator( Rational r ); 40 RationalImpl denominator( Rational r ); 41 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ); 72 73 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 74 RationalImpl numerator( Rational(RationalImpl) r ); 75 76 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 77 RationalImpl denominator( Rational(RationalImpl) r ); 78 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ); 80 42 81 // setter for numerator/denominator 43 RationalImpl numerator( Rational r, RationalImpl n ); 44 RationalImpl denominator( Rational r, RationalImpl d ); 82 83 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 84 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ); 85 86 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 87 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ); 45 88 46 89 // comparison 47 int ?==?( Rational l, Rational r ); 48 int ?!=?( Rational l, Rational r ); 49 int ?<?( Rational l, Rational r ); 50 int ?<=?( Rational l, Rational r ); 51 int ?>?( Rational l, Rational r ); 52 int ?>=?( Rational l, Rational r ); 90 91 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 92 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 93 94 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 95 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 96 97 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 98 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 99 100 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 101 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 102 103 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 104 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 105 106 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 107 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 53 108 54 109 // arithmetic 55 Rational -?( Rational r ); 56 Rational ?+?( Rational l, Rational r ); 57 Rational ?-?( Rational l, Rational r ); 58 Rational ?*?( Rational l, Rational r ); 59 Rational ?/?( Rational l, Rational r ); 110 111 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 112 Rational(RationalImpl) +?( Rational(RationalImpl) r ); 113 114 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 115 Rational(RationalImpl) -?( Rational(RationalImpl) r ); 116 117 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 118 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 119 120 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 121 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 122 123 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 124 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 125 126 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 127 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 60 128 61 129 // conversion 62 double widen( Rational r ); 63 Rational narrow( double f, RationalImpl md ); 130 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 131 // double widen( Rational(RationalImpl) r ); 132 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 133 // Rational(RationalImpl) narrow( double f, RationalImpl md ); 64 134 65 135 // I/O 66 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * ); 67 forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, Rational ); 136 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 137 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 138 istype * ?|?( istype *, Rational(RationalImpl) * ); 139 140 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 141 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 142 ostype * ?|?( ostype *, Rational(RationalImpl ) ); 68 143 69 144 #endif // RATIONAL_H -
src/libcfa/rational.c
rdbfb35d r3bd1eb4 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 27 17:05:06201713 // Update Count : 5112 // Last Modified On : Sun May 14 17:25:19 2017 13 // Update Count : 131 14 14 // 15 15 … … 17 17 #include "fstream" 18 18 #include "stdlib" 19 #include "math" // floor20 21 22 // constants23 24 struct Rational 0 = {0, 1};25 struct Rational 1 = {1, 1};26 27 19 28 20 // helper routines … … 30 22 // Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals. 31 23 // alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm 24 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 32 25 static RationalImpl gcd( RationalImpl a, RationalImpl b ) { 33 26 for ( ;; ) { // Euclid's algorithm 34 27 RationalImpl r = a % b; 35 if ( r == 0) break;28 if ( r == (RationalImpl){0} ) break; 36 29 a = b; 37 30 b = r; … … 40 33 } // gcd 41 34 42 static RationalImpl simplify( RationalImpl *n, RationalImpl *d ) { 43 if ( *d == 0 ) { 35 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 36 static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) { 37 if ( *d == (RationalImpl){0} ) { 44 38 serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl; 45 39 exit( EXIT_FAILURE ); 46 40 } // exit 47 if ( *d < 0 ) { *d = -*d; *n = -*n; }// move sign to numerator41 if ( *d < (RationalImpl){0} ) { *d = -*d; *n = -*n; } // move sign to numerator 48 42 return gcd( abs( *n ), *d ); // simplify 49 43 } // Rationalnumber::simplify … … 52 46 // constructors 53 47 54 void ?{}( Rational * r ) { 55 r{ 0, 1 }; 48 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 49 void ?{}( Rational(RationalImpl) * r ) { 50 r{ (RationalImpl){0}, (RationalImpl){1} }; 56 51 } // rational 57 52 58 void ?{}( Rational * r, RationalImpl n ) { 59 r{ n, 1 }; 53 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 54 void ?{}( Rational(RationalImpl) * r, RationalImpl n ) { 55 r{ n, (RationalImpl){1} }; 60 56 } // rational 61 57 62 void ?{}( Rational * r, RationalImpl n, RationalImpl d ) { 58 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 59 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) { 63 60 RationalImpl t = simplify( &n, &d ); // simplify 64 61 r->numerator = n / t; … … 69 66 // getter for numerator/denominator 70 67 71 RationalImpl numerator( Rational r ) { 68 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 69 RationalImpl numerator( Rational(RationalImpl) r ) { 72 70 return r.numerator; 73 71 } // numerator 74 72 75 RationalImpl denominator( Rational r ) { 73 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 74 RationalImpl denominator( Rational(RationalImpl) r ) { 76 75 return r.denominator; 77 76 } // denominator 78 77 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ) { 78 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) { 80 80 return *dest = src.[ numerator, denominator ]; 81 81 } … … 83 83 // setter for numerator/denominator 84 84 85 RationalImpl numerator( Rational r, RationalImpl n ) { 85 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 86 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) { 86 87 RationalImpl prev = r.numerator; 87 88 RationalImpl t = gcd( abs( n ), r.denominator ); // simplify … … 91 92 } // numerator 92 93 93 RationalImpl denominator( Rational r, RationalImpl d ) { 94 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 95 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) { 94 96 RationalImpl prev = r.denominator; 95 97 RationalImpl t = simplify( &r.numerator, &d ); // simplify … … 102 104 // comparison 103 105 104 int ?==?( Rational l, Rational r ) { 106 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 107 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 105 108 return l.numerator * r.denominator == l.denominator * r.numerator; 106 109 } // ?==? 107 110 108 int ?!=?( Rational l, Rational r ) { 111 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 112 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 109 113 return ! ( l == r ); 110 114 } // ?!=? 111 115 112 int ?<?( Rational l, Rational r ) { 116 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 117 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 113 118 return l.numerator * r.denominator < l.denominator * r.numerator; 114 119 } // ?<? 115 120 116 int ?<=?( Rational l, Rational r ) { 117 return l < r || l == r; 121 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 122 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 123 return l.numerator * r.denominator <= l.denominator * r.numerator; 118 124 } // ?<=? 119 125 120 int ?>?( Rational l, Rational r ) { 126 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 127 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 121 128 return ! ( l <= r ); 122 129 } // ?>? 123 130 124 int ?>=?( Rational l, Rational r ) { 131 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 132 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 125 133 return ! ( l < r ); 126 134 } // ?>=? … … 129 137 // arithmetic 130 138 131 Rational -?( Rational r ) { 132 Rational t = { -r.numerator, r.denominator }; 139 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 140 Rational(RationalImpl) +?( Rational(RationalImpl) r ) { 141 Rational(RationalImpl) t = { r.numerator, r.denominator }; 142 return t; 143 } // +? 144 145 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 146 Rational(RationalImpl) -?( Rational(RationalImpl) r ) { 147 Rational(RationalImpl) t = { -r.numerator, r.denominator }; 133 148 return t; 134 149 } // -? 135 150 136 Rational ?+?( Rational l, Rational r ) { 151 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 152 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 137 153 if ( l.denominator == r.denominator ) { // special case 138 Rational t = { l.numerator + r.numerator, l.denominator };154 Rational(RationalImpl) t = { l.numerator + r.numerator, l.denominator }; 139 155 return t; 140 156 } else { 141 Rational t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };157 Rational(RationalImpl) t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator }; 142 158 return t; 143 159 } // if 144 160 } // ?+? 145 161 146 Rational ?-?( Rational l, Rational r ) { 162 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 163 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 147 164 if ( l.denominator == r.denominator ) { // special case 148 Rational t = { l.numerator - r.numerator, l.denominator };165 Rational(RationalImpl) t = { l.numerator - r.numerator, l.denominator }; 149 166 return t; 150 167 } else { 151 Rational t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };168 Rational(RationalImpl) t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator }; 152 169 return t; 153 170 } // if 154 171 } // ?-? 155 172 156 Rational ?*?( Rational l, Rational r ) { 157 Rational t = { l.numerator * r.numerator, l.denominator * r.denominator }; 173 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 174 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 175 Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator }; 158 176 return t; 159 177 } // ?*? 160 178 161 Rational ?/?( Rational l, Rational r ) { 162 if ( r.numerator < 0 ) { 179 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 180 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 181 if ( r.numerator < (RationalImpl){0} ) { 163 182 r.numerator = -r.numerator; 164 183 r.denominator = -r.denominator; 165 184 } // if 166 Rational t = { l.numerator * r.denominator, l.denominator * r.numerator };185 Rational(RationalImpl) t = { l.numerator * r.denominator, l.denominator * r.numerator }; 167 186 return t; 168 187 } // ?/? … … 171 190 // conversion 172 191 173 double widen( Rational r ) { 174 return (double)r.numerator / (double)r.denominator; 175 } // widen 176 177 // http://www.ics.uci.edu/~eppstein/numth/frap.c 178 Rational narrow( double f, RationalImpl md ) { 179 if ( md <= 1 ) { // maximum fractional digits too small? 180 return (Rational){ f, 1}; // truncate fraction 181 } // if 182 183 // continued fraction coefficients 184 RationalImpl m00 = 1, m11 = 1, m01 = 0, m10 = 0; 185 RationalImpl ai, t; 186 187 // find terms until denom gets too big 188 for ( ;; ) { 189 ai = (RationalImpl)f; 190 if ( ! (m10 * ai + m11 <= md) ) break; 191 t = m00 * ai + m01; 192 m01 = m00; 193 m00 = t; 194 t = m10 * ai + m11; 195 m11 = m10; 196 m10 = t; 197 t = (double)ai; 198 if ( f == t ) break; // prevent division by zero 199 f = 1 / (f - t); 200 if ( f > (double)0x7FFFFFFF ) break; // representation failure 201 } 202 return (Rational){ m00, m10 }; 203 } // narrow 192 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 193 // double widen( Rational(RationalImpl) r ) { 194 // return (double)r.numerator / (double)r.denominator; 195 // } // widen 196 197 // // http://www.ics.uci.edu/~eppstein/numth/frap.c 198 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 199 // Rational(RationalImpl) narrow( double f, RationalImpl md ) { 200 // if ( md <= 1 ) { // maximum fractional digits too small? 201 // return (Rational(RationalImpl)){ f, 1}; // truncate fraction 202 // } // if 203 204 // // continued fraction coefficients 205 // RationalImpl m00 = 1, m11 = 1, m01 = 0, m10 = 0; 206 // RationalImpl ai, t; 207 208 // // find terms until denom gets too big 209 // for ( ;; ) { 210 // ai = (RationalImpl)f; 211 // if ( ! (m10 * ai + m11 <= md) ) break; 212 // t = m00 * ai + m01; 213 // m01 = m00; 214 // m00 = t; 215 // t = m10 * ai + m11; 216 // m11 = m10; 217 // m10 = t; 218 // t = (double)ai; 219 // if ( f == t ) break; // prevent division by zero 220 // f = 1 / (f - (double)t); 221 // if ( f > (double)0x7FFFFFFF ) break; // representation failure 222 // } 223 // return (Rational(RationalImpl)){ m00, m10 }; 224 // } // narrow 204 225 205 226 206 227 // I/O 207 228 208 forall( dtype istype | istream( istype ) ) 209 istype * ?|?( istype *is, Rational *r ) { 229 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 230 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 231 istype * ?|?( istype * is, Rational(RationalImpl) * r ) { 210 232 RationalImpl t; 211 233 is | &(r->numerator) | &(r->denominator); … … 216 238 } // ?|? 217 239 218 forall( dtype ostype | ostream( ostype ) ) 219 ostype * ?|?( ostype *os, Rational r ) { 240 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 241 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 242 ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) { 220 243 return os | r.numerator | '/' | r.denominator; 221 244 } // ?|? -
src/libcfa/stdlib
rdbfb35d r3bd1eb4 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 1 17:35:24 201713 // Update Count : 10 412 // Last Modified On : Tue May 9 08:42:44 2017 13 // Update Count : 107 14 14 // 15 15 … … 84 84 forall( otype T | { int ?<?( T, T ); } ) 85 85 T * bsearch( T key, const T * arr, size_t dimension ); 86 86 87 forall( otype T | { int ?<?( T, T ); } ) 87 88 unsigned int bsearch( T key, const T * arr, size_t dimension ); 89 88 90 89 91 forall( otype T | { int ?<?( T, T ); } ) … … 107 109 double abs( double _Complex ); 108 110 long double abs( long double _Complex ); 111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } ) 112 T abs( T ); 109 113 110 114 //--------------------------------------- -
src/libcfa/stdlib.c
rdbfb35d r3bd1eb4 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 16 10:41:05201713 // Update Count : 1 8912 // Last Modified On : Tue May 9 08:43:00 2017 13 // Update Count : 191 14 14 // 15 15 … … 27 27 } // extern "C" 28 28 29 forall( dtype T | sized(T) ) T * malloc( void ) { 30 //printf( "malloc1\n" ); 31 return (T *)(void*)malloc( (size_t)sizeof(T) ); 29 forall( dtype T | sized(T) ) T * malloc( void ) { // type-safe 30 return (T *)(void *)malloc( (size_t)sizeof(T) ); 32 31 } // malloc 33 forall( dtype T | sized(T) ) T * malloc( char fill ) { 34 //printf( "malloc3\n" ); 35 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) );32 33 forall( dtype T | sized(T) ) T * malloc( char fill ) { // initial with fill value (like calloc) 34 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); 36 35 return memset( ptr, (int)fill, sizeof(T) ); 37 36 } // malloc 38 37 39 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) { 40 //printf( "calloc\n" ); 38 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) { // alternative realloc 39 return (T *)realloc( ptr, size ); 40 } // malloc 41 42 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value 43 return (T *)realloc( ptr, size, fill ); 44 } // malloc 45 46 47 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) { // type-safe array initialization with fill 0 41 48 return (T *)calloc( nmemb, sizeof(T) ); 42 49 } // calloc 43 50 44 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { 45 //printf( "realloc1\n" ); 51 52 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { // type-safe 46 53 return (T *)(void *)realloc( (void *)ptr, size ); 47 54 } // realloc 48 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { 49 //printf( "realloc2\n" ); 55 56 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value 50 57 char * nptr = (T *)(void *)realloc( (void *)ptr, size ); 51 58 size_t unused = malloc_usable_size( nptr ); … … 54 61 } // realloc 55 62 56 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) { 57 //printf( "malloc4\n" ); 58 return (T *)realloc( ptr, size ); 59 } // malloc 60 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ) { 61 //printf( "malloc5\n" ); 62 return (T *)realloc( ptr, size, fill ); 63 } // malloc 64 65 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { 66 //printf( "aligned_alloc\n" ); 63 64 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { // aligned allocation 67 65 return (T *)memalign( alignment, sizeof(T) ); 68 66 } // aligned_alloc 69 67 70 68 forall( dtype T | sized(T) ) T * memalign( size_t alignment ) { 71 //printf( "memalign\n" );72 69 return (T *)memalign( alignment, sizeof(T) ); 73 70 } // memalign 74 71 75 72 forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ) { 76 //printf( "posix_memalign\n" );77 73 return posix_memalign( (void **)ptr, alignment, sizeof(T) ); 78 74 } // posix_memalign 79 75 80 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) 76 77 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) // new 81 78 T * new( Params p ) { 82 79 return ((T *)malloc()){ p }; 83 } 84 85 forall( dtype T | { void ^?{}(T *); } ) 80 } // new 81 82 forall( dtype T | { void ^?{}(T *); } ) // delete 86 83 void delete( T * ptr ) { 87 if ( ptr ) {88 ^ptr{};89 free( ptr );90 }91 } 84 if ( ptr ) { 85 ^ptr{}; 86 free( ptr ); 87 } 88 } // delete 92 89 93 90 forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) … … 98 95 } 99 96 delete( rest ); 100 } 97 } // delete 101 98 102 99 //--------------------------------------- … … 106 103 if ( sscanf( ptr, "%d", &i ) == EOF ) {} 107 104 return i; 108 } 105 } // ato 106 109 107 unsigned int ato( const char * ptr ) { 110 108 unsigned int ui; 111 109 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} 112 110 return ui; 113 } 111 } // ato 112 114 113 long int ato( const char * ptr ) { 115 114 long int li; 116 115 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} 117 116 return li; 118 } 117 } // ato 118 119 119 unsigned long int ato( const char * ptr ) { 120 120 unsigned long int uli; 121 121 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} 122 122 return uli; 123 } 123 } // ato 124 124 125 long long int ato( const char * ptr ) { 125 126 long long int lli; 126 127 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} 127 128 return lli; 128 } 129 } // ato 130 129 131 unsigned long long int ato( const char * ptr ) { 130 132 unsigned long long int ulli; 131 133 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} 132 134 return ulli; 133 } 135 } // ato 136 134 137 135 138 float ato( const char * ptr ) { … … 137 140 if ( sscanf( ptr, "%f", &f ) == EOF ) {} 138 141 return f; 139 } 142 } // ato 143 140 144 double ato( const char * ptr ) { 141 145 double d; 142 146 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} 143 147 return d; 144 } 148 } // ato 149 145 150 long double ato( const char * ptr ) { 146 151 long double ld; 147 152 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} 148 153 return ld; 149 } 154 } // ato 155 150 156 151 157 float _Complex ato( const char * ptr ) { … … 153 159 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} 154 160 return re + im * _Complex_I; 155 } 161 } // ato 162 156 163 double _Complex ato( const char * ptr ) { 157 164 double re, im; 158 165 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} 159 166 return re + im * _Complex_I; 160 } 167 } // ato 168 161 169 long double _Complex ato( const char * ptr ) { 162 170 long double re, im; 163 171 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} 164 172 return re + im * _Complex_I; 165 } 173 } // ato 174 166 175 167 176 int strto( const char * sptr, char ** eptr, int base ) { 168 177 return (int)strtol( sptr, eptr, base ); 169 } 178 } // strto 179 170 180 unsigned int strto( const char * sptr, char ** eptr, int base ) { 171 181 return (unsigned int)strtoul( sptr, eptr, base ); 172 } 182 } // strto 183 173 184 long int strto( const char * sptr, char ** eptr, int base ) { 174 185 return strtol( sptr, eptr, base ); 175 } 186 } // strto 187 176 188 unsigned long int strto( const char * sptr, char ** eptr, int base ) { 177 189 return strtoul( sptr, eptr, base ); 178 } 190 } // strto 191 179 192 long long int strto( const char * sptr, char ** eptr, int base ) { 180 193 return strtoll( sptr, eptr, base ); 181 } 194 } // strto 195 182 196 unsigned long long int strto( const char * sptr, char ** eptr, int base ) { 183 197 return strtoull( sptr, eptr, base ); 184 } 198 } // strto 199 185 200 186 201 float strto( const char * sptr, char ** eptr ) { 187 202 return strtof( sptr, eptr ); 188 } 203 } // strto 204 189 205 double strto( const char * sptr, char ** eptr ) { 190 206 return strtod( sptr, eptr ); 191 } 207 } // strto 208 192 209 long double strto( const char * sptr, char ** eptr ) { 193 210 return strtold( sptr, eptr ); 194 } 211 } // strto 212 195 213 196 214 float _Complex strto( const char * sptr, char ** eptr ) { … … 201 219 if ( sptr == *eptr ) return 0.0; 202 220 return re + im * _Complex_I; 203 } 221 } // strto 222 204 223 double _Complex strto( const char * sptr, char ** eptr ) { 205 224 double re, im; … … 209 228 if ( sptr == *eptr ) return 0.0; 210 229 return re + im * _Complex_I; 211 } 230 } // strto 231 212 232 long double _Complex strto( const char * sptr, char ** eptr ) { 213 233 long double re, im; … … 217 237 if ( sptr == *eptr ) return 0.0; 218 238 return re + im * _Complex_I; 219 } 239 } // strto 220 240 221 241 //--------------------------------------- -
src/main.cc
rdbfb35d r3bd1eb4 1 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo … … 9 10 // Author : Richard C. Bilson 10 11 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Dec 14 14:35:54 201613 // Update Count : 43 612 // Last Modified By : Andrew Beach 13 // Last Modified On : Wed May 10 14:45:00 2017 14 // Update Count : 437 14 15 // 15 16 … … 79 80 errorp = false, 80 81 codegenp = false, 81 prettycodegenp = false; 82 prettycodegenp = false, 83 nolinemarks = false; 82 84 83 85 static void parse_cmdline( int argc, char *argv[], const char *& filename ); … … 310 312 311 313 CodeTools::fillLocations( translationUnit ); 312 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true );314 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, ! nolinemarks ); 313 315 314 316 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" ); … … 336 338 } catch ( CompilerError &e ) { 337 339 cerr << "Compiler Error: " << e.get_what() << endl; 338 cerr << "(please report bugs to " << endl;340 cerr << "(please report bugs to [REDACTED])" << endl; 339 341 if ( output != &cout ) { 340 342 delete output; … … 375 377 376 378 int c; 377 while ( (c = getopt_long( argc, argv, "abBcdefgl mnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {379 while ( (c = getopt_long( argc, argv, "abBcdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) { 378 380 switch ( c ) { 379 381 case Ast: … … 411 413 case 'l': // generate libcfa.c 412 414 libcfap = true; 415 break; 416 case 'L': // surpress lines marks 417 nolinemarks = true; 413 418 break; 414 419 case Nopreamble: -
src/prelude/Makefile.am
rdbfb35d r3bd1eb4 42 42 43 43 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 44 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@ # use src/cfa-cpp as not in lib until after install44 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 45 45 46 46 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} -
src/prelude/Makefile.in
rdbfb35d r3bd1eb4 439 439 440 440 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 441 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@ # use src/cfa-cpp as not in lib until after install441 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 442 442 443 443 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
src/tests/.expect/32/KRfunctions.txt
rdbfb35d r3bd1eb4 31 31 } 32 32 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 33 struct S ___ret__2sS_1; 33 34 ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1)); 34 return ((struct S )___src__2sS_1); 35 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 36 return ((struct S )___ret__2sS_1); 35 37 } 36 38 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){ -
src/tests/.expect/32/attributes.txt
rdbfb35d r3bd1eb4 22 22 } 23 23 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 24 struct __anonymous0 ___ret__13s__anonymous0_1; 25 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 26 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 25 27 } 26 28 __attribute__ ((unused)) struct Agn1; … … 38 40 } 39 41 static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 40 return ((struct Agn2 )___src__5sAgn2_1); 42 struct Agn2 ___ret__5sAgn2_1; 43 ((void)___constructor__F_P5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1)); 44 return ((struct Agn2 )___ret__5sAgn2_1); 41 45 } 42 46 enum __attribute__ ((unused)) __anonymous1 { … … 99 103 } 100 104 static inline struct Fdl ___operator_assign__F4sFdl_P4sFdl4sFdl_autogen___1(struct Fdl *___dst__P4sFdl_1, struct Fdl ___src__4sFdl_1){ 105 struct Fdl ___ret__4sFdl_1; 101 106 ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1)); 102 107 ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1)); … … 108 113 ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1)); 109 114 ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1)); 110 return ((struct Fdl )___src__4sFdl_1); 115 ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1)); 116 return ((struct Fdl )___ret__4sFdl_1); 111 117 } 112 118 static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){ … … 292 298 } 293 299 inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, struct __anonymous4 ___src__13s__anonymous4_2){ 300 struct __anonymous4 ___ret__13s__anonymous4_2; 294 301 ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2)); 295 return ((struct __anonymous4 )___src__13s__anonymous4_2); 302 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2)); 303 return ((struct __anonymous4 )___ret__13s__anonymous4_2); 296 304 } 297 305 inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){ … … 310 318 } 311 319 inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){ 312 return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)); 320 enum __anonymous5 ___ret__13e__anonymous5_2; 321 ((void)(___ret__13e__anonymous5_2=((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */); 322 return ((enum __anonymous5 )___ret__13e__anonymous5_2); 313 323 } 314 324 ((void)sizeof(enum __anonymous5 )); … … 338 348 } 339 349 static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){ 340 return ((struct Vad )___src__4sVad_1); 341 } 350 struct Vad ___ret__4sVad_1; 351 ((void)___constructor__F_P4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1)); 352 return ((struct Vad )___ret__4sVad_1); 353 } -
src/tests/.expect/32/declarationSpecifier.txt
rdbfb35d r3bd1eb4 30 30 } 31 31 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 struct __anonymous0 ___ret__13s__anonymous0_1; 32 33 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 33 return ((struct __anonymous0 )___src__13s__anonymous0_1); 34 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 35 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 34 36 } 35 37 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 54 56 } 55 57 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 58 struct __anonymous1 ___ret__13s__anonymous1_1; 56 59 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 57 return ((struct __anonymous1 )___src__13s__anonymous1_1); 60 ((void)___constructor__F_P13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1)); 61 return ((struct __anonymous1 )___ret__13s__anonymous1_1); 58 62 } 59 63 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 78 82 } 79 83 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 84 struct __anonymous2 ___ret__13s__anonymous2_1; 80 85 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 81 return ((struct __anonymous2 )___src__13s__anonymous2_1); 86 ((void)___constructor__F_P13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1)); 87 return ((struct __anonymous2 )___ret__13s__anonymous2_1); 82 88 } 83 89 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 102 108 } 103 109 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 110 struct __anonymous3 ___ret__13s__anonymous3_1; 104 111 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 105 return ((struct __anonymous3 )___src__13s__anonymous3_1); 112 ((void)___constructor__F_P13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1)); 113 return ((struct __anonymous3 )___ret__13s__anonymous3_1); 106 114 } 107 115 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 126 134 } 127 135 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 136 struct __anonymous4 ___ret__13s__anonymous4_1; 128 137 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 129 return ((struct __anonymous4 )___src__13s__anonymous4_1); 138 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1)); 139 return ((struct __anonymous4 )___ret__13s__anonymous4_1); 130 140 } 131 141 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 150 160 } 151 161 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 162 struct __anonymous5 ___ret__13s__anonymous5_1; 152 163 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 153 return ((struct __anonymous5 )___src__13s__anonymous5_1); 164 ((void)___constructor__F_P13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1)); 165 return ((struct __anonymous5 )___ret__13s__anonymous5_1); 154 166 } 155 167 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 174 186 } 175 187 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 188 struct __anonymous6 ___ret__13s__anonymous6_1; 176 189 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 177 return ((struct __anonymous6 )___src__13s__anonymous6_1); 190 ((void)___constructor__F_P13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1)); 191 return ((struct __anonymous6 )___ret__13s__anonymous6_1); 178 192 } 179 193 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 198 212 } 199 213 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 214 struct __anonymous7 ___ret__13s__anonymous7_1; 200 215 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 201 return ((struct __anonymous7 )___src__13s__anonymous7_1); 216 ((void)___constructor__F_P13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1)); 217 return ((struct __anonymous7 )___ret__13s__anonymous7_1); 202 218 } 203 219 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 230 246 } 231 247 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 248 struct __anonymous8 ___ret__13s__anonymous8_1; 232 249 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 233 return ((struct __anonymous8 )___src__13s__anonymous8_1); 250 ((void)___constructor__F_P13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1)); 251 return ((struct __anonymous8 )___ret__13s__anonymous8_1); 234 252 } 235 253 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 254 272 } 255 273 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 274 struct __anonymous9 ___ret__13s__anonymous9_1; 256 275 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 257 return ((struct __anonymous9 )___src__13s__anonymous9_1); 276 ((void)___constructor__F_P13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1)); 277 return ((struct __anonymous9 )___ret__13s__anonymous9_1); 258 278 } 259 279 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 278 298 } 279 299 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 300 struct __anonymous10 ___ret__14s__anonymous10_1; 280 301 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 281 return ((struct __anonymous10 )___src__14s__anonymous10_1); 302 ((void)___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1)); 303 return ((struct __anonymous10 )___ret__14s__anonymous10_1); 282 304 } 283 305 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 302 324 } 303 325 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 326 struct __anonymous11 ___ret__14s__anonymous11_1; 304 327 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 305 return ((struct __anonymous11 )___src__14s__anonymous11_1); 328 ((void)___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1)); 329 return ((struct __anonymous11 )___ret__14s__anonymous11_1); 306 330 } 307 331 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 326 350 } 327 351 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 352 struct __anonymous12 ___ret__14s__anonymous12_1; 328 353 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 329 return ((struct __anonymous12 )___src__14s__anonymous12_1); 354 ((void)___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1)); 355 return ((struct __anonymous12 )___ret__14s__anonymous12_1); 330 356 } 331 357 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 350 376 } 351 377 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 378 struct __anonymous13 ___ret__14s__anonymous13_1; 352 379 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 353 return ((struct __anonymous13 )___src__14s__anonymous13_1); 380 ((void)___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1)); 381 return ((struct __anonymous13 )___ret__14s__anonymous13_1); 354 382 } 355 383 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 374 402 } 375 403 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 404 struct __anonymous14 ___ret__14s__anonymous14_1; 376 405 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 377 return ((struct __anonymous14 )___src__14s__anonymous14_1); 406 ((void)___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1)); 407 return ((struct __anonymous14 )___ret__14s__anonymous14_1); 378 408 } 379 409 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 398 428 } 399 429 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 430 struct __anonymous15 ___ret__14s__anonymous15_1; 400 431 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 401 return ((struct __anonymous15 )___src__14s__anonymous15_1); 432 ((void)___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1)); 433 return ((struct __anonymous15 )___ret__14s__anonymous15_1); 402 434 } 403 435 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 438 470 } 439 471 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 472 struct __anonymous16 ___ret__14s__anonymous16_1; 440 473 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 441 return ((struct __anonymous16 )___src__14s__anonymous16_1); 474 ((void)___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1)); 475 return ((struct __anonymous16 )___ret__14s__anonymous16_1); 442 476 } 443 477 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 462 496 } 463 497 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 498 struct __anonymous17 ___ret__14s__anonymous17_1; 464 499 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 465 return ((struct __anonymous17 )___src__14s__anonymous17_1); 500 ((void)___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1)); 501 return ((struct __anonymous17 )___ret__14s__anonymous17_1); 466 502 } 467 503 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 486 522 } 487 523 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 524 struct __anonymous18 ___ret__14s__anonymous18_1; 488 525 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 489 return ((struct __anonymous18 )___src__14s__anonymous18_1); 526 ((void)___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1)); 527 return ((struct __anonymous18 )___ret__14s__anonymous18_1); 490 528 } 491 529 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 510 548 } 511 549 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 550 struct __anonymous19 ___ret__14s__anonymous19_1; 512 551 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 513 return ((struct __anonymous19 )___src__14s__anonymous19_1); 552 ((void)___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1)); 553 return ((struct __anonymous19 )___ret__14s__anonymous19_1); 514 554 } 515 555 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 534 574 } 535 575 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 576 struct __anonymous20 ___ret__14s__anonymous20_1; 536 577 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 537 return ((struct __anonymous20 )___src__14s__anonymous20_1); 578 ((void)___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1)); 579 return ((struct __anonymous20 )___ret__14s__anonymous20_1); 538 580 } 539 581 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 558 600 } 559 601 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 602 struct __anonymous21 ___ret__14s__anonymous21_1; 560 603 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 561 return ((struct __anonymous21 )___src__14s__anonymous21_1); 604 ((void)___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1)); 605 return ((struct __anonymous21 )___ret__14s__anonymous21_1); 562 606 } 563 607 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 582 626 } 583 627 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 628 struct __anonymous22 ___ret__14s__anonymous22_1; 584 629 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 585 return ((struct __anonymous22 )___src__14s__anonymous22_1); 630 ((void)___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1)); 631 return ((struct __anonymous22 )___ret__14s__anonymous22_1); 586 632 } 587 633 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 606 652 } 607 653 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 654 struct __anonymous23 ___ret__14s__anonymous23_1; 608 655 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 609 return ((struct __anonymous23 )___src__14s__anonymous23_1); 656 ((void)___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1)); 657 return ((struct __anonymous23 )___ret__14s__anonymous23_1); 610 658 } 611 659 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ -
src/tests/.expect/32/extension.txt
rdbfb35d r3bd1eb4 33 33 } 34 34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 35 struct S ___ret__2sS_1; 35 36 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 36 37 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 37 38 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 38 return ((struct S )___src__2sS_1); 39 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 40 return ((struct S )___ret__2sS_1); 39 41 } 40 42 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 66 68 } 67 69 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 70 union U ___ret__2uU_1; 68 71 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 69 return ((union U )___src__2uU_1); 72 ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1)); 73 return ((union U )___ret__2uU_1); 70 74 } 71 75 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ -
src/tests/.expect/32/gccExtensions.txt
rdbfb35d r3bd1eb4 59 59 } 60 60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 61 struct S ___ret__2sS_2; 61 62 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 62 63 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 63 64 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 64 return ((struct S )___src__2sS_2); 65 ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2)); 66 return ((struct S )___ret__2sS_2); 65 67 } 66 68 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 109 111 } 110 112 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 113 struct s2 ___ret__3ss2_2; 111 114 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 112 return ((struct s2 )___src__3ss2_2); 115 ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2)); 116 return ((struct s2 )___ret__3ss2_2); 113 117 } 114 118 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ … … 128 132 } 129 133 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 134 struct s3 ___ret__3ss3_2; 130 135 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 131 return ((struct s3 )___src__3ss3_2); 136 ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2)); 137 return ((struct s3 )___ret__3ss3_2); 132 138 } 133 139 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ … … 149 155 } 150 156 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 157 struct s4 ___ret__3ss4_2; 151 158 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 152 return ((struct s4 )___src__3ss4_2); 159 ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2)); 160 return ((struct s4 )___ret__3ss4_2); 153 161 } 154 162 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ -
src/tests/.expect/64/KRfunctions.txt
rdbfb35d r3bd1eb4 31 31 } 32 32 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 33 struct S ___ret__2sS_1; 33 34 ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1)); 34 return ((struct S )___src__2sS_1); 35 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 36 return ((struct S )___ret__2sS_1); 35 37 } 36 38 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){ -
src/tests/.expect/64/attributes.txt
rdbfb35d r3bd1eb4 22 22 } 23 23 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 24 struct __anonymous0 ___ret__13s__anonymous0_1; 25 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 26 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 25 27 } 26 28 __attribute__ ((unused)) struct Agn1; … … 38 40 } 39 41 static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 40 return ((struct Agn2 )___src__5sAgn2_1); 42 struct Agn2 ___ret__5sAgn2_1; 43 ((void)___constructor__F_P5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1)); 44 return ((struct Agn2 )___ret__5sAgn2_1); 41 45 } 42 46 enum __attribute__ ((unused)) __anonymous1 { … … 99 103 } 100 104 static inline struct Fdl ___operator_assign__F4sFdl_P4sFdl4sFdl_autogen___1(struct Fdl *___dst__P4sFdl_1, struct Fdl ___src__4sFdl_1){ 105 struct Fdl ___ret__4sFdl_1; 101 106 ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1)); 102 107 ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1)); … … 108 113 ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1)); 109 114 ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1)); 110 return ((struct Fdl )___src__4sFdl_1); 115 ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1)); 116 return ((struct Fdl )___ret__4sFdl_1); 111 117 } 112 118 static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){ … … 292 298 } 293 299 inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, struct __anonymous4 ___src__13s__anonymous4_2){ 300 struct __anonymous4 ___ret__13s__anonymous4_2; 294 301 ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2)); 295 return ((struct __anonymous4 )___src__13s__anonymous4_2); 302 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2)); 303 return ((struct __anonymous4 )___ret__13s__anonymous4_2); 296 304 } 297 305 inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){ … … 310 318 } 311 319 inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){ 312 return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)); 320 enum __anonymous5 ___ret__13e__anonymous5_2; 321 ((void)(___ret__13e__anonymous5_2=((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */); 322 return ((enum __anonymous5 )___ret__13e__anonymous5_2); 313 323 } 314 324 ((void)sizeof(enum __anonymous5 )); … … 338 348 } 339 349 static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){ 340 return ((struct Vad )___src__4sVad_1); 341 } 350 struct Vad ___ret__4sVad_1; 351 ((void)___constructor__F_P4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1)); 352 return ((struct Vad )___ret__4sVad_1); 353 } -
src/tests/.expect/64/declarationSpecifier.txt
rdbfb35d r3bd1eb4 30 30 } 31 31 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 struct __anonymous0 ___ret__13s__anonymous0_1; 32 33 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 33 return ((struct __anonymous0 )___src__13s__anonymous0_1); 34 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 35 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 34 36 } 35 37 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 54 56 } 55 57 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 58 struct __anonymous1 ___ret__13s__anonymous1_1; 56 59 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 57 return ((struct __anonymous1 )___src__13s__anonymous1_1); 60 ((void)___constructor__F_P13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1)); 61 return ((struct __anonymous1 )___ret__13s__anonymous1_1); 58 62 } 59 63 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 78 82 } 79 83 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 84 struct __anonymous2 ___ret__13s__anonymous2_1; 80 85 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 81 return ((struct __anonymous2 )___src__13s__anonymous2_1); 86 ((void)___constructor__F_P13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1)); 87 return ((struct __anonymous2 )___ret__13s__anonymous2_1); 82 88 } 83 89 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 102 108 } 103 109 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 110 struct __anonymous3 ___ret__13s__anonymous3_1; 104 111 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 105 return ((struct __anonymous3 )___src__13s__anonymous3_1); 112 ((void)___constructor__F_P13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1)); 113 return ((struct __anonymous3 )___ret__13s__anonymous3_1); 106 114 } 107 115 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 126 134 } 127 135 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 136 struct __anonymous4 ___ret__13s__anonymous4_1; 128 137 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 129 return ((struct __anonymous4 )___src__13s__anonymous4_1); 138 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1)); 139 return ((struct __anonymous4 )___ret__13s__anonymous4_1); 130 140 } 131 141 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 150 160 } 151 161 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 162 struct __anonymous5 ___ret__13s__anonymous5_1; 152 163 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 153 return ((struct __anonymous5 )___src__13s__anonymous5_1); 164 ((void)___constructor__F_P13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1)); 165 return ((struct __anonymous5 )___ret__13s__anonymous5_1); 154 166 } 155 167 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 174 186 } 175 187 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 188 struct __anonymous6 ___ret__13s__anonymous6_1; 176 189 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 177 return ((struct __anonymous6 )___src__13s__anonymous6_1); 190 ((void)___constructor__F_P13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1)); 191 return ((struct __anonymous6 )___ret__13s__anonymous6_1); 178 192 } 179 193 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 198 212 } 199 213 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 214 struct __anonymous7 ___ret__13s__anonymous7_1; 200 215 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 201 return ((struct __anonymous7 )___src__13s__anonymous7_1); 216 ((void)___constructor__F_P13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1)); 217 return ((struct __anonymous7 )___ret__13s__anonymous7_1); 202 218 } 203 219 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 230 246 } 231 247 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 248 struct __anonymous8 ___ret__13s__anonymous8_1; 232 249 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 233 return ((struct __anonymous8 )___src__13s__anonymous8_1); 250 ((void)___constructor__F_P13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1)); 251 return ((struct __anonymous8 )___ret__13s__anonymous8_1); 234 252 } 235 253 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 254 272 } 255 273 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 274 struct __anonymous9 ___ret__13s__anonymous9_1; 256 275 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 257 return ((struct __anonymous9 )___src__13s__anonymous9_1); 276 ((void)___constructor__F_P13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1)); 277 return ((struct __anonymous9 )___ret__13s__anonymous9_1); 258 278 } 259 279 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 278 298 } 279 299 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 300 struct __anonymous10 ___ret__14s__anonymous10_1; 280 301 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 281 return ((struct __anonymous10 )___src__14s__anonymous10_1); 302 ((void)___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1)); 303 return ((struct __anonymous10 )___ret__14s__anonymous10_1); 282 304 } 283 305 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 302 324 } 303 325 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 326 struct __anonymous11 ___ret__14s__anonymous11_1; 304 327 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 305 return ((struct __anonymous11 )___src__14s__anonymous11_1); 328 ((void)___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1)); 329 return ((struct __anonymous11 )___ret__14s__anonymous11_1); 306 330 } 307 331 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 326 350 } 327 351 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 352 struct __anonymous12 ___ret__14s__anonymous12_1; 328 353 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 329 return ((struct __anonymous12 )___src__14s__anonymous12_1); 354 ((void)___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1)); 355 return ((struct __anonymous12 )___ret__14s__anonymous12_1); 330 356 } 331 357 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 350 376 } 351 377 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 378 struct __anonymous13 ___ret__14s__anonymous13_1; 352 379 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 353 return ((struct __anonymous13 )___src__14s__anonymous13_1); 380 ((void)___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1)); 381 return ((struct __anonymous13 )___ret__14s__anonymous13_1); 354 382 } 355 383 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 374 402 } 375 403 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 404 struct __anonymous14 ___ret__14s__anonymous14_1; 376 405 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 377 return ((struct __anonymous14 )___src__14s__anonymous14_1); 406 ((void)___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1)); 407 return ((struct __anonymous14 )___ret__14s__anonymous14_1); 378 408 } 379 409 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 398 428 } 399 429 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 430 struct __anonymous15 ___ret__14s__anonymous15_1; 400 431 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 401 return ((struct __anonymous15 )___src__14s__anonymous15_1); 432 ((void)___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1)); 433 return ((struct __anonymous15 )___ret__14s__anonymous15_1); 402 434 } 403 435 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 438 470 } 439 471 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 472 struct __anonymous16 ___ret__14s__anonymous16_1; 440 473 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 441 return ((struct __anonymous16 )___src__14s__anonymous16_1); 474 ((void)___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1)); 475 return ((struct __anonymous16 )___ret__14s__anonymous16_1); 442 476 } 443 477 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 462 496 } 463 497 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 498 struct __anonymous17 ___ret__14s__anonymous17_1; 464 499 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 465 return ((struct __anonymous17 )___src__14s__anonymous17_1); 500 ((void)___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1)); 501 return ((struct __anonymous17 )___ret__14s__anonymous17_1); 466 502 } 467 503 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 486 522 } 487 523 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 524 struct __anonymous18 ___ret__14s__anonymous18_1; 488 525 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 489 return ((struct __anonymous18 )___src__14s__anonymous18_1); 526 ((void)___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1)); 527 return ((struct __anonymous18 )___ret__14s__anonymous18_1); 490 528 } 491 529 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 510 548 } 511 549 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 550 struct __anonymous19 ___ret__14s__anonymous19_1; 512 551 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 513 return ((struct __anonymous19 )___src__14s__anonymous19_1); 552 ((void)___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1)); 553 return ((struct __anonymous19 )___ret__14s__anonymous19_1); 514 554 } 515 555 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 534 574 } 535 575 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 576 struct __anonymous20 ___ret__14s__anonymous20_1; 536 577 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 537 return ((struct __anonymous20 )___src__14s__anonymous20_1); 578 ((void)___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1)); 579 return ((struct __anonymous20 )___ret__14s__anonymous20_1); 538 580 } 539 581 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 558 600 } 559 601 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 602 struct __anonymous21 ___ret__14s__anonymous21_1; 560 603 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 561 return ((struct __anonymous21 )___src__14s__anonymous21_1); 604 ((void)___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1)); 605 return ((struct __anonymous21 )___ret__14s__anonymous21_1); 562 606 } 563 607 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 582 626 } 583 627 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 628 struct __anonymous22 ___ret__14s__anonymous22_1; 584 629 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 585 return ((struct __anonymous22 )___src__14s__anonymous22_1); 630 ((void)___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1)); 631 return ((struct __anonymous22 )___ret__14s__anonymous22_1); 586 632 } 587 633 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 606 652 } 607 653 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 654 struct __anonymous23 ___ret__14s__anonymous23_1; 608 655 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 609 return ((struct __anonymous23 )___src__14s__anonymous23_1); 656 ((void)___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1)); 657 return ((struct __anonymous23 )___ret__14s__anonymous23_1); 610 658 } 611 659 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ -
src/tests/.expect/64/extension.txt
rdbfb35d r3bd1eb4 33 33 } 34 34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 35 struct S ___ret__2sS_1; 35 36 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 36 37 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 37 38 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 38 return ((struct S )___src__2sS_1); 39 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 40 return ((struct S )___ret__2sS_1); 39 41 } 40 42 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 66 68 } 67 69 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 70 union U ___ret__2uU_1; 68 71 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 69 return ((union U )___src__2uU_1); 72 ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1)); 73 return ((union U )___ret__2uU_1); 70 74 } 71 75 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ -
src/tests/.expect/64/gccExtensions.txt
rdbfb35d r3bd1eb4 59 59 } 60 60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 61 struct S ___ret__2sS_2; 61 62 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 62 63 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 63 64 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 64 return ((struct S )___src__2sS_2); 65 ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2)); 66 return ((struct S )___ret__2sS_2); 65 67 } 66 68 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 109 111 } 110 112 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 113 struct s2 ___ret__3ss2_2; 111 114 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 112 return ((struct s2 )___src__3ss2_2); 115 ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2)); 116 return ((struct s2 )___ret__3ss2_2); 113 117 } 114 118 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ … … 128 132 } 129 133 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 134 struct s3 ___ret__3ss3_2; 130 135 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 131 return ((struct s3 )___src__3ss3_2); 136 ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2)); 137 return ((struct s3 )___ret__3ss3_2); 132 138 } 133 139 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ … … 149 155 } 150 156 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 157 struct s4 ___ret__3ss4_2; 151 158 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 152 return ((struct s4 )___src__3ss4_2); 159 ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2)); 160 return ((struct s4 )___ret__3ss4_2); 153 161 } 154 162 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ -
src/tests/.expect/concurrent/sched-int-wait.txt
rdbfb35d r3bd1eb4 1 Starting 2 Done -
src/tests/.expect/memberCtors-ERR1.txt
rdbfb35d r3bd1eb4 1 memberCtors.c: 62error: in void ?{}(B *b), field a2 used before being constructed1 memberCtors.c:71 error: in void ?{}(B *b), field a2 used before being constructed -
src/tests/.expect/memberCtors.txt
rdbfb35d r3bd1eb4 16 16 assigning int: 0 0 17 17 end construct A 18 copy constructing int: 0 19 copy constructing int: 0 20 begin copy construct A 21 copy construct this->x 22 copy constructing int: 1001 23 assign this->y 24 copy constructing int: 0 25 destructing int: 0 26 destructing int: 0 27 end copy construct A 28 begin ?=? A 29 copy constructing int: 1001 30 destructing int: 1001 31 destructing int: 1001 32 copy constructing int: 0 33 destructing int: 0 34 destructing int: 0 35 copy constructing int: 0 36 destructing int: 0 37 destructing int: 0 38 end ?=? A 39 copy constructing int: 0 40 copy constructing int: 0 41 begin copy construct A 42 copy construct this->x 43 copy constructing int: 1001 44 assign this->y 45 copy constructing int: 0 46 destructing int: 0 47 destructing int: 0 48 end copy construct A 49 destructing int: 0 50 destructing int: 0 51 destructing int: 1001 52 destructing int: 0 53 destructing int: 0 54 destructing int: 1001 18 55 construct b->a1 19 56 constructing int … … 36 73 copy constructing int: 1000 37 74 assign this->y 38 end copy construct A 39 copy constructing int: 0 40 copy constructing int: 0 41 begin copy construct A 42 copy construct this->x 43 copy constructing int: 1001 44 assign this->y 45 end copy construct A 46 copy constructing int: 0 47 copy constructing int: 0 48 begin copy construct A 49 copy construct this->x 50 copy constructing int: 0 51 assign this->y 75 copy constructing int: 0 76 destructing int: 0 77 destructing int: 0 78 end copy construct A 79 copy constructing int: 0 80 copy constructing int: 0 81 begin copy construct A 82 copy construct this->x 83 copy constructing int: 1001 84 assign this->y 85 copy constructing int: 0 86 destructing int: 0 87 destructing int: 0 88 end copy construct A 89 copy constructing int: 0 90 copy constructing int: 0 91 begin copy construct A 92 copy construct this->x 93 copy constructing int: 0 94 assign this->y 95 copy constructing int: 0 96 destructing int: 0 97 destructing int: 0 52 98 end copy construct A 53 99 End of main … … 60 106 assigning int: 0 0 61 107 end construct A 108 copy constructing int: 0 109 copy constructing int: 0 110 begin copy construct A 111 copy construct this->x 112 copy constructing int: 999 113 assign this->y 114 copy constructing int: 0 115 destructing int: 0 116 destructing int: 0 117 end copy construct A 118 begin ?=? A 119 copy constructing int: 999 120 destructing int: 999 121 destructing int: 999 122 copy constructing int: 0 123 destructing int: 0 124 destructing int: 0 125 copy constructing int: 0 126 destructing int: 0 127 destructing int: 0 128 end ?=? A 129 copy constructing int: 0 130 copy constructing int: 0 131 begin copy construct A 132 copy construct this->x 133 copy constructing int: 999 134 assign this->y 135 copy constructing int: 0 136 destructing int: 0 137 destructing int: 0 138 end copy construct A 139 destructing int: 0 140 destructing int: 0 141 destructing int: 999 142 destructing int: 0 143 destructing int: 0 144 destructing int: 999 62 145 destructing int: 0 63 146 destructing int: 0 … … 80 163 assigning int: 0 0 81 164 end construct A 165 copy constructing int: 0 166 copy constructing int: 0 167 begin copy construct A 168 copy construct this->x 169 copy constructing int: 999 170 assign this->y 171 copy constructing int: 0 172 destructing int: 0 173 destructing int: 0 174 end copy construct A 175 begin ?=? A 176 copy constructing int: 999 177 destructing int: 999 178 destructing int: 999 179 copy constructing int: 0 180 destructing int: 0 181 destructing int: 0 182 copy constructing int: 0 183 destructing int: 0 184 destructing int: 0 185 end ?=? A 186 copy constructing int: 0 187 copy constructing int: 0 188 begin copy construct A 189 copy construct this->x 190 copy constructing int: 999 191 assign this->y 192 copy constructing int: 0 193 destructing int: 0 194 destructing int: 0 195 end copy construct A 196 destructing int: 0 197 destructing int: 0 198 destructing int: 999 199 destructing int: 0 200 destructing int: 0 201 destructing int: 999 82 202 destructing int: 0 83 203 destructing int: 0 -
src/tests/.expect/rational.txt
rdbfb35d r3bd1eb4 17 17 3/1 18 18 4/3 19 conversion20 0.7521 0.14285714285714322 3.1415929203539823 3/424 1/725 355/11326 19 decompose 27 20 more tests -
src/tests/Makefile.am
rdbfb35d r3bd1eb4 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Thu Feb 16 15:27:50201714 ## Update Count : 4 113 ## Last Modified On : Sun May 14 14:43:48 2017 14 ## Update Count : 42 15 15 ############################################################################### 16 16 17 17 debug=yes 18 18 19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once 19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once attributes 20 20 21 21 if BUILD_CONCURRENCY … … 30 30 # applies to both programs 31 31 EXTRA_FLAGS = 32 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 33 33 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 34 34 CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS} … … 76 76 77 77 declarationSpecifier: declarationSpecifier.c 78 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}78 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 79 79 80 80 gccExtensions : gccExtensions.c 81 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}81 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 82 82 83 83 extension : extension.c 84 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}84 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 85 85 86 86 attributes : attributes.c 87 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}87 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 88 88 89 89 KRfunctions : KRfunctions.c 90 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 90 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 91 92 gmp : gmp.c 93 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 91 94 92 95 memberCtors-ERR1: memberCtors.c -
src/tests/Makefile.in
rdbfb35d r3bd1eb4 226 226 quick_test = vector_test avl_test operators numericConstants \ 227 227 expression enum array typeof cast dtor-early-exit init_once \ 228 $(am__append_1)228 attributes $(am__append_1) 229 229 @BUILD_CONCURRENCY_FALSE@concurrent = no 230 230 @BUILD_CONCURRENCY_TRUE@concurrent = yes … … 234 234 # applies to both programs 235 235 EXTRA_FLAGS = 236 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}236 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 237 237 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 238 238 fstream_test_SOURCES = fstream_test.c … … 695 695 696 696 declarationSpecifier: declarationSpecifier.c 697 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}697 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 698 698 699 699 gccExtensions : gccExtensions.c 700 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}700 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 701 701 702 702 extension : extension.c 703 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}703 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 704 704 705 705 attributes : attributes.c 706 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}706 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 707 707 708 708 KRfunctions : KRfunctions.c 709 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 709 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 710 711 gmp : gmp.c 712 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 710 713 711 714 memberCtors-ERR1: memberCtors.c -
src/tests/memberCtors.c
rdbfb35d r3bd1eb4 53 53 } // z never constructed - will be automatically copy constructed 54 54 55 A ?=?(A * this, A other) { 56 printf("begin ?=? A\n"); 57 this->x = other.x; 58 this->y = other.y; 59 this->z = other.z; 60 printf("end ?=? A\n"); 61 return *this; 62 } 63 55 64 struct B { 56 65 A a1, a2, a3; -
src/tests/rational.c
rdbfb35d r3bd1eb4 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 2 22:11:05201713 // Update Count : 4112 // Last Modified On : Sun May 14 18:10:28 2017 13 // Update Count : 57 14 14 // 15 15 16 #include <rational> 16 17 #include <limits> 17 #include < rational>18 #include <stdlib> 18 19 #include <fstream> 20 21 // UNNECESSARY, FIX ME 22 void ?{}( int * this ) { *this = 0; } 23 void ?{}( int * this, zero_t ) { *this = 0; } 24 void ?{}( int * this, one_t ) { *this = 1; } 19 25 20 26 int main() { 21 27 sout | "constructor" | endl; 22 Rational a = { 3 }, b = { 4 }, c;28 Rational(int) a = { 3 }, b = { 4 }, c; 23 29 sout | a | b | c | endl; 24 a = (Rational){ 4, 8 }; 25 b = (Rational){ 5, 7 }; 30 31 a = (Rational(int)){ 4, 8 }; 32 b = (Rational(int)){ 5, 7 }; 26 33 sout | a | b | endl; 27 a = (Rational ){ -2, -3 };28 b = (Rational ){ 3, -2 };34 a = (Rational(int)){ -2, -3 }; 35 b = (Rational(int)){ 3, -2 }; 29 36 sout | a | b | endl; 30 a = (Rational ){ -2, 3 };31 b = (Rational ){ 3, 2 };37 a = (Rational(int)){ -2, 3 }; 38 b = (Rational(int)){ 3, 2 }; 32 39 sout | a | b | endl; 33 40 34 41 sout | "logical" | endl; 35 a = (Rational ){ -2 };36 b = (Rational ){ -3, 2 };42 a = (Rational(int)){ -2 }; 43 b = (Rational(int)){ -3, 2 }; 37 44 sout | a | b | endl; 38 45 // sout | a == 1 | endl; // FIX ME … … 50 57 sout | a / b | endl; 51 58 52 sout | "conversion" | endl;53 a = (Rational){ 3, 4 };54 sout | widen( a ) | endl;55 a = (Rational){ 1, 7 };56 sout | widen( a ) | endl;57 a = (Rational){ 355, 113 };58 sout | widen( a ) | endl;59 sout | narrow( 0.75, 4 ) | endl;60 sout | narrow( 0.14285714285714, 16 ) | endl;61 sout | narrow( 3.14159265358979, 256 ) | endl;59 // sout | "conversion" | endl; 60 // a = (Rational(int)){ 3, 4 }; 61 // sout | widen( a ) | endl; 62 // a = (Rational(int)){ 1, 7 }; 63 // sout | widen( a ) | endl; 64 // a = (Rational(int)){ 355, 113 }; 65 // sout | widen( a ) | endl; 66 // sout | narrow( 0.75, 4 ) | endl; 67 // sout | narrow( 0.14285714285714, 16 ) | endl; 68 // sout | narrow( 3.14159265358979, 256 ) | endl; 62 69 63 70 sout | "decompose" | endl; 64 RationalImpln, d;71 int n, d; 65 72 // [n, d] = a; 66 73 // sout | a | n | d | endl; 67 74 68 75 sout | "more tests" | endl; 69 Rational x = { 1, 2 }, y = { 2 };76 Rational(int) x = { 1, 2 }, y = { 2 }; 70 77 sout | x - y | endl; 71 78 sout | x > y | endl; … … 73 80 sout | y | denominator( y, -2 ) | y | endl; 74 81 75 Rational z = { 0, 5 };82 Rational(int) z = { 0, 5 }; 76 83 sout | z | endl; 77 84 78 85 sout | x | numerator( x, 0 ) | x | endl; 79 86 80 x = (Rational ){ 1, MAX } + (Rational){ 1, MAX };87 x = (Rational(int)){ 1, MAX } + (Rational(int)){ 1, MAX }; 81 88 sout | x | endl; 82 x = (Rational ){ 3, MAX } + (Rational){ 2, MAX };89 x = (Rational(int)){ 3, MAX } + (Rational(int)){ 2, MAX }; 83 90 sout | x | endl; 84 91 -
src/tests/sched-int-wait.c
rdbfb35d r3bd1eb4 113 113 waiter_left = 4; 114 114 processor p; 115 sout | "Starting" | endl; 115 116 { 116 117 Signaler e; … … 122 123 } 123 124 } 125 sout | "Done" | endl; 124 126 } -
src/tests/test.py
rdbfb35d r3bd1eb4 24 24 self.name, self.path = name, path 25 25 26 class TestResult: 27 SUCCESS = 0 28 FAILURE = 1 29 TIMEOUT = 124 30 26 31 # parses the Makefile to find the machine type (32-bit / 64-bit) 27 32 def getMachineType(): 28 33 sh('echo "void ?{}(int*a,int b){}int main(){return 0;}" > .dummy.c') 29 34 ret, out = sh("make .dummy -s", print2stdout=True) 30 35 31 36 if ret != 0: 32 37 print("Failed to identify architecture:") … … 161 166 162 167 # build, skipping to next test on error 163 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 168 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 169 170 retcode = 0 171 error = None 164 172 165 173 # if the make command succeds continue otherwise skip to diff … … 170 178 if fileIsExecutable(test.name) : 171 179 # run test 172 sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)180 retcode, _ = sh("timeout 60 ./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run) 173 181 else : 174 182 # simply cat the result into the output … … 179 187 sh("mv %s %s" % (err_file, out_file), dry_run) 180 188 181 retcode = 0 182 error = None 183 184 if generate : 185 # if we are ounly generating the output we still need to check that the test actually exists 186 if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'. Stop." % test.name) : 187 retcode = 1; 188 error = "\t\tNo make target for test %s!" % test.name 189 sh("rm %s" % out_file, False) 190 191 else : 192 # fetch return code and error from the diff command 193 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 194 189 if retcode == 0: 190 if generate : 191 # if we are ounly generating the output we still need to check that the test actually exists 192 if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'. Stop." % test.name) : 193 retcode = 1; 194 error = "\t\tNo make target for test %s!" % test.name 195 sh("rm %s" % out_file, False) 196 else : 197 # fetch return code and error from the diff command 198 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 195 199 # clean the executable 196 200 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run) … … 205 209 name_txt = "%20s " % t.name 206 210 207 #run the test instance and collect the result 208 test_failed, error = run_single_test(t, generate, dry_run, debug) 211 retcode, error = run_single_test(t, generate, dry_run, debug) 209 212 210 213 # update output based on current action 211 214 if generate : 212 failed_txt = "ERROR" 213 success_txt = "Done" 214 else : 215 failed_txt = "FAILED" 216 success_txt = "PASSED" 215 if retcode == TestResult.SUCCESS: result_txt = "Done" 216 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 217 else : result_txt = "ERROR" 218 else : 219 if retcode == TestResult.SUCCESS: result_txt = "PASSED" 220 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 221 else : result_txt = "FAILED" 217 222 218 223 #print result with error if needed 219 text = name_txt + (failed_txt if test_failed else success_txt)224 text = name_txt + result_txt 220 225 out = sys.stdout 221 226 if error : … … 223 228 out = sys.stderr 224 229 225 print(text, file = out) ;230 print(text, file = out) 226 231 sys.stdout.flush() 227 232 sys.stderr.flush() 228 233 signal.signal(signal.SIGINT, signal.SIG_IGN) 229 234 230 return test_failed235 return retcode != TestResult.SUCCESS 231 236 232 237 # run the given list of tests with the given parameters … … 269 274 if __name__ == "__main__": 270 275 #always run from same folder 271 chdir() 272 276 chdir() 277 273 278 # parse the command line arguments 274 279 options = getOptions()
Note:
See TracChangeset
for help on using the changeset viewer.