- Timestamp:
- Jul 4, 2017, 9:40:16 AM (8 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:
- 208e5be
- Parents:
- 9c951e3 (diff), f7cb0bc (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:
-
- 47 added
- 6 deleted
- 139 edited
- 7 moved
-
CodeGen/CodeGenerator.cc (modified) (20 diffs)
-
CodeGen/CodeGenerator.h (modified) (7 diffs)
-
CodeGen/FixNames.cc (modified) (3 diffs)
-
CodeTools/TrackLoc.cc (modified) (2 diffs)
-
CodeTools/TrackLoc.h (modified) (1 diff)
-
Common/Assert.cc (modified) (2 diffs)
-
Common/Indenter.h (added)
-
Common/PassVisitor.h (added)
-
Common/PassVisitor.impl.h (added)
-
Common/PassVisitor.proto.h (added)
-
Common/utility.h (modified) (3 diffs)
-
Concurrency/Keywords.cc (modified) (4 diffs)
-
ControlStruct/ExceptTranslate.cc (added)
-
ControlStruct/ExceptTranslate.h (added)
-
ControlStruct/ForExprMutator.cc (modified) (3 diffs)
-
ControlStruct/ForExprMutator.h (modified) (2 diffs)
-
ControlStruct/Mutate.cc (modified) (2 diffs)
-
ControlStruct/module.mk (modified) (1 diff)
-
GenPoly/Box.cc (modified) (23 diffs)
-
GenPoly/CopyParams.cc (modified) (1 diff)
-
GenPoly/DeclMutator.cc (modified) (15 diffs)
-
GenPoly/InstantiateGeneric.cc (modified) (11 diffs)
-
GenPoly/Lvalue.cc (modified) (1 diff)
-
GenPoly/PolyMutator.cc (modified) (2 diffs)
-
GenPoly/Specialize.cc (modified) (3 diffs)
-
InitTweak/FixGlobalInit.cc (modified) (2 diffs)
-
InitTweak/FixInit.cc (modified) (21 diffs)
-
InitTweak/GenInit.cc (modified) (11 diffs)
-
InitTweak/InitTweak.cc (modified) (6 diffs)
-
MakeLibCfa.cc (modified) (2 diffs)
-
Makefile.am (modified) (1 diff)
-
Makefile.in (modified) (24 diffs)
-
Parser/DeclarationNode.cc (modified) (7 diffs)
-
Parser/ExpressionNode.cc (modified) (14 diffs)
-
Parser/InitializerNode.cc (modified) (1 diff)
-
Parser/LinkageSpec.cc (modified) (6 diffs)
-
Parser/LinkageSpec.h (modified) (3 diffs)
-
Parser/ParseNode.h (modified) (10 diffs)
-
Parser/StatementNode.cc (modified) (3 diffs)
-
Parser/TypeData.cc (modified) (8 diffs)
-
Parser/TypeData.h (modified) (2 diffs)
-
Parser/TypedefTable.h (modified) (2 diffs)
-
Parser/lex.ll (modified) (6 diffs)
-
Parser/module.mk (modified) (2 diffs)
-
Parser/parser.hh (moved) (moved from src/Parser/lex.h ) (2 diffs)
-
Parser/parser.yy (modified) (41 diffs)
-
Parser/parserutility.cc (moved) (moved from src/Parser/parseutility.cc ) (2 diffs)
-
Parser/parserutility.h (moved) (moved from src/Parser/parseutility.h ) (1 diff)
-
ResolvExpr/AlternativeFinder.cc (modified) (7 diffs)
-
ResolvExpr/AlternativeFinder.h (modified) (1 diff)
-
ResolvExpr/CastCost.cc (modified) (3 diffs)
-
ResolvExpr/CommonType.cc (modified) (6 diffs)
-
ResolvExpr/ConversionCost.cc (modified) (9 diffs)
-
ResolvExpr/CurrentObject.cc (added)
-
ResolvExpr/CurrentObject.h (added)
-
ResolvExpr/PtrsAssignable.cc (modified) (4 diffs)
-
ResolvExpr/PtrsCastable.cc (modified) (3 diffs)
-
ResolvExpr/Resolver.cc (modified) (9 diffs)
-
ResolvExpr/TypeMap.h (modified) (2 diffs)
-
ResolvExpr/Unify.cc (modified) (12 diffs)
-
ResolvExpr/module.mk (modified) (2 diffs)
-
ResolvExpr/typeops.h (modified) (2 diffs)
-
SymTab/Autogen.cc (modified) (8 diffs)
-
SymTab/Autogen.h (modified) (4 diffs)
-
SymTab/FixFunction.cc (modified) (1 diff)
-
SymTab/ImplementationType.cc (modified) (4 diffs)
-
SymTab/Indexer.cc (modified) (6 diffs)
-
SymTab/Indexer.h (modified) (1 diff)
-
SymTab/Mangler.cc (modified) (3 diffs)
-
SymTab/Validate.cc (modified) (23 diffs)
-
SynTree/AggregateDecl.cc (modified) (2 diffs)
-
SynTree/Attribute.h (modified) (1 diff)
-
SynTree/BaseSyntaxNode.h (modified) (1 diff)
-
SynTree/Constant.cc (modified) (2 diffs)
-
SynTree/Constant.h (modified) (3 diffs)
-
SynTree/Declaration.h (modified) (7 diffs)
-
SynTree/Expression.cc (modified) (7 diffs)
-
SynTree/Expression.h (modified) (5 diffs)
-
SynTree/Initializer.cc (modified) (3 diffs)
-
SynTree/Initializer.h (modified) (7 diffs)
-
SynTree/Mutator.cc (modified) (10 diffs)
-
SynTree/Mutator.h (modified) (4 diffs)
-
SynTree/ObjectDecl.cc (modified) (1 diff)
-
SynTree/Statement.cc (modified) (10 diffs)
-
SynTree/Statement.h (modified) (8 diffs)
-
SynTree/SynTree.h (modified) (4 diffs)
-
SynTree/TupleExpr.cc (modified) (1 diff)
-
SynTree/TupleType.cc (modified) (1 diff)
-
SynTree/Type.h (modified) (5 diffs)
-
SynTree/TypeDecl.cc (modified) (2 diffs)
-
SynTree/TypeSubstitution.cc (modified) (1 diff)
-
SynTree/VarExprReplacer.cc (modified) (1 diff)
-
SynTree/VarExprReplacer.h (modified) (1 diff)
-
SynTree/Visitor.cc (modified) (12 diffs)
-
SynTree/Visitor.h (modified) (4 diffs)
-
SynTree/ZeroOneType.cc (modified) (2 diffs)
-
Tuples/TupleExpansion.cc (modified) (8 diffs)
-
benchmark/create_cfaCor.c (added)
-
benchmark/create_cfaThrd.c (added)
-
benchmark/create_pthrd.c (added)
-
benchmark/create_uCor.cpp (added)
-
benchmark/create_uTask.cpp (added)
-
driver/Makefile.am (modified) (1 diff)
-
driver/Makefile.in (modified) (1 diff)
-
driver/cc1.cc (modified) (2 diffs)
-
driver/cfa.cc (modified) (1 diff)
-
examples/alloc.c (deleted)
-
examples/fwrite.c (deleted)
-
examples/hello.c (deleted)
-
libcfa/Makefile.am (modified) (5 diffs)
-
libcfa/Makefile.in (modified) (26 diffs)
-
libcfa/concurrency/alarm.c (added)
-
libcfa/concurrency/alarm.h (added)
-
libcfa/concurrency/coroutine (modified) (5 diffs)
-
libcfa/concurrency/kernel (modified) (3 diffs)
-
libcfa/concurrency/kernel.c (modified) (18 diffs)
-
libcfa/concurrency/kernel_private.h (modified) (3 diffs)
-
libcfa/concurrency/monitor (modified) (4 diffs)
-
libcfa/concurrency/monitor.c (modified) (13 diffs)
-
libcfa/concurrency/preemption.c (added)
-
libcfa/concurrency/preemption.h (added)
-
libcfa/concurrency/thread (modified) (1 diff)
-
libcfa/concurrency/thread.c (modified) (1 diff)
-
libcfa/containers/maybe (added)
-
libcfa/containers/maybe.c (added)
-
libcfa/containers/result (added)
-
libcfa/containers/result.c (added)
-
libcfa/containers/vector (modified) (4 diffs)
-
libcfa/exception.c (added)
-
libcfa/exception.h (added)
-
libcfa/gmp (modified) (8 diffs)
-
libcfa/libhdr/libdebug.h (modified) (1 diff)
-
libcfa/math (modified) (2 diffs)
-
libcfa/math.c (modified) (2 diffs)
-
libcfa/stdlib (modified) (5 diffs)
-
libcfa/stdlib.c (modified) (5 diffs)
-
main.cc (modified) (10 diffs)
-
prelude/Makefile.am (modified) (3 diffs)
-
prelude/Makefile.in (modified) (5 diffs)
-
prelude/builtins.c (added)
-
prelude/prelude.cf (modified) (3 diffs)
-
tests/.expect/32/KRfunctions.txt (modified) (4 diffs)
-
tests/.expect/32/attributes.txt (modified) (4 diffs)
-
tests/.expect/32/declarationSpecifier.txt (modified) (2 diffs)
-
tests/.expect/32/extension.txt (modified) (2 diffs)
-
tests/.expect/32/gccExtensions.txt (modified) (3 diffs)
-
tests/.expect/32/math.txt (modified) (1 diff)
-
tests/.expect/64/KRfunctions.txt (modified) (4 diffs)
-
tests/.expect/64/attributes.txt (modified) (4 diffs)
-
tests/.expect/64/declarationSpecifier.txt (modified) (2 diffs)
-
tests/.expect/64/extension.txt (modified) (2 diffs)
-
tests/.expect/64/gccExtensions.txt (modified) (3 diffs)
-
tests/.expect/64/gmp.txt (moved) (moved from src/tests/.expect/gmp.txt ) (2 diffs)
-
tests/.expect/64/math.txt (modified) (1 diff)
-
tests/.expect/alloc.txt (added)
-
tests/.expect/complex.txt (added)
-
tests/.expect/concurrent/sched-int-block.txt (added)
-
tests/.expect/constant0-1DP.txt (deleted)
-
tests/.expect/constant0-1NDDP.txt (deleted)
-
tests/.expect/designations.txt (added)
-
tests/.expect/hello.txt (added)
-
tests/.expect/identity.txt (added)
-
tests/.expect/io.txt (modified) (2 diffs)
-
tests/.expect/maybe.txt (moved) (moved from src/tests/.expect/constant0-1.txt )
-
tests/.expect/result.txt (moved) (moved from src/tests/.expect/constant0-1ND.txt )
-
tests/.expect/scopeErrors.txt (modified) (1 diff)
-
tests/KRfunctions.c (modified) (2 diffs)
-
tests/Makefile.am (modified) (4 diffs)
-
tests/Makefile.in (modified) (6 diffs)
-
tests/alloc.c (added)
-
tests/complex.c (added)
-
tests/constant0-1.c (deleted)
-
tests/coroutine.c (modified) (1 diff)
-
tests/designations.c (added)
-
tests/gmp.c (modified) (6 diffs)
-
tests/hello.c (added)
-
tests/identity.c (moved) (moved from src/examples/identity.c ) (2 diffs)
-
tests/io.c (modified) (4 diffs)
-
tests/libcfa_vector.c (modified) (1 diff)
-
tests/math.c (modified) (2 diffs)
-
tests/maybe.c (added)
-
tests/numericConstants.c (modified) (2 diffs)
-
tests/preempt_longrun/Makefile.am (added)
-
tests/preempt_longrun/Makefile.in (added)
-
tests/preempt_longrun/barge.c (added)
-
tests/preempt_longrun/block.c (added)
-
tests/preempt_longrun/create.c (added)
-
tests/preempt_longrun/disjoint.c (added)
-
tests/preempt_longrun/processor.c (added)
-
tests/preempt_longrun/stack.c (added)
-
tests/preempt_longrun/wait.c (added)
-
tests/preempt_longrun/yield.c (added)
-
tests/rational.c (modified) (1 diff)
-
tests/result.c (added)
-
tests/sched-int-block.c (added)
-
tests/sched-int-disjoint.c (modified) (2 diffs)
-
tests/sched-int-wait.c (modified) (1 diff)
-
tests/test.py (modified) (2 diffs)
-
tests/tuplePolymorphism.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 10 14:45:00 201713 // Update Count : 48 412 // Last Modified On : Thu Jun 8 16:00:00 2017 13 // Update Count : 485 14 14 // 15 15 … … 65 65 } // if 66 66 } // extension 67 68 ostream & CodeGenerator::Indenter::operator()( ostream & output ) const {69 return output << string( cg.cur_indent, ' ' );70 }71 72 ostream & operator<<( ostream & output, const CodeGenerator::Indenter &indent ) {73 return indent( output );74 }75 67 76 68 CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std::list< Label > & l ) { … … 111 103 } 112 104 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 ) {} 114 115 CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp ) 116 : indent( *this), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) { 117 //output << std::string( init ); 118 } 119 120 CodeGenerator::CodeGenerator( std::ostream & os, char * init, int indentation, bool infunp ) 121 : indent( *this ), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) { 122 //output << std::string( init ); 123 } 105 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {} 124 106 125 107 string CodeGenerator::mangleName( DeclarationWithType * decl ) { … … 212 194 output << " {" << endl; 213 195 214 cur_indent += CodeGenerator::tabsize;196 ++indent; 215 197 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) { 216 198 output << lineDirective( *i ) << indent; … … 219 201 } // for 220 202 221 cur_indent -= CodeGenerator::tabsize;203 --indent; 222 204 223 205 output << indent << "}"; … … 249 231 output << " {" << endl; 250 232 251 cur_indent += CodeGenerator::tabsize;233 ++indent; 252 234 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 253 235 ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i ); … … 261 243 } // for 262 244 263 cur_indent -= CodeGenerator::tabsize;245 --indent; 264 246 265 247 output << indent << "}"; … … 267 249 } 268 250 269 void CodeGenerator::visit( TraitDecl * traitDecl ) {}251 void CodeGenerator::visit( __attribute__((unused)) TraitDecl * traitDecl ) {} 270 252 271 253 void CodeGenerator::visit( TypedefDecl * typeDecl ) { … … 298 280 } 299 281 300 void CodeGenerator:: printDesignators( std::list< Expression * > & designators) {301 typedef std::list< Expression * > DesignatorList;282 void CodeGenerator::visit( Designation * designation ) { 283 std::list< Expression * > designators = designation->get_designators(); 302 284 if ( designators.size() == 0 ) return; 303 for ( DesignatorList::iterator iter = designators.begin(); iter != designators.end(); ++iter) {304 if ( dynamic_cast< NameExpr * >( *iter) ) {305 // if expression is a name, then initializing aggregate member285 for ( Expression * des : designators ) { 286 if ( dynamic_cast< NameExpr * >( des ) || dynamic_cast< VariableExpr * >( des ) ) { 287 // if expression is a NameExpr or VariableExpr, then initializing aggregate member 306 288 output << "."; 307 (*iter)->accept( *this );289 des->accept( *this ); 308 290 } else { 309 // if not a simple name, it has to be a constant expression, i.e. an array designator291 // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt 310 292 output << "["; 311 (*iter)->accept( *this );293 des->accept( *this ); 312 294 output << "]"; 313 295 } // if … … 317 299 318 300 void CodeGenerator::visit( SingleInit * init ) { 319 printDesignators( init->get_designators() );320 301 init->get_value()->accept( *this ); 321 302 } 322 303 323 304 void CodeGenerator::visit( ListInit * init ) { 324 printDesignators( init->get_designators() ); 305 auto initBegin = init->begin(); 306 auto initEnd = init->end(); 307 auto desigBegin = init->get_designations().begin(); 308 auto desigEnd = init->get_designations().end(); 309 325 310 output << "{ "; 326 if ( init->begin() == init->end() ) { 327 // illegal to leave initializer list empty for scalar initializers, but always legal to have 0 328 output << "0"; 329 } else { 330 genCommaList( init->begin(), init->end() ); 331 } // if 311 for ( ; initBegin != initEnd && desigBegin != desigEnd; ) { 312 (*desigBegin)->accept( *this ); 313 (*initBegin)->accept( *this ); 314 ++initBegin, ++desigBegin; 315 if ( initBegin != initEnd ) { 316 output << ", "; 317 } 318 } 332 319 output << " }"; 333 } 334 335 void CodeGenerator::visit( ConstructorInit * init ){ 320 assertf( initBegin == initEnd && desigBegin == desigEnd, "Initializers and designators not the same length. %s", toString( init ).c_str() ); 321 } 322 323 void CodeGenerator::visit( __attribute__((unused)) ConstructorInit * init ){ 336 324 assertf( ! genC, "ConstructorInit nodes should not reach code generation." ); 337 325 // xxx - generate something reasonable for constructor/destructor pairs … … 731 719 732 720 void CodeGenerator::visit( TypeExpr * typeExpr ) { 733 assertf( ! genC, "TypeExpr should not reach code generation." ); 734 output<< genType( typeExpr->get_type(), "", pretty, genC ); 721 // if ( genC ) std::cerr << "typeexpr still exists: " << typeExpr << std::endl; 722 // assertf( ! genC, "TypeExpr should not reach code generation." ); 723 if ( ! genC ) { 724 output<< genType( typeExpr->get_type(), "", pretty, genC ); 725 } 735 726 } 736 727 … … 756 747 std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids(); 757 748 output << lineDirective( stmtExpr) << "({" << std::endl; 758 cur_indent += CodeGenerator::tabsize;749 ++indent; 759 750 unsigned int numStmts = stmts.size(); 760 751 unsigned int i = 0; … … 779 770 ++i; 780 771 } 781 cur_indent -= CodeGenerator::tabsize;772 --indent; 782 773 output << indent << "})"; 783 774 } … … 788 779 output << "{" << endl; 789 780 790 cur_indent += CodeGenerator::tabsize;781 ++indent; 791 782 792 783 for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end(); i++ ) { … … 799 790 } // if 800 791 } // for 801 cur_indent -= CodeGenerator::tabsize;792 --indent; 802 793 803 794 output << indent << "}"; … … 867 858 868 859 output << "{" << std::endl; 869 cur_indent += CodeGenerator::tabsize;860 ++indent; 870 861 acceptAll( switchStmt->get_statements(), *this ); 871 cur_indent -= CodeGenerator::tabsize;862 --indent; 872 863 output << indent << "}"; 873 864 } … … 886 877 std::list<Statement *> sts = caseStmt->get_statements(); 887 878 888 cur_indent += CodeGenerator::tabsize;879 ++indent; 889 880 for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end(); i++) { 890 881 output << indent << printLabels( (*i)->get_labels() ) ; … … 892 883 output << endl; 893 884 } // for 894 cur_indent -= CodeGenerator::tabsize;885 --indent; 895 886 } 896 887 … … 923 914 } 924 915 916 void CodeGenerator::visit( ThrowStmt * throwStmt ) { 917 assertf( ! genC, "Throw statements should not reach code generation." ); 918 919 output << ((throwStmt->get_kind() == ThrowStmt::Terminate) ? 920 "throw" : "throwResume"); 921 if (throwStmt->get_expr()) { 922 output << " "; 923 throwStmt->get_expr()->accept( *this ); 924 } 925 if (throwStmt->get_target()) { 926 output << " _At "; 927 throwStmt->get_target()->accept( *this ); 928 } 929 output << ";"; 930 } 931 925 932 void CodeGenerator::visit( WhileStmt * whileStmt ) { 926 933 if ( whileStmt->get_isDoWhile() ) { … … 967 974 } 968 975 969 void CodeGenerator::visit( NullStmt * nullStmt ) {976 void CodeGenerator::visit( __attribute__((unused)) NullStmt * nullStmt ) { 970 977 //output << indent << CodeGenerator::printLabels( nullStmt->get_labels() ); 971 978 output << "/* null statement */ ;"; -
src/CodeGen/CodeGenerator.h
r9c951e3 rb1e63ac5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 10 10:57:00 201713 // Update Count : 5 112 // Last Modified On : Thu Jun 8 15:48:00 2017 13 // Update Count : 52 14 14 // 15 15 … … 25 25 #include "SymTab/Indexer.h" 26 26 27 #include "Common/Indenter.h" 27 28 #include "Common/utility.h" 28 29 … … 47 48 48 49 //*** Initializer 50 virtual void visit( Designation * ); 49 51 virtual void visit( SingleInit * ); 50 52 virtual void visit( ListInit * ); … … 91 93 virtual void visit( BranchStmt * ); 92 94 virtual void visit( ReturnStmt * ); 95 virtual void visit( ThrowStmt * ); 93 96 virtual void visit( WhileStmt * ); 94 97 virtual void visit( ForStmt * ); … … 99 102 100 103 template< class Iterator > void genCommaList( Iterator begin, Iterator end ); 101 102 struct Indenter {103 Indenter(CodeGenerator &cg) : cg(cg) {}104 CodeGenerator & cg;105 std::ostream& operator()(std::ostream & os) const;106 };107 104 108 105 struct LabelPrinter { … … 128 125 private: 129 126 Indenter indent; 130 int cur_indent;131 127 bool insideFunction; 132 128 std::ostream &output; … … 136 132 bool lineMarks = false; 137 133 138 void printDesignators( std::list< Expression * > & );139 134 void handleStorageClass( DeclarationWithType *decl ); 140 135 void handleAggregate( AggregateDecl *aggDecl, const std::string & kind ); -
src/CodeGen/FixNames.cc
r9c951e3 rb1e63ac5 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 Mar 16 07:50:30 201713 // Update Count : 1611 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:26:00 2017 13 // Update Count : 20 14 14 // 15 15 … … 93 93 void FixNames::fixDWT( DeclarationWithType *dwt ) { 94 94 if ( dwt->get_name() != "" ) { 95 if ( LinkageSpec::is Decoratable( dwt->get_linkage() ) ) {95 if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) { 96 96 dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) ); 97 97 dwt->set_scopeLevel( scopeLevel ); … … 114 114 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 115 115 } 116 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant ( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), "0") ) ) );116 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) ); 117 117 CodeGen::FixMain::registerMain( functionDecl ); 118 118 } -
src/CodeTools/TrackLoc.cc
r9c951e3 rb1e63ac5 16 16 #include "TrackLoc.h" 17 17 18 #include <cstdlib> 19 18 20 #include <iostream> 19 21 #include <sstream> 22 #include <stack> 20 23 #include <string> 21 #include < cstdlib>24 #include <typeindex> 22 25 23 26 #include "Common/utility.h" 27 #include "Common/PassVisitor.h" 24 28 #include "Common/VectorMap.h" 25 29 #include "GenPoly/GenPoly.h" … … 27 31 #include "SynTree/Declaration.h" 28 32 #include "SynTree/Initializer.h" 29 #include "SynTree/Visitor.h"30 33 31 34 namespace CodeTools { 32 35 33 std::ostream & operator<<(std::ostream & out, CodeLocation const & loc) {34 return out << loc.filename << '[' << loc.linenumber << ']';35 }36 std::ostream & operator<<(std::ostream & out, CodeLocation const & loc) { 37 return out << loc.filename << '[' << loc.linenumber << ']'; 38 } 36 39 37 class LocationPrinter : public Visitor { 38 unsigned int printLevel; 39 unsigned int currentLevel; 40 class LocationPrinter { 41 size_t printLevel; 40 42 41 CodeLocation *parent;42 43 CodeLocation *lastNode; 43 44 44 public: 45 LocationPrinter(unsigned int printLevel):46 Visitor(), printLevel(printLevel), currentLevel(0), 47 p arent(nullptr), lastNode(nullptr)48 {}45 std::stack< CodeLocation * > parents; 46 public: 47 LocationPrinter(size_t printLevel) : 48 printLevel(printLevel), lastNode(nullptr) 49 {} 49 50 50 void print(char const *name, BaseSyntaxNode *node) {51 for (unsigned int i = 0 ; i < currentLevel; ++i) {51 void print( const std::string& name, BaseSyntaxNode *node) { 52 for (size_t i = 0 ; i < parents.size() ; ++i) { 52 53 std::cout << " "; 53 54 } 54 if (2 <= printLevel) {55 if (2 <= printLevel) { 55 56 std::cout << name << '@'; 56 57 } 57 58 std::cout << node->location << std::endl; 58 }59 } 59 60 60 void atNode( char const * name, BaseSyntaxNode *node) {61 if (-1 == node->location.linenumber) {62 if (nullptr != parent) {63 node->location.linenumber = parent->linenumber;64 node->location .filename = parent->filename;65 } else if (nullptr != lastNode) {66 node->location.linenumber = lastNode->linenumber;67 node->location .filename = lastNode->filename;68 } else {69 std::cerr << "Top level node has no CodeLocation " <<70 name << std::endl;61 void atNode( BaseSyntaxNode *node ) { 62 std::string name = std::type_index(typeid(*node)).name(); 63 if ( node->location.isUnset() ) { 64 if ( !parents.empty() ) { 65 node->location = *parents.top(); 66 } 67 else if (nullptr != lastNode) { 68 node->location = *lastNode; 69 } 70 else { 71 std::cerr << "Top level node has no CodeLocation " << name << std::endl; 71 72 exit(EXIT_FAILURE); 72 73 } 73 74 } 75 74 76 if (0 < printLevel) { 75 print( name, node);77 print( name, node ); 76 78 } 77 79 lastNode = &node->location; 78 80 } 79 81 80 #define VISIT_FUNCTION(SyntaxNodeType) \ 81 virtual void visit(SyntaxNodeType *node) { \ 82 atNode(#SyntaxNodeType, node); \ 83 ++currentLevel; \ 84 CodeLocation * myParent = parent; \ 85 parent = &node->location; \ 86 Visitor::visit(node); \ 87 parent = myParent; \ 88 --currentLevel; \ 82 void previsit(BaseSyntaxNode * node) { 83 atNode(node); 84 parents.push( &node->location ); 89 85 } 90 86 91 VISIT_FUNCTION(ObjectDecl) 92 VISIT_FUNCTION(FunctionDecl) 93 VISIT_FUNCTION(StructDecl) 94 VISIT_FUNCTION(UnionDecl) 95 VISIT_FUNCTION(EnumDecl) 96 VISIT_FUNCTION(TraitDecl) 97 VISIT_FUNCTION(TypeDecl) 98 VISIT_FUNCTION(TypedefDecl) 99 VISIT_FUNCTION(AsmDecl) 100 101 VISIT_FUNCTION(CompoundStmt) 102 VISIT_FUNCTION(ExprStmt) 103 VISIT_FUNCTION(AsmStmt) 104 VISIT_FUNCTION(IfStmt) 105 VISIT_FUNCTION(WhileStmt) 106 VISIT_FUNCTION(ForStmt) 107 VISIT_FUNCTION(SwitchStmt) 108 VISIT_FUNCTION(CaseStmt) 109 VISIT_FUNCTION(BranchStmt) 110 VISIT_FUNCTION(ReturnStmt) 111 VISIT_FUNCTION(TryStmt) 112 VISIT_FUNCTION(CatchStmt) 113 VISIT_FUNCTION(FinallyStmt) 114 VISIT_FUNCTION(NullStmt) 115 VISIT_FUNCTION(DeclStmt) 116 VISIT_FUNCTION(ImplicitCtorDtorStmt) 117 118 VISIT_FUNCTION(ApplicationExpr) 119 VISIT_FUNCTION(UntypedExpr) 120 VISIT_FUNCTION(NameExpr) 121 VISIT_FUNCTION(CastExpr) 122 VISIT_FUNCTION(AddressExpr) 123 VISIT_FUNCTION(LabelAddressExpr) 124 VISIT_FUNCTION(UntypedMemberExpr) 125 VISIT_FUNCTION(MemberExpr) 126 VISIT_FUNCTION(VariableExpr) 127 VISIT_FUNCTION(ConstantExpr) 128 VISIT_FUNCTION(SizeofExpr) 129 VISIT_FUNCTION(AlignofExpr) 130 VISIT_FUNCTION(UntypedOffsetofExpr) 131 VISIT_FUNCTION(OffsetofExpr) 132 VISIT_FUNCTION(OffsetPackExpr) 133 VISIT_FUNCTION(AttrExpr) 134 VISIT_FUNCTION(LogicalExpr) 135 VISIT_FUNCTION(ConditionalExpr) 136 VISIT_FUNCTION(CommaExpr) 137 VISIT_FUNCTION(TypeExpr) 138 VISIT_FUNCTION(AsmExpr) 139 VISIT_FUNCTION(ImplicitCopyCtorExpr) 140 VISIT_FUNCTION(ConstructorExpr) 141 VISIT_FUNCTION(CompoundLiteralExpr) 142 VISIT_FUNCTION(UntypedValofExpr) 143 VISIT_FUNCTION(RangeExpr) 144 VISIT_FUNCTION(UntypedTupleExpr) 145 VISIT_FUNCTION(TupleExpr) 146 VISIT_FUNCTION(TupleIndexExpr) 147 VISIT_FUNCTION(MemberTupleExpr) 148 VISIT_FUNCTION(TupleAssignExpr) 149 VISIT_FUNCTION(StmtExpr) 150 VISIT_FUNCTION(UniqueExpr) 151 152 VISIT_FUNCTION(VoidType) 153 VISIT_FUNCTION(BasicType) 154 VISIT_FUNCTION(PointerType) 155 VISIT_FUNCTION(ArrayType) 156 VISIT_FUNCTION(FunctionType) 157 VISIT_FUNCTION(StructInstType) 158 VISIT_FUNCTION(UnionInstType) 159 VISIT_FUNCTION(EnumInstType) 160 VISIT_FUNCTION(TraitInstType) 161 VISIT_FUNCTION(TypeInstType) 162 VISIT_FUNCTION(TupleType) 163 VISIT_FUNCTION(TypeofType) 164 VISIT_FUNCTION(AttrType) 165 VISIT_FUNCTION(VarArgsType) 166 VISIT_FUNCTION(ZeroType) 167 VISIT_FUNCTION(OneType) 168 169 VISIT_FUNCTION(SingleInit) 170 VISIT_FUNCTION(ListInit) 171 VISIT_FUNCTION(ConstructorInit) 172 173 //VISIT_FUNCTION(Subrange) 174 175 //VISIT_FUNCTION(Constant) 87 void postvisit( __attribute__((unused)) BaseSyntaxNode * node ) { 88 parents.pop(); 89 } 176 90 177 91 }; // LocationPrinter 178 92 179 void fillLocations( std::list< Declaration * > & translationUnit, 180 unsigned int printLevel) { 181 LocationPrinter printer(printLevel); 93 void fillLocations( std::list< Declaration * > & translationUnit, size_t printLevel) { 94 PassVisitor<LocationPrinter> printer(printLevel); 182 95 acceptAll( translationUnit, printer ); 183 96 } -
src/CodeTools/TrackLoc.h
r9c951e3 rb1e63ac5 24 24 // printLevel: how much printing while filling in the node locations. 25 25 // 0 - No Printing, 1 - Print Location, 2 - Print Node Type and Location 26 void fillLocations( std::list< Declaration * > &translationUnit, 27 unsigned int printLevel = 0 ); 26 void fillLocations( std::list< Declaration * > &translationUnit, size_t printLevel = 0 ); 28 27 29 28 } // namespace CodeTools -
src/Common/Assert.cc
r9c951e3 rb1e63ac5 21 21 extern const char * __progname; // global name of running executable (argv[0]) 22 22 23 #define CFA_ASSERT_FMT "*CFA assertion error* from program \"%s\" in \"%s\" at line %d in file \"%s\""23 #define CFA_ASSERT_FMT "*CFA assertion error* \"%s\" from program \"%s\" in \"%s\" at line %d in file \"%s\"" 24 24 25 25 // called by macro assert in assert.h 26 26 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) { 27 fprintf( stderr, CFA_ASSERT_FMT ".\n", __progname, function, line, file );27 fprintf( stderr, CFA_ASSERT_FMT ".\n", assertion, __progname, function, line, file ); 28 28 abort(); 29 29 } … … 31 31 // called by macro assertf 32 32 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) { 33 fprintf( stderr, CFA_ASSERT_FMT ": ", __progname, function, line, file );33 fprintf( stderr, CFA_ASSERT_FMT ": ", assertion, __progname, function, line, file ); 34 34 va_list args; 35 35 va_start( args, fmt ); -
src/Common/utility.h
r9c951e3 rb1e63ac5 246 246 }; 247 247 248 template< typename T > 249 struct ValueGuardPtr { 250 T old; 251 T* ref; 252 253 ValueGuardPtr(T * inRef) : old( inRef ? *inRef : T() ), ref(inRef) {} 254 ~ValueGuardPtr() { if( ref ) *ref = old; } 255 }; 256 257 template< typename T > 258 struct ValueGuardPtr< std::list< T > > { 259 std::list< T > old; 260 std::list< T >* ref; 261 262 ValueGuardPtr( std::list< T > * inRef) : old(), ref(inRef) { 263 if( ref ) { swap( *ref, old ); } 264 } 265 ~ValueGuardPtr() { if( ref ) { swap( *ref, old ); } } 266 }; 267 248 268 // ----------------------------------------------------------------------------- 249 269 // Helper struct and function to support … … 285 305 // for ( val : group_iterate( container1, container2, ... ) ) {} 286 306 // syntax to have a for each that iterates multiple containers of the same length 287 // TODO: update to use variadic arguments 307 // TODO: update to use variadic arguments, perfect forwarding 288 308 289 309 template< typename T1, typename T2 > … … 334 354 {} 335 355 356 CodeLocation( const CodeLocation& rhs ) = default; 357 336 358 bool isSet () const { 337 359 return -1 != linenumber; -
src/Concurrency/Keywords.cc
r9c951e3 rb1e63ac5 65 65 FunctionDecl * forwardDeclare( StructDecl * ); 66 66 ObjectDecl * addField( StructDecl * ); 67 void addRoutines( StructDecl *,ObjectDecl *, FunctionDecl * );67 void addRoutines( ObjectDecl *, FunctionDecl * ); 68 68 69 69 virtual bool is_target( StructDecl * decl ) = 0; … … 247 247 void ConcurrentSueKeyword::visit(StructDecl * decl) { 248 248 Visitor::visit(decl); 249 if( decl->get_name() == type_name ) {249 if( decl->get_name() == type_name && decl->has_body() ) { 250 250 assert( !type_decl ); 251 251 type_decl = decl; … … 264 264 FunctionDecl * func = forwardDeclare( decl ); 265 265 ObjectDecl * field = addField( decl ); 266 addRoutines( decl,field, func );266 addRoutines( field, func ); 267 267 } 268 268 … … 359 359 } 360 360 361 void ConcurrentSueKeyword::addRoutines( StructDecl * decl,ObjectDecl * field, FunctionDecl * func ) {361 void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) { 362 362 CompoundStmt * statement = new CompoundStmt( noLabels ); 363 363 statement->push_back( -
src/ControlStruct/ForExprMutator.cc
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ForExprMutator.cc -- 7 // ForExprMutator.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 19 19 20 20 namespace ControlStruct { 21 Statement *ForExprMutator::mutate( ForStmt *forStmt ) { 22 // recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99) 23 forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) ); 24 25 std::list<Statement *> &init = forStmt->get_initialization(); 21 Statement *ForExprMutator::postmutate( ForStmt *forStmt ) { 22 // hoist any initializer declarations to make them C89 (rather than C99) 23 std::list<Statement *> &init = forStmt->get_initialization(); 26 24 if ( init.size() == 0 ) { 27 25 return forStmt; … … 39 37 forStmt->set_initialization( std::list<Statement *>() ); 40 38 return block; 41 42 return forStmt;43 39 } 44 40 } // namespace ControlStruct -
src/ControlStruct/ForExprMutator.h
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ForExprMutator.h -- 7 // ForExprMutator.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 21 21 22 22 namespace ControlStruct { 23 class ForExprMutator : public Mutator{23 class ForExprMutator { 24 24 public: 25 virtual Statement *mutate( ForStmt * );25 Statement *postmutate( ForStmt * ); 26 26 }; 27 27 } // namespace ControlStruct -
src/ControlStruct/Mutate.cc
r9c951e3 rb1e63ac5 26 26 27 27 #include "Common/utility.h" 28 #include "Common/PassVisitor.h" 28 29 29 30 #include "SynTree/Visitor.h" … … 34 35 void mutate( std::list< Declaration * > translationUnit ) { 35 36 // hoist initialization out of for statements 36 ForExprMutatorformut;37 PassVisitor<ForExprMutator> formut; 37 38 38 39 // normalizes label definitions and generates multi-level exit labels -
src/ControlStruct/module.mk
r9c951e3 rb1e63ac5 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Thu Aug 4 11:38:06 201614 ## Update Count : 312 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 16:15:00 2017 14 ## Update Count : 4 15 15 ############################################################################### 16 16 17 17 SRC += ControlStruct/LabelGenerator.cc \ 18 18 ControlStruct/LabelFixer.cc \ 19 ControlStruct/MLEMutator.cc \19 ControlStruct/MLEMutator.cc \ 20 20 ControlStruct/Mutate.cc \ 21 ControlStruct/ForExprMutator.cc 22 21 ControlStruct/ForExprMutator.cc \ 22 ControlStruct/ExceptTranslate.cc -
src/GenPoly/Box.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 13 09:26:38201713 // Update Count : 34 112 // Last Modified On : Wed Jun 21 15:49:59 2017 13 // Update Count : 346 14 14 // 15 15 … … 62 62 namespace GenPoly { 63 63 namespace { 64 const std::list<Label> noLabels;65 66 64 FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars ); 67 65 … … 103 101 void passTypeVars( ApplicationExpr *appExpr, Type *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 104 102 /// wraps a function application with a new temporary for the out-parameter return value 105 Expression *addRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *retType, std::list< Expression *>::iterator &arg );103 Expression *addRetParam( ApplicationExpr *appExpr, Type *retType, std::list< Expression *>::iterator &arg ); 106 104 /// Replaces all the type parameters of a generic type with their concrete equivalents under the current environment 107 105 void replaceParametersWithConcrete( ApplicationExpr *appExpr, std::list< Expression* >& params ); … … 110 108 Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true ); 111 109 /// wraps a function application returning a polymorphic type with a new temporary for the out-parameter return value 112 Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *polyType, std::list< Expression *>::iterator &arg );110 Expression *addDynRetParam( ApplicationExpr *appExpr, Type *polyType, std::list< Expression *>::iterator &arg ); 113 111 Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 114 112 void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars ); … … 136 134 public: 137 135 template< typename DeclClass > 138 DeclClass *handleDecl( DeclClass *decl , Type *type);136 DeclClass *handleDecl( DeclClass *decl ); 139 137 template< typename AggDecl > 140 138 AggDecl * handleAggDecl( AggDecl * aggDecl ); … … 343 341 Statement *makeAlignTo( Expression *lhs, Expression *rhs ) { 344 342 // check that the lhs is zeroed out to the level of rhs 345 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant ( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "1") ) ) );343 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 346 344 // if not aligned, increment to alignment 347 345 Expression *ifExpr = makeOp( "?+=?", lhs->clone(), makeOp( "?-?", rhs->clone(), ifCond->clone() ) ); … … 386 384 387 385 // initialize size and alignment to 0 and 1 (will have at least one member to re-edit size) 388 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "0") ) ) );389 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );386 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 0 ) ) ) ); 387 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 390 388 unsigned long n_members = 0; 391 389 bool firstMember = true; … … 443 441 444 442 // calculate union layout in function body 445 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );446 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );443 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 444 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 447 445 for ( std::list< Declaration* >::const_iterator member = unionDecl->get_members().begin(); member != unionDecl->get_members().end(); ++member ) { 448 446 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); … … 506 504 DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) { 507 505 if ( functionDecl->get_statements() ) { // empty routine body ? 506 // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl; 508 507 doBeginScope(); 509 508 scopeTyVars.beginScope(); … … 550 549 retval = oldRetval; 551 550 doEndScope(); 551 // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl; 552 552 } // if 553 553 return functionDecl; … … 665 665 } 666 666 667 Expression *Pass1::addRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *retType, std::list< Expression *>::iterator &arg ) {667 Expression *Pass1::addRetParam( ApplicationExpr *appExpr, Type *retType, std::list< Expression *>::iterator &arg ) { 668 668 // Create temporary to hold return value of polymorphic function and produce that temporary as a result 669 669 // using a comma expression. … … 728 728 } 729 729 730 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *dynType, std::list< Expression *>::iterator &arg ) {730 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, Type *dynType, std::list< Expression *>::iterator &arg ) { 731 731 assert( env ); 732 732 Type *concrete = replaceWithConcrete( appExpr, dynType ); 733 733 // add out-parameter for return value 734 return addRetParam( appExpr, function,concrete, arg );734 return addRetParam( appExpr, concrete, arg ); 735 735 } 736 736 … … 739 739 // if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 740 740 if ( isDynRet( function, tyVars ) ) { 741 ret = addRetParam( appExpr, function , function->get_returnVals().front()->get_type(), arg );741 ret = addRetParam( appExpr, function->get_returnVals().front()->get_type(), arg ); 742 742 } // if 743 743 std::string mangleName = mangleAdapterName( function, tyVars ); … … 1118 1118 1119 1119 Expression *Pass1::mutate( ApplicationExpr *appExpr ) { 1120 // std::cerr << "mutate appExpr: " ;1120 // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl; 1121 1121 // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) { 1122 1122 // std::cerr << i->first << " "; … … 1143 1143 ReferenceToType *dynRetType = isDynRet( function, exprTyVars ); 1144 1144 1145 // std::cerr << function << std::endl; 1146 // std::cerr << "scopeTyVars: "; 1147 // printTyVarMap( std::cerr, scopeTyVars ); 1148 // std::cerr << "exprTyVars: "; 1149 // printTyVarMap( std::cerr, exprTyVars ); 1150 // std::cerr << "env: " << *env << std::endl; 1151 // std::cerr << needsAdapter( function, scopeTyVars ) << ! needsAdapter( function, exprTyVars) << std::endl; 1152 1145 1153 // NOTE: addDynRetParam needs to know the actual (generated) return type so it can make a temp variable, so pass the result type from the appExpr 1146 1154 // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int)) 1147 1155 // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome. 1148 1156 if ( dynRetType ) { 1157 // std::cerr << "dynRetType: " << dynRetType << std::endl; 1149 1158 Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result(); 1150 ret = addDynRetParam( appExpr, function,concRetType, arg ); // xxx - used to use dynRetType instead of concRetType1159 ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType 1151 1160 } else if ( needsAdapter( function, scopeTyVars ) && ! needsAdapter( function, exprTyVars) ) { // xxx - exprTyVars is used above...? 1152 1161 // xxx - the ! needsAdapter check may be incorrect. It seems there is some situation where an adapter is applied where it shouldn't be, and this fixes it for some cases. More investigation is needed. … … 1282 1291 1283 1292 template< typename DeclClass > 1284 DeclClass * Pass2::handleDecl( DeclClass *decl , Type *type) {1293 DeclClass * Pass2::handleDecl( DeclClass *decl ) { 1285 1294 DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) ); 1286 1295 … … 1296 1305 1297 1306 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) { 1298 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl , functionDecl->get_functionType()) );1307 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) ); 1299 1308 FunctionType * ftype = functionDecl->get_functionType(); 1300 1309 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { … … 1321 1330 1322 1331 ObjectDecl * Pass2::mutate( ObjectDecl *objectDecl ) { 1323 return handleDecl( objectDecl , objectDecl->get_type());1332 return handleDecl( objectDecl ); 1324 1333 } 1325 1334 … … 1344 1353 addToTyVarMap( typeDecl, scopeTyVars ); 1345 1354 if ( typeDecl->get_base() ) { 1346 return handleDecl( typeDecl , typeDecl->get_base());1355 return handleDecl( typeDecl ); 1347 1356 } else { 1348 1357 return Parent::mutate( typeDecl ); … … 1351 1360 1352 1361 TypedefDecl * Pass2::mutate( TypedefDecl *typedefDecl ) { 1353 return handleDecl( typedefDecl , typedefDecl->get_base());1362 return handleDecl( typedefDecl ); 1354 1363 } 1355 1364 … … 1566 1575 /// Returns an index expression into the offset array for a type 1567 1576 Expression *makeOffsetIndex( Type *objectType, long i ) { 1568 std::stringstream offset_namer; 1569 offset_namer << i; 1570 ConstantExpr *fieldIndex = new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), offset_namer.str() ) ); 1577 ConstantExpr *fieldIndex = new ConstantExpr( Constant::from_ulong( i ) ); 1571 1578 UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) ); 1572 1579 fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) ); … … 1781 1788 // all union members are at offset zero 1782 1789 delete offsetofExpr; 1783 return new ConstantExpr( Constant ( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0") );1790 return new ConstantExpr( Constant::from_ulong( 0 ) ); 1784 1791 } else return offsetofExpr; 1785 1792 } … … 1806 1813 std::list< Initializer* > inits; 1807 1814 for ( std::list< Declaration* >::const_iterator member = baseMembers.begin(); member != baseMembers.end(); ++member ) { 1808 DeclarationWithType *memberDecl; 1809 if ( DeclarationWithType *origMember = dynamic_cast< DeclarationWithType* >( *member ) ) { 1810 memberDecl = origMember->clone(); 1815 if ( DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( *member ) ) { 1816 inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) ); 1811 1817 } else { 1812 memberDecl = new ObjectDecl( (*member)->get_name(), Type::StorageClasses(), LinkageSpec::Cforall, 0, offsetType->clone(), 0);1818 assertf( false, "Requesting offset of Non-DWT member: %s", toString( *member ).c_str() ); 1813 1819 } 1814 inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );1815 1820 } 1816 1821 -
src/GenPoly/CopyParams.cc
r9c951e3 rb1e63ac5 45 45 46 46 CopyParams::CopyParams() : namer( "_cp" ) {} 47 48 static const std::list< Label > noLabels;49 47 50 48 void CopyParams::visit( FunctionDecl *funcDecl ) { -
src/GenPoly/DeclMutator.cc
r9c951e3 rb1e63ac5 9 9 // Author : Aaron B. Moss 10 10 // Created On : Fri Nov 27 14:44:00 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Aug 4 11:16:43 201613 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:49:00 2017 13 // Update Count : 4 14 14 // 15 15 … … 20 20 21 21 namespace GenPoly { 22 namespace {23 const std::list<Label> noLabels;24 }25 26 22 DeclMutator::DeclMutator() : Mutator(), declsToAdd(1), declsToAddAfter(1) {} 27 23 28 24 DeclMutator::~DeclMutator() {} 29 25 30 26 void DeclMutator::mutateDeclarationList( std::list< Declaration* > &decls ) { 31 27 for ( std::list< Declaration* >::iterator decl = decls.begin(); ; ++decl ) { … … 34 30 35 31 if ( decl == decls.end() ) break; 36 32 37 33 // run mutator on declaration 38 34 *decl = maybeMutate( *decl, *this ); … … 55 51 newBack->splice( newBack->end(), *back ); 56 52 declsToAdd.pop_back(); 57 53 58 54 back = declsToAddAfter.rbegin(); 59 55 newBack = back + 1; … … 66 62 CompoundStmt *compoundStmt = dynamic_cast< CompoundStmt* >(stmt); 67 63 if ( compoundStmt ) return mutate( compoundStmt ); 68 64 69 65 doBeginScope(); 70 66 71 67 // run mutator on statement 72 68 stmt = maybeMutate( stmt, *this ); … … 102 98 doBeginScope(); 103 99 104 100 105 101 for ( std::list< Statement* >::iterator stmt = stmts.begin(); ; ++stmt ) { 106 102 // add any new declarations after the previous statement … … 112 108 113 109 if ( stmt == stmts.end() ) break; 114 110 115 111 // run mutator on statement 116 112 *stmt = maybeMutate( *stmt, *this ); … … 123 119 declsToAdd.back().clear(); 124 120 } 125 121 126 122 doEndScope(); 127 123 } … … 139 135 return compoundStmt; 140 136 } 141 137 142 138 Statement* DeclMutator::mutate(IfStmt *ifStmt) { 143 139 ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) ); … … 146 142 return ifStmt; 147 143 } 148 144 149 145 Statement* DeclMutator::mutate(WhileStmt *whileStmt) { 150 146 whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) ); … … 152 148 return whileStmt; 153 149 } 154 150 155 151 Statement* DeclMutator::mutate(ForStmt *forStmt) { 156 152 mutateAll( forStmt->get_initialization(), *this ); … … 160 156 return forStmt; 161 157 } 162 158 163 159 Statement* DeclMutator::mutate(SwitchStmt *switchStmt) { 164 160 switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) ); … … 166 162 return switchStmt; 167 163 } 168 164 169 165 Statement* DeclMutator::mutate(CaseStmt *caseStmt) { 170 166 caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) ); … … 172 168 return caseStmt; 173 169 } 174 170 175 171 Statement* DeclMutator::mutate(TryStmt *tryStmt) { 176 172 tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) ); … … 179 175 return tryStmt; 180 176 } 181 177 182 178 Statement* DeclMutator::mutate(CatchStmt *catchStmt) { 183 179 catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) ); 180 catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) ); 184 181 catchStmt->set_body( mutateStatement( catchStmt->get_body() ) ); 185 182 return catchStmt; -
src/GenPoly/InstantiateGeneric.cc
r9c951e3 rb1e63ac5 22 22 #include "InstantiateGeneric.h" 23 23 24 #include "DeclMutator.h"25 24 #include "GenPoly.h" 26 25 #include "ScopedSet.h" 27 26 #include "ScrubTyVars.h" 28 #include "PolyMutator.h" 27 28 #include "Common/PassVisitor.h" 29 #include "Common/ScopedMap.h" 30 #include "Common/UniqueName.h" 31 #include "Common/utility.h" 29 32 30 33 #include "ResolvExpr/typeops.h" … … 34 37 #include "SynTree/Type.h" 35 38 36 #include "Common/ScopedMap.h" 37 #include " Common/UniqueName.h"38 #include "Common/utility.h" 39 40 #include "InitTweak/InitTweak.h" 41 39 42 40 43 namespace GenPoly { … … 153 156 } 154 157 155 // collect the environments of each TypeInstType so that type variables can be replaced156 // xxx - possibly temporary solution. Access to type environments is required in GenericInstantiator, but it needs to be a DeclMutator which does not provide easy access to the type environments.157 class EnvFinder final : public GenPoly::PolyMutator {158 public:159 using GenPoly::PolyMutator::mutate;160 virtual Type * mutate( TypeInstType * inst ) override {161 if ( env ) envMap[inst] = env;162 return inst;163 }164 165 // don't want to associate an environment with TypeInstTypes that occur in function types - this may actually only apply to function types belonging to DeclarationWithTypes (or even just FunctionDecl)?166 virtual Type * mutate( FunctionType * ftype ) override {167 return ftype;168 }169 std::unordered_map< ReferenceToType *, TypeSubstitution * > envMap;170 };171 172 158 /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately 173 class GenericInstantiator final : public DeclMutator{159 struct GenericInstantiator final : public WithTypeSubstitution, public WithDeclsToAdd, public WithVisitorRef<GenericInstantiator>, public WithGuards { 174 160 /// Map of (generic type, parameter list) pairs to concrete type instantiations 175 161 InstantiationMap< AggregateDecl, AggregateDecl > instantiations; … … 178 164 /// Namer for concrete types 179 165 UniqueName typeNamer; 180 /// Reference to mapping of environments 181 const std::unordered_map< ReferenceToType *, TypeSubstitution * > & envMap; 182 public: 183 GenericInstantiator( const std::unordered_map< ReferenceToType *, TypeSubstitution * > & envMap ) : DeclMutator(), instantiations(), dtypeStatics(), typeNamer("_conc_"), envMap( envMap ) {} 184 185 using DeclMutator::mutate; 186 virtual Type* mutate( StructInstType *inst ) override; 187 virtual Type* mutate( UnionInstType *inst ) override; 188 189 virtual void doBeginScope() override; 190 virtual void doEndScope() override; 166 /// Should not make use of type environment to replace types of function parameter and return values. 167 bool inFunctionType = false; 168 GenericInstantiator() : instantiations(), dtypeStatics(), typeNamer("_conc_") {} 169 170 Type* postmutate( StructInstType *inst ); 171 Type* postmutate( UnionInstType *inst ); 172 173 void premutate( FunctionType * ftype ) { 174 GuardValue( inFunctionType ); 175 inFunctionType = true; 176 } 177 178 void beginScope(); 179 void endScope(); 191 180 private: 192 181 /// Wrap instantiation lookup for structs … … 207 196 208 197 void instantiateGeneric( std::list< Declaration* > &translationUnit ) { 209 EnvFinder finder; 210 mutateAll( translationUnit, finder ); 211 GenericInstantiator instantiator( finder.envMap ); 212 instantiator.mutateDeclarationList( translationUnit ); 198 PassVisitor<GenericInstantiator> instantiator; 199 mutateAll( translationUnit, instantiator ); 213 200 } 214 201 … … 306 293 Type *GenericInstantiator::replaceWithConcrete( Type *type, bool doClone ) { 307 294 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 308 if ( envMap.count( typeInst ) ) { 309 TypeSubstitution * env = envMap.at( typeInst ); 295 if ( env && ! inFunctionType ) { 310 296 Type *concrete = env->lookup( typeInst->get_name() ); 311 297 if ( concrete ) { … … 331 317 332 318 333 Type* GenericInstantiator::mutate( StructInstType *inst ) { 334 // mutate subtypes 335 Type *mutated = Mutator::mutate( inst ); 336 inst = dynamic_cast< StructInstType* >( mutated ); 337 if ( ! inst ) return mutated; 338 319 Type* GenericInstantiator::postmutate( StructInstType *inst ) { 339 320 // exit early if no need for further mutation 340 321 if ( inst->get_parameters().empty() ) return inst; … … 367 348 concDecl->set_body( inst->get_baseStruct()->has_body() ); 368 349 substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 369 DeclMutator::addDeclaration( concDecl );370 insert( inst, typeSubs, concDecl );371 concDecl->acceptMutator( *this ); // recursively instantiate members350 insert( inst, typeSubs, concDecl ); // must insert before recursion 351 concDecl->acceptMutator( *visitor ); // recursively instantiate members 352 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first 372 353 } 373 354 StructInstType *newInst = new StructInstType( inst->get_qualifiers(), concDecl->get_name() ); … … 388 369 } 389 370 390 Type* GenericInstantiator::mutate( UnionInstType *inst ) { 391 // mutate subtypes 392 Type *mutated = Mutator::mutate( inst ); 393 inst = dynamic_cast< UnionInstType* >( mutated ); 394 if ( ! inst ) return mutated; 395 371 Type* GenericInstantiator::postmutate( UnionInstType *inst ) { 396 372 // exit early if no need for further mutation 397 373 if ( inst->get_parameters().empty() ) return inst; … … 422 398 concDecl->set_body( inst->get_baseUnion()->has_body() ); 423 399 substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 424 DeclMutator::addDeclaration( concDecl );425 insert( inst, typeSubs, concDecl );426 concDecl->acceptMutator( *this ); // recursively instantiate members400 insert( inst, typeSubs, concDecl ); // must insert before recursion 401 concDecl->acceptMutator( *visitor ); // recursively instantiate members 402 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first 427 403 } 428 404 UnionInstType *newInst = new UnionInstType( inst->get_qualifiers(), concDecl->get_name() ); … … 442 418 } 443 419 444 void GenericInstantiator::doBeginScope() { 445 DeclMutator::doBeginScope(); 420 void GenericInstantiator::beginScope() { 446 421 instantiations.beginScope(); 447 422 dtypeStatics.beginScope(); 448 423 } 449 424 450 void GenericInstantiator::doEndScope() { 451 DeclMutator::doEndScope(); 425 void GenericInstantiator::endScope() { 452 426 instantiations.endScope(); 453 427 dtypeStatics.endScope(); -
src/GenPoly/Lvalue.cc
r9c951e3 rb1e63ac5 36 36 namespace GenPoly { 37 37 namespace { 38 const std::list<Label> noLabels;39 40 38 /// Replace uses of lvalue returns with appropriate pointers 41 39 class Pass1 : public Mutator { -
src/GenPoly/PolyMutator.cc
r9c951e3 rb1e63ac5 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 Aug 4 11:26:22 201613 // Update Count : 1 611 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:47:00 2017 13 // Update Count : 17 14 14 // 15 15 … … 123 123 124 124 Statement * PolyMutator::mutate(TryStmt *tryStmt) { 125 tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );125 tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) ); 126 126 mutateAll( tryStmt->get_catchers(), *this ); 127 tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) ); 127 128 return tryStmt; 128 129 } 129 130 130 131 Statement * PolyMutator::mutate(CatchStmt *cathStmt) { 131 cathStmt->set_body( mutateStatement( cathStmt->get_body() ) ); 132 cathStmt->set_decl( maybeMutate( cathStmt->get_decl(), *this ) ); 132 cathStmt->set_body( mutateStatement( cathStmt->get_body() ) ); 133 cathStmt->set_cond( maybeMutate( cathStmt->get_cond(), *this ) ); 134 cathStmt->set_decl( maybeMutate( cathStmt->get_decl(), *this ) ); 133 135 return cathStmt; 134 136 } -
src/GenPoly/Specialize.cc
r9c951e3 rb1e63ac5 93 93 } 94 94 95 bool needsTupleSpecialization( Type *formalType, Type *actualType , TypeSubstitution *env) {95 bool needsTupleSpecialization( Type *formalType, Type *actualType ) { 96 96 // Needs tuple specialization if the structure of the formal type and actual type do not match. 97 97 // This is the case if the formal type has ttype polymorphism, or if the structure of tuple types … … 99 99 if ( FunctionType * fftype = getFunctionType( formalType ) ) { 100 100 if ( fftype->isTtype() ) return true; 101 // conversion of 0 (null) to function type does not require tuple specialization 102 if ( dynamic_cast< ZeroType * >( actualType ) ) return false; 101 103 FunctionType * aftype = getFunctionType( actualType ); 102 104 assertf( aftype, "formal type is a function type, but actual type is not." ); … … 112 114 113 115 bool needsSpecialization( Type *formalType, Type *actualType, TypeSubstitution *env ) { 114 return needsPolySpecialization( formalType, actualType, env ) || needsTupleSpecialization( formalType, actualType , env);116 return needsPolySpecialization( formalType, actualType, env ) || needsTupleSpecialization( formalType, actualType ); 115 117 } 116 118 -
src/InitTweak/FixGlobalInit.cc
r9c951e3 rb1e63ac5 26 26 27 27 namespace InitTweak { 28 namespace {29 const std::list<Label> noLabels;30 }31 32 28 class GlobalFixer : public Visitor { 33 29 public: … … 129 125 130 126 // only modify global variables 131 void GlobalFixer::visit( FunctionDecl *functionDecl ) {}132 void GlobalFixer::visit( StructDecl *aggregateDecl ) {}133 void GlobalFixer::visit( UnionDecl *aggregateDecl ) {}134 void GlobalFixer::visit( EnumDecl *aggregateDecl ) {}135 void GlobalFixer::visit( TraitDecl *aggregateDecl ) {}136 void GlobalFixer::visit( TypeDecl *typeDecl ) {}127 void GlobalFixer::visit( __attribute__((unused)) FunctionDecl *functionDecl ) {} 128 void GlobalFixer::visit( __attribute__((unused)) StructDecl *aggregateDecl ) {} 129 void GlobalFixer::visit( __attribute__((unused)) UnionDecl *aggregateDecl ) {} 130 void GlobalFixer::visit( __attribute__((unused)) EnumDecl *aggregateDecl ) {} 131 void GlobalFixer::visit( __attribute__((unused)) TraitDecl *aggregateDecl ) {} 132 void GlobalFixer::visit( __attribute__((unused)) TypeDecl *typeDecl ) {} 137 133 138 134 } // namespace InitTweak -
src/InitTweak/FixInit.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:13:47201713 // Update Count : 7 112 // Last Modified On : Wed Jun 21 17:35:05 2017 13 // Update Count : 74 14 14 // 15 15 … … 20 20 #include <unordered_map> 21 21 #include <unordered_set> 22 22 23 #include "InitTweak.h" 23 24 #include "GenInit.h" 24 25 #include "FixInit.h" 25 26 #include "FixGlobalInit.h" 27 #include "CodeGen/GenType.h" // for warning/error messages 28 #include "Common/PassVisitor.h" 29 #include "GenPoly/DeclMutator.h" 30 #include "GenPoly/PolyMutator.h" 26 31 #include "ResolvExpr/Resolver.h" 27 32 #include "ResolvExpr/typeops.h" 33 #include "SymTab/Autogen.h" 34 #include "SymTab/Indexer.h" 35 #include "SynTree/AddStmtVisitor.h" 36 #include "SynTree/Attribute.h" 28 37 #include "SynTree/Declaration.h" 29 #include "SynTree/Type.h"30 38 #include "SynTree/Expression.h" 31 #include "SynTree/Attribute.h"32 #include "SynTree/Statement.h"33 39 #include "SynTree/Initializer.h" 34 40 #include "SynTree/Mutator.h" 35 #include "SymTab/Indexer.h" 36 #include "SymTab/Autogen.h" 37 #include "GenPoly/PolyMutator.h" 38 #include "GenPoly/DeclMutator.h" 39 #include "SynTree/AddStmtVisitor.h" 40 #include "CodeGen/GenType.h" // for warning/error messages 41 #include "SynTree/Statement.h" 42 #include "SynTree/Type.h" 41 43 #include "Tuples/Tuples.h" 42 44 … … 54 56 typedef std::unordered_map< int, int > UnqCount; 55 57 56 class InsertImplicitCalls final : public GenPoly::PolyMutator{58 class InsertImplicitCalls : public WithTypeSubstitution { 57 59 public: 58 60 /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which … … 61 63 62 64 InsertImplicitCalls( EnvMap & envMap ) : envMap( envMap ) {} 63 typedef GenPoly::PolyMutator Parent; 64 using Parent::mutate; 65 virtual Expression * mutate( ApplicationExpr * appExpr ) override; 66 virtual Expression * mutate( StmtExpr * stmtExpr ) override; 65 66 Expression * postmutate( ApplicationExpr * appExpr ); 67 void premutate( StmtExpr * stmtExpr ); 67 68 68 69 // collects environments for relevant nodes … … 103 104 typedef AddStmtVisitor Parent; 104 105 using Parent::visit; 105 typedef std::set< ObjectDecl * > ObjectSet; 106 // use ordered data structure to maintain ordering for set_difference and for consistent error messages 107 typedef std::list< ObjectDecl * > ObjectSet; 106 108 virtual void visit( CompoundStmt *compoundStmt ) override; 107 109 virtual void visit( DeclStmt *stmt ) override; 108 110 109 111 // don't go into other functions 110 virtual void visit( FunctionDecl *decl ) override {}112 virtual void visit( __attribute__((unused)) FunctionDecl *decl ) override {} 111 113 112 114 protected: … … 115 117 116 118 // debug 117 struct printSet {118 typedef ObjDeclCollector::ObjectSet ObjectSet;119 printSet( const ObjectSet & objs ) : objs( objs ) {}119 template<typename ObjectSet> 120 struct PrintSet { 121 PrintSet( const ObjectSet & objs ) : objs( objs ) {} 120 122 const ObjectSet & objs; 121 123 }; 122 std::ostream & operator<<( std::ostream & out, const printSet & set) { 124 template<typename ObjectSet> 125 PrintSet<ObjectSet> printSet( const ObjectSet & objs ) { return PrintSet<ObjectSet>( objs ); } 126 template<typename ObjectSet> 127 std::ostream & operator<<( std::ostream & out, const PrintSet<ObjectSet> & set) { 123 128 out << "{ "; 124 129 for ( ObjectDecl * obj : set.objs ) { … … 190 195 }; 191 196 192 class FixInit final : public GenPoly::PolyMutator{197 class FixInit : public WithStmtsToAdd { 193 198 public: 194 199 /// expand each object declaration to use its constructor after it is declared. 195 200 static void fixInitializers( std::list< Declaration * > &translationUnit ); 196 201 197 typedef GenPoly::PolyMutator Parent; 198 using Parent::mutate; 199 virtual DeclarationWithType * mutate( ObjectDecl *objDecl ) override; 202 DeclarationWithType * postmutate( ObjectDecl *objDecl ); 200 203 201 204 std::list< Declaration * > staticDtorDecls; … … 300 303 namespace { 301 304 void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ) { 302 InsertImplicitCallsinserter( envMap );305 PassVisitor<InsertImplicitCalls> inserter( envMap ); 303 306 mutateAll( translationUnit, inserter ); 304 307 } … … 310 313 311 314 void FixInit::fixInitializers( std::list< Declaration * > & translationUnit ) { 312 FixInitfixer;315 PassVisitor<FixInit> fixer; 313 316 314 317 // can't use mutateAll, because need to insert declarations at top-level … … 318 321 try { 319 322 *i = maybeMutate( *i, fixer ); 320 translationUnit.splice( i, fixer. staticDtorDecls );323 translationUnit.splice( i, fixer.pass.staticDtorDecls ); 321 324 } catch( SemanticError &e ) { 322 325 e.set_location( (*i)->location ); … … 350 353 } 351 354 352 Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) { 353 appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) ); 355 Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) { 354 356 assert( appExpr ); 355 357 … … 393 395 } 394 396 395 Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) {397 void InsertImplicitCalls::premutate( StmtExpr * stmtExpr ) { 396 398 assert( env ); 397 399 envMap[stmtExpr] = env; 398 return Parent::mutate( stmtExpr );399 400 } 400 401 … … 696 697 } 697 698 698 DeclarationWithType *FixInit::mutate( ObjectDecl *objDecl ) { 699 // first recursively handle pieces of ObjectDecl so that they aren't missed by other visitors when the init 700 // is removed from the ObjectDecl 701 objDecl = dynamic_cast< ObjectDecl * >( Parent::mutate( objDecl ) ); 699 DeclarationWithType *FixInit::postmutate( ObjectDecl *objDecl ) { 700 // since this removes the init field from objDecl, it must occur after children are mutated (i.e. postmutate) 702 701 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 703 702 // a decision should have been made by the resolver, so ctor and init are not both non-NULL … … 729 728 // static bool __objName_uninitialized = true 730 729 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 731 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant ( boolType->clone(), "1" ) ), noDesignators);730 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ) ); 732 731 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr ); 733 732 isUninitializedVar->fixUniqueId(); … … 736 735 UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) ); 737 736 setTrue->get_args().push_back( new VariableExpr( isUninitializedVar ) ); 738 setTrue->get_args().push_back( new ConstantExpr( Constant ( boolType->clone(), "0") ) );737 setTrue->get_args().push_back( new ConstantExpr( Constant::from_int( 0 ) ) ); 739 738 740 739 // generate body of if … … 750 749 751 750 Statement * dtor = ctorInit->get_dtor(); 752 objDecl->set_init( NULL);753 ctorInit->set_ctor( NULL);751 objDecl->set_init( nullptr ); 752 ctorInit->set_ctor( nullptr ); 754 753 ctorInit->set_dtor( nullptr ); 755 754 if ( dtor ) { … … 804 803 } else { 805 804 stmtsToAddAfter.push_back( ctor ); 806 objDecl->set_init( NULL);807 ctorInit->set_ctor( NULL);805 objDecl->set_init( nullptr ); 806 ctorInit->set_ctor( nullptr ); 808 807 } 809 808 } // if 810 809 } else if ( Initializer * init = ctorInit->get_init() ) { 811 810 objDecl->set_init( init ); 812 ctorInit->set_init( NULL);811 ctorInit->set_init( nullptr ); 813 812 } else { 814 813 // no constructor and no initializer, which is okay 815 objDecl->set_init( NULL);814 objDecl->set_init( nullptr ); 816 815 } // if 817 816 delete ctorInit; … … 821 820 822 821 void ObjDeclCollector::visit( CompoundStmt * compoundStmt ) { 823 std::set< ObjectDecl * >prevVars = curVars;822 ObjectSet prevVars = curVars; 824 823 Parent::visit( compoundStmt ); 825 824 curVars = prevVars; … … 829 828 // keep track of all variables currently in scope 830 829 if ( ObjectDecl * objDecl = dynamic_cast< ObjectDecl * > ( stmt->get_decl() ) ) { 831 curVars. insert( objDecl );830 curVars.push_back( objDecl ); 832 831 } // if 833 832 Parent::visit( stmt ); … … 896 895 Parent::visit( compoundStmt ); 897 896 898 // add destructors for the current scope that we're exiting 897 // add destructors for the current scope that we're exiting, unless the last statement is a return, which 898 // causes unreachable code warnings 899 899 std::list< Statement * > & statements = compoundStmt->get_kids(); 900 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 900 if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) { 901 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 902 } 901 903 reverseDeclOrder.pop_front(); 902 904 } 903 905 904 void InsertDtors::visit( ReturnStmt * returnStmt ) {906 void InsertDtors::visit( __attribute((unused)) ReturnStmt * returnStmt ) { 905 907 // return exits all scopes, so dump destructors for all scopes 906 908 for ( OrderedDecls & od : reverseDeclOrder ) { … … 941 943 ) 942 944 if ( ! diff.empty() ) { 945 // create an auxilliary set for fast lookup -- can't make diff a set, because diff ordering should be consistent for error messages. 946 std::unordered_set<ObjectDecl *> needsDestructor( diff.begin(), diff.end() ); 947 943 948 // go through decl ordered list of objectdecl. for each element that occurs in diff, output destructor 944 949 OrderedDecls ordered; 945 950 for ( OrderedDecls & rdo : reverseDeclOrder ) { 946 951 // add elements from reverseDeclOrder into ordered if they occur in diff - it is key that this happens in reverse declaration order. 947 copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return diff.count( objDecl ); } );952 copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return needsDestructor.count( objDecl ); } ); 948 953 } // for 949 954 insertDtors( ordered.begin(), ordered.end(), back_inserter( stmtsToAdd ) ); -
src/InitTweak/GenInit.cc
r9c951e3 rb1e63ac5 16 16 #include <stack> 17 17 #include <list> 18 19 #include "InitTweak.h" 18 20 #include "GenInit.h" 19 #include "InitTweak.h" 21 22 #include "Common/PassVisitor.h" 23 24 #include "GenPoly/DeclMutator.h" 25 #include "GenPoly/PolyMutator.h" 26 #include "GenPoly/ScopedSet.h" 27 28 #include "ResolvExpr/typeops.h" 29 20 30 #include "SynTree/Declaration.h" 21 #include "SynTree/Type.h"22 31 #include "SynTree/Expression.h" 23 #include "SynTree/Statement.h"24 32 #include "SynTree/Initializer.h" 25 33 #include "SynTree/Mutator.h" 34 #include "SynTree/Statement.h" 35 #include "SynTree/Type.h" 36 26 37 #include "SymTab/Autogen.h" 27 38 #include "SymTab/Mangler.h" 28 #include "GenPoly/PolyMutator.h"29 #include "GenPoly/DeclMutator.h"30 #include "GenPoly/ScopedSet.h"31 #include "ResolvExpr/typeops.h"32 39 33 40 namespace InitTweak { … … 37 44 } 38 45 39 class ReturnFixer final : public GenPoly::PolyMutator { 40 public: 46 struct ReturnFixer : public WithStmtsToAdd, public WithGuards { 41 47 /// consistently allocates a temporary variable for the return value 42 48 /// of a function so that anything which the resolver decides can be constructed … … 44 50 static void makeReturnTemp( std::list< Declaration * > &translationUnit ); 45 51 46 ReturnFixer(); 47 48 typedef GenPoly::PolyMutator Parent; 49 using Parent::mutate; 50 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override; 51 virtual Statement * mutate( ReturnStmt * returnStmt ) override; 52 void premutate( FunctionDecl *functionDecl ); 53 void premutate( ReturnStmt * returnStmt ); 52 54 53 55 protected: … … 56 58 }; 57 59 58 class CtorDtor final : public GenPoly::PolyMutator { 59 public: 60 typedef GenPoly::PolyMutator Parent; 61 using Parent::mutate; 60 struct CtorDtor : public WithGuards, public WithShortCircuiting { 62 61 /// create constructor and destructor statements for object declarations. 63 62 /// the actual call statements will be added in after the resolver has run … … 66 65 static void generateCtorDtor( std::list< Declaration * > &translationUnit ); 67 66 68 virtual DeclarationWithType * mutate( ObjectDecl * ) override; 69 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override; 67 void previsit( ObjectDecl * ); 68 void previsit( FunctionDecl *functionDecl ); 69 70 70 // should not traverse into any of these declarations to find objects 71 71 // that need to be constructed or destructed 72 v irtual Declaration* mutate( StructDecl *aggregateDecl ) override;73 v irtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }74 v irtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }75 v irtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }76 v irtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }77 v irtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }78 79 v irtual Type * mutate( FunctionType *funcType ) override { return funcType; }80 81 v irtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override;72 void previsit( StructDecl *aggregateDecl ); 73 void previsit( UnionDecl *aggregateDecl ) { visit_children = false; } 74 void previsit( EnumDecl *aggregateDecl ) { visit_children = false; } 75 void previsit( TraitDecl *aggregateDecl ) { visit_children = false; } 76 void previsit( TypeDecl *typeDecl ) { visit_children = false; } 77 void previsit( TypedefDecl *typeDecl ) { visit_children = false; } 78 79 void previsit( FunctionType *funcType ) { visit_children = false; } 80 81 void previsit( CompoundStmt * compoundStmt ); 82 82 83 83 private: … … 131 131 132 132 void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) { 133 ReturnFixerfixer;133 PassVisitor<ReturnFixer> fixer; 134 134 mutateAll( translationUnit, fixer ); 135 135 } 136 136 137 ReturnFixer::ReturnFixer() {} 138 139 Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) { 137 void ReturnFixer::premutate( ReturnStmt *returnStmt ) { 140 138 std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals(); 141 139 assert( returnVals.size() == 0 || returnVals.size() == 1 ); … … 148 146 construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front() ) ) ); 149 147 construct->get_args().push_back( returnStmt->get_expr() ); 150 stmtsToAdd .push_back(new ExprStmt(noLabels, construct));148 stmtsToAddBefore.push_back(new ExprStmt(noLabels, construct)); 151 149 152 150 // return the retVal object 153 151 returnStmt->set_expr( new VariableExpr( returnVals.front() ) ); 154 152 } // if 155 return returnStmt; 156 } 157 158 DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) { 159 ValueGuard< FunctionType * > oldFtype( ftype ); 160 ValueGuard< std::string > oldFuncName( funcName ); 153 } 154 155 void ReturnFixer::premutate( FunctionDecl *functionDecl ) { 156 GuardValue( ftype ); 157 GuardValue( funcName ); 161 158 162 159 ftype = functionDecl->get_functionType(); 163 160 funcName = functionDecl->get_name(); 164 return Parent::mutate( functionDecl );165 161 } 166 162 … … 212 208 213 209 void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) { 214 CtorDtorctordtor;215 mutateAll( translationUnit, ctordtor );210 PassVisitor<CtorDtor> ctordtor; 211 acceptAll( translationUnit, ctordtor ); 216 212 } 217 213 … … 291 287 } 292 288 293 DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {289 void CtorDtor::previsit( ObjectDecl * objDecl ) { 294 290 handleDWT( objDecl ); 295 291 // hands off if @=, extern, builtin, etc. … … 303 299 objDecl->set_init( genCtorInit( objDecl ) ); 304 300 } 305 return Parent::mutate( objDecl ); 306 } 307 308 DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) { 309 ValueGuard< bool > oldInFunc = inFunction; 301 } 302 303 void CtorDtor::previsit( FunctionDecl *functionDecl ) { 304 GuardValue( inFunction ); 310 305 inFunction = true; 311 306 312 307 handleDWT( functionDecl ); 313 308 314 managedTypes.beginScope();309 GuardScope( managedTypes ); 315 310 // go through assertions and recursively add seen ctor/dtors 316 311 for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) { 317 312 for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) { 318 assertion = assertion->acceptMutator( *this);313 handleDWT( assertion ); 319 314 } 320 315 } 321 // parameters should not be constructed and destructed, so don't mutate FunctionType 322 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); 323 324 managedTypes.endScope(); 325 return functionDecl; 326 } 327 328 Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) { 316 317 PassVisitor<CtorDtor> newCtorDtor; 318 newCtorDtor.pass = *this; 319 maybeAccept( functionDecl->get_statements(), newCtorDtor ); 320 visit_children = false; // do not try and construct parameters or forall parameters - must happen after maybeAccept 321 } 322 323 void CtorDtor::previsit( StructDecl *aggregateDecl ) { 324 visit_children = false; // do not try to construct and destruct aggregate members 325 329 326 // don't construct members, but need to take note if there is a managed member, 330 327 // because that means that this type is also managed … … 338 335 } 339 336 } 340 return aggregateDecl; 341 } 342 343 CompoundStmt * CtorDtor::mutate( CompoundStmt * compoundStmt ) { 344 managedTypes.beginScope(); 345 CompoundStmt * stmt = Parent::mutate( compoundStmt ); 346 managedTypes.endScope(); 347 return stmt; 348 } 349 337 } 338 339 void CtorDtor::previsit( CompoundStmt * compoundStmt ) { 340 GuardScope( managedTypes ); 341 } 350 342 } // namespace InitTweak 351 343 -
src/InitTweak/InitTweak.cc
r9c951e3 rb1e63ac5 14 14 public: 15 15 bool hasDesignations = false; 16 template<typename Init> 17 void handleInit( Init * init ) { 18 if ( ! init->get_designators().empty() ) hasDesignations = true; 19 else Visitor::visit( init ); 20 } 21 virtual void visit( SingleInit * singleInit ) { handleInit( singleInit); } 22 virtual void visit( ListInit * listInit ) { handleInit( listInit); } 16 virtual void visit( Designation * des ) { 17 if ( ! des->get_designators().empty() ) hasDesignations = true; 18 else Visitor::visit( des ); 19 } 23 20 }; 24 21 … … 92 89 InitImpl( Initializer * init ) : init( init ) {} 93 90 94 virtual std::list< Expression * > next( std::list< Expression * > & indices ) {91 virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) { 95 92 // this is wrong, but just a placeholder for now 96 93 // if ( ! flattened ) flatten( indices ); … … 248 245 } 249 246 250 Statement * ExprImpl::buildListInit( UntypedExpr * dst,std::list< Expression * > & indices ) {247 Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) { 251 248 return NULL; 252 249 } … … 477 474 ConstExprChecker() : isConstExpr( true ) {} 478 475 479 virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; } 480 virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; } 476 using Visitor::visit; 477 478 virtual void visit( __attribute((unused)) ApplicationExpr *applicationExpr ) { isConstExpr = false; } 479 virtual void visit( __attribute((unused)) UntypedExpr *untypedExpr ) { isConstExpr = false; } 481 480 virtual void visit( NameExpr *nameExpr ) { 482 481 // xxx - temporary hack, because 0 and 1 really should be constexprs, even though they technically aren't in Cforall today … … 489 488 if ( ! dynamic_cast< NameExpr * >( arg) && ! dynamic_cast< VariableExpr * >( arg ) && ! dynamic_cast< MemberExpr * >( arg ) && ! dynamic_cast< UntypedMemberExpr * >( arg ) ) isConstExpr = false; 490 489 } 491 virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; }492 virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; }493 virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; }494 virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; }490 virtual void visit( __attribute((unused)) LabelAddressExpr *labAddressExpr ) { isConstExpr = false; } 491 virtual void visit( __attribute((unused)) UntypedMemberExpr *memberExpr ) { isConstExpr = false; } 492 virtual void visit( __attribute((unused)) MemberExpr *memberExpr ) { isConstExpr = false; } 493 virtual void visit( __attribute((unused)) VariableExpr *variableExpr ) { isConstExpr = false; } 495 494 // these might be okay? 496 495 // virtual void visit( SizeofExpr *sizeofExpr ); … … 503 502 // virtual void visit( LogicalExpr *logicalExpr ); 504 503 // virtual void visit( ConditionalExpr *conditionalExpr ); 505 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }506 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }507 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }508 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }509 virtual void visit( UntypedTupleExpr *tupleExpr ) { isConstExpr = false; }510 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }511 virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }504 virtual void visit( __attribute((unused)) TypeExpr *typeExpr ) { isConstExpr = false; } 505 virtual void visit( __attribute((unused)) AsmExpr *asmExpr ) { isConstExpr = false; } 506 virtual void visit( __attribute((unused)) UntypedValofExpr *valofExpr ) { isConstExpr = false; } 507 virtual void visit( __attribute((unused)) CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; } 508 virtual void visit( __attribute((unused)) UntypedTupleExpr *tupleExpr ) { isConstExpr = false; } 509 virtual void visit( __attribute((unused)) TupleExpr *tupleExpr ) { isConstExpr = false; } 510 virtual void visit( __attribute((unused)) TupleAssignExpr *tupleExpr ) { isConstExpr = false; } 512 511 513 512 bool isConstExpr; -
src/MakeLibCfa.cc
r9c951e3 rb1e63ac5 75 75 case CodeGen::OT_POSTFIXASSIGN: 76 76 case CodeGen::OT_INFIXASSIGN: 77 case CodeGen::OT_CTOR: 78 case CodeGen::OT_DTOR: 77 79 funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( std::list< Label >(), newExpr ) ); 78 80 break; 79 case CodeGen::OT_CTOR:80 // ctors don't return a value81 if ( funcDecl->get_functionType()->get_parameters().size() == 1 ) {82 // intrinsic default constructors should do nothing83 // delete newExpr;84 break;85 } else {86 assert( funcDecl->get_functionType()->get_parameters().size() == 2 );87 // anything else is a single parameter constructor that is effectively a C-style assignment88 // delete newExpr->get_function();89 assert(newExpr->get_args().size()==2);90 newExpr->set_function( new NameExpr( "?=?" ) );91 funcDecl->get_statements()->get_kids().push_back( new ExprStmt( std::list< Label >(), newExpr ) );92 }93 break;94 case CodeGen::OT_DTOR:95 // intrinsic destructors should do nothing96 // delete newExpr;97 break;98 81 case CodeGen::OT_CONSTANT: 99 82 case CodeGen::OT_LABELADDRESS: … … 109 92 assert( ! objDecl->get_init() ); 110 93 std::list< Expression* > noDesignators; 111 objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), noDesignators,false ) ); // cannot be constructed94 objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), false ) ); // cannot be constructed 112 95 newDecls.push_back( objDecl ); 113 96 } -
src/Makefile.am
r9c951e3 rb1e63ac5 43 43 driver_cfa_cpp_SOURCES = ${SRC} 44 44 driver_cfa_cpp_LDADD = ${LEXLIB} -ldl # yywrap 45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14 46 46 driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic 47 47 -
src/Makefile.in
r9c951e3 rb1e63ac5 119 119 ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \ 120 120 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \ 121 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \ 121 122 GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \ 122 123 GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \ … … 143 144 Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \ 144 145 Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \ 145 Parser/driver_cfa_cpp-parse utility.$(OBJEXT) \146 Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \ 146 147 ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \ 147 148 ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \ … … 161 162 ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) \ 162 163 ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT) \ 164 ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) \ 163 165 SymTab/driver_cfa_cpp-Indexer.$(OBJEXT) \ 164 166 SymTab/driver_cfa_cpp-Mangler.$(OBJEXT) \ … … 173 175 SynTree/driver_cfa_cpp-PointerType.$(OBJEXT) \ 174 176 SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT) \ 175 SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT) \176 177 SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT) \ 177 178 SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT) \ … … 395 396 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 396 397 ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \ 397 ControlStruct/ForExprMutator.cc GenPoly/Box.cc \ 398 ControlStruct/ForExprMutator.cc \ 399 ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \ 398 400 GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \ 399 401 GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \ … … 406 408 Parser/ExpressionNode.cc Parser/StatementNode.cc \ 407 409 Parser/InitializerNode.cc Parser/TypeData.cc \ 408 Parser/LinkageSpec.cc Parser/parse utility.cc \410 Parser/LinkageSpec.cc Parser/parserutility.cc \ 409 411 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 410 412 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 415 417 ResolvExpr/RenameVars.cc ResolvExpr/FindOpenVars.cc \ 416 418 ResolvExpr/PolyCost.cc ResolvExpr/Occurs.cc \ 417 ResolvExpr/TypeEnvironment.cc SymTab/Indexer.cc \418 SymTab/ Mangler.cc SymTab/Validate.cc SymTab/FixFunction.cc \419 SymTab/ ImplementationType.cc SymTab/TypeEquality.cc \420 SymTab/ Autogen.cc SynTree/Type.cc SynTree/VoidType.cc \421 SynTree/ BasicType.cc SynTree/PointerType.cc \422 SynTree/ ArrayType.cc SynTree/ReferenceType.cc \419 ResolvExpr/TypeEnvironment.cc ResolvExpr/CurrentObject.cc \ 420 SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \ 421 SymTab/FixFunction.cc SymTab/ImplementationType.cc \ 422 SymTab/TypeEquality.cc SymTab/Autogen.cc SynTree/Type.cc \ 423 SynTree/VoidType.cc SynTree/BasicType.cc \ 424 SynTree/PointerType.cc SynTree/ArrayType.cc \ 423 425 SynTree/FunctionType.cc SynTree/ReferenceToType.cc \ 424 426 SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \ … … 448 450 driver_cfa_cpp_SOURCES = ${SRC} 449 451 driver_cfa_cpp_LDADD = ${LEXLIB} -ldl # yywrap 450 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 452 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14 451 453 driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic 452 454 all: $(BUILT_SOURCES) … … 595 597 ControlStruct/$(am__dirstamp) \ 596 598 ControlStruct/$(DEPDIR)/$(am__dirstamp) 599 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT): \ 600 ControlStruct/$(am__dirstamp) \ 601 ControlStruct/$(DEPDIR)/$(am__dirstamp) 597 602 GenPoly/$(am__dirstamp): 598 603 @$(MKDIR_P) GenPoly … … 664 669 Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \ 665 670 Parser/$(DEPDIR)/$(am__dirstamp) 666 Parser/driver_cfa_cpp-parse utility.$(OBJEXT): Parser/$(am__dirstamp) \671 Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \ 667 672 Parser/$(DEPDIR)/$(am__dirstamp) 668 673 ResolvExpr/$(am__dirstamp): … … 722 727 ResolvExpr/$(am__dirstamp) \ 723 728 ResolvExpr/$(DEPDIR)/$(am__dirstamp) 729 ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT): \ 730 ResolvExpr/$(am__dirstamp) \ 731 ResolvExpr/$(DEPDIR)/$(am__dirstamp) 724 732 SymTab/$(am__dirstamp): 725 733 @$(MKDIR_P) SymTab … … 758 766 SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \ 759 767 SynTree/$(DEPDIR)/$(am__dirstamp) 760 SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT): \761 SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)762 768 SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT): \ 763 769 SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp) … … 856 862 -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT) 857 863 -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT) 864 -rm -f ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) 858 865 -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) 859 866 -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) … … 885 892 -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT) 886 893 -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT) 887 -rm -f Parser/driver_cfa_cpp-parse utility.$(OBJEXT)894 -rm -f Parser/driver_cfa_cpp-parserutility.$(OBJEXT) 888 895 -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT) 889 896 -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) … … 893 900 -rm -f ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT) 894 901 -rm -f ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT) 902 -rm -f ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) 895 903 -rm -f ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT) 896 904 -rm -f ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) … … 933 941 -rm -f SynTree/driver_cfa_cpp-PointerType.$(OBJEXT) 934 942 -rm -f SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT) 935 -rm -f SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT)936 943 -rm -f SynTree/driver_cfa_cpp-Statement.$(OBJEXT) 937 944 -rm -f SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT) … … 969 976 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@ 970 977 @AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@ 978 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@ 971 979 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@ 972 980 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@ … … 998 1006 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@ 999 1007 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@ 1000 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Po@am__quote@1008 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@ 1001 1009 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@ 1002 1010 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@ … … 1006 1014 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po@am__quote@ 1007 1015 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po@am__quote@ 1016 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po@am__quote@ 1008 1017 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po@am__quote@ 1009 1018 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po@am__quote@ … … 1046 1055 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po@am__quote@ 1047 1056 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Po@am__quote@ 1048 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po@am__quote@1049 1057 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po@am__quote@ 1050 1058 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po@am__quote@ … … 1360 1368 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi` 1361 1369 1370 ControlStruct/driver_cfa_cpp-ExceptTranslate.o: ControlStruct/ExceptTranslate.cc 1371 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc 1372 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po 1373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.o' libtool=no @AMDEPBACKSLASH@ 1374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1375 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc 1376 1377 ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc 1378 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi` 1379 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po 1380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@ 1381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1382 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi` 1383 1362 1384 GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc 1363 1385 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc … … 1696 1718 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi` 1697 1719 1698 Parser/driver_cfa_cpp-parse utility.o: Parser/parseutility.cc1699 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parse utility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc1700 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po1701 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parse utility.cc' object='Parser/driver_cfa_cpp-parseutility.o' libtool=no @AMDEPBACKSLASH@1702 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1703 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parse utility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc1704 1705 Parser/driver_cfa_cpp-parse utility.obj: Parser/parseutility.cc1706 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parse utility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`1707 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po1708 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parse utility.cc' object='Parser/driver_cfa_cpp-parseutility.obj' libtool=no @AMDEPBACKSLASH@1709 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1710 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parse utility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`1720 Parser/driver_cfa_cpp-parserutility.o: Parser/parserutility.cc 1721 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc 1722 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po 1723 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.o' libtool=no @AMDEPBACKSLASH@ 1724 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1725 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc 1726 1727 Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc 1728 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi` 1729 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po 1730 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@ 1731 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1732 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi` 1711 1733 1712 1734 ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc … … 1948 1970 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj `if test -f 'ResolvExpr/TypeEnvironment.cc'; then $(CYGPATH_W) 'ResolvExpr/TypeEnvironment.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/TypeEnvironment.cc'; fi` 1949 1971 1972 ResolvExpr/driver_cfa_cpp-CurrentObject.o: ResolvExpr/CurrentObject.cc 1973 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc 1974 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po 1975 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.o' libtool=no @AMDEPBACKSLASH@ 1976 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1977 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc 1978 1979 ResolvExpr/driver_cfa_cpp-CurrentObject.obj: ResolvExpr/CurrentObject.cc 1980 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi` 1981 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po 1982 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.obj' libtool=no @AMDEPBACKSLASH@ 1983 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1984 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi` 1985 1950 1986 SymTab/driver_cfa_cpp-Indexer.o: SymTab/Indexer.cc 1951 1987 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Indexer.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo -c -o SymTab/driver_cfa_cpp-Indexer.o `test -f 'SymTab/Indexer.cc' || echo '$(srcdir)/'`SymTab/Indexer.cc … … 2115 2151 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2116 2152 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ArrayType.obj `if test -f 'SynTree/ArrayType.cc'; then $(CYGPATH_W) 'SynTree/ArrayType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ArrayType.cc'; fi` 2117 2118 SynTree/driver_cfa_cpp-ReferenceType.o: SynTree/ReferenceType.cc2119 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc2120 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po2121 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.o' libtool=no @AMDEPBACKSLASH@2122 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2123 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc2124 2125 SynTree/driver_cfa_cpp-ReferenceType.obj: SynTree/ReferenceType.cc2126 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`2127 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po2128 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.obj' libtool=no @AMDEPBACKSLASH@2129 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2130 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`2131 2153 2132 2154 SynTree/driver_cfa_cpp-FunctionType.o: SynTree/FunctionType.cc -
src/Parser/DeclarationNode.cc
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:46:33201713 // Update Count : 101 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 2017 13 // Update Count : 1019 14 14 // 15 15 … … 57 57 variable.tyClass = NoTypeClass; 58 58 variable.assertions = nullptr; 59 variable.initializer = nullptr; 59 60 60 61 // attr.name = nullptr; … … 70 71 // delete variable.name; 71 72 delete variable.assertions; 73 delete variable.initializer; 72 74 73 75 delete type; … … 101 103 newnode->variable.tyClass = variable.tyClass; 102 104 newnode->variable.assertions = maybeClone( variable.assertions ); 105 newnode->variable.initializer = maybeClone( variable.initializer ); 103 106 104 107 // newnode->attr.name = attr.name ? new string( *attr.name ) : nullptr; … … 857 860 } 858 861 862 DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) { 863 assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." ); 864 variable.initializer = init; 865 return this; 866 } 867 859 868 DeclarationNode * DeclarationNode::cloneType( string * newName ) { 860 869 DeclarationNode * newnode = new DeclarationNode; … … 1014 1023 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." ); 1015 1024 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1016 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );1025 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.initializer ? variable.initializer->buildType() : nullptr ); 1017 1026 buildList( variable.assertions, ret->get_assertions() ); 1018 1027 return ret; … … 1054 1063 case TypeData::Enum: 1055 1064 case TypeData::Aggregate: { 1056 ReferenceToType * ret = buildComAggInst( type, attributes );1065 ReferenceToType * ret = buildComAggInst( type, attributes, linkage ); 1057 1066 buildList( type->aggregate.actuals, ret->get_parameters() ); 1058 1067 return ret; -
src/Parser/ExpressionNode.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 30 17:02:46201713 // Update Count : 5 1512 // Last Modified On : Wed Jun 28 21:08:15 2017 13 // Update Count : 542 14 14 // 15 15 … … 27 27 #include "SynTree/Declaration.h" 28 28 #include "Common/UnimplementedError.h" 29 #include "parse utility.h"29 #include "parserutility.h" 30 30 #include "Common/utility.h" 31 31 … … 62 62 bool dec = true, Unsigned = false; // decimal, unsigned constant 63 63 int size; // 0 => int, 1 => long, 2 => long long 64 unsigned long long v; // converted integral value64 unsigned long long int v; // converted integral value 65 65 size_t last = str.length() - 1; // last character of constant 66 66 … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str ) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 133 133 // floating-point constant has minimum of 2 characters: 1. or .1 134 134 size_t last = str.length() - 1; 135 double v; 136 137 sscanf( str.c_str(), "%lg", &v ); 135 138 136 139 if ( checkI( str[last] ) ) { // imaginary ? … … 150 153 } // if 151 154 152 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str ) );155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) ); 153 156 delete &str; // created by lex 154 157 return ret; … … 156 159 157 160 Expression *build_constantChar( const std::string & str ) { 158 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str ) );161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 159 162 delete &str; // created by lex 160 163 return ret; … … 164 167 // string should probably be a primitive type 165 168 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 166 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ), 167 toString( str.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"' 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 168 170 false, false ); 169 ConstantExpr * ret = new ConstantExpr( Constant( at, str ) ); 171 // constant 0 is ignored for pure string value 172 ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); 170 173 delete &str; // created by lex 171 174 return ret; … … 173 176 174 177 Expression *build_constantZeroOne( const std::string & str ) { 175 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str ) ); 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str, 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 176 180 delete &str; // created by lex 177 181 return ret; … … 184 188 std::stringstream ss( str ); 185 189 ss >> a >> dot >> b; 186 UntypedMemberExpr * ret = new UntypedMemberExpr( 187 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( b ) ) ), 188 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( a ) ) ) ); 190 UntypedMemberExpr * ret = new UntypedMemberExpr( new ConstantExpr( Constant::from_int( b ) ), new ConstantExpr( Constant::from_int( a ) ) ); 189 191 delete &str; 190 192 return ret; … … 207 209 } // build_field_name_fraction_constants 208 210 211 212 209 213 Expression * build_field_name_REALFRACTIONconstant( const std::string & str ) { 210 assert( str[0] == '.');214 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) throw SemanticError( "invalid tuple index " + str ); 211 215 Expression * ret = build_constantInteger( *new std::string( str.substr(1) ) ); 212 216 delete &str; … … 215 219 216 220 Expression * build_field_name_REALDECIMALconstant( const std::string & str ) { 217 assert( str[str.size()-1] == '.');221 if ( str[str.size()-1] != '.' ) throw SemanticError( "invalid tuple index " + str ); 218 222 Expression * ret = build_constantInteger( *new std::string( str.substr( 0, str.size()-1 ) ) ); 219 223 delete &str; … … 221 225 } // build_field_name_REALDECIMALconstant 222 226 223 NameExpr * build_varref( const string *name , bool labelp) {227 NameExpr * build_varref( const string *name ) { 224 228 NameExpr *expr = new NameExpr( *name, nullptr ); 225 229 delete name; … … 344 348 345 349 Expression *build_valexpr( StatementNode *s ) { 346 return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr);350 return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ) ); 347 351 } 348 352 Expression *build_typevalue( DeclarationNode *decl ) { -
src/Parser/InitializerNode.cc
r9c951e3 rb1e63ac5 74 74 75 75 InitializerNode *moreInit; 76 if ( get_next() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) != 0) )76 if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) { 77 77 moreInit->printOneLine( os ); 78 } 78 79 } 79 80 80 81 Initializer *InitializerNode::build() const { 81 82 if ( aggregate ) { 83 // steal designators from children 84 std::list< Designation * > designlist; 85 InitializerNode * child = next_init(); 86 for ( ; child != nullptr; child = dynamic_cast< InitializerNode * >( child->get_next() ) ) { 87 std::list< Expression * > desList; 88 buildList< Expression, ExpressionNode >( child->designator, desList ); 89 designlist.push_back( new Designation( desList ) ); 90 } // for 82 91 std::list< Initializer * > initlist; 83 92 buildList< Initializer, InitializerNode >( next_init(), initlist ); 84 85 std::list< Expression * > designlist;86 87 if ( designator != 0 ) {88 buildList< Expression, ExpressionNode >( designator, designlist );89 } // if90 91 93 return new ListInit( initlist, designlist, maybeConstructed ); 92 94 } else { 93 std::list< Expression * > designators; 94 95 if ( designator != 0 ) 96 buildList< Expression, ExpressionNode >( designator, designators ); 97 98 if ( get_expression() != 0) 99 return new SingleInit( maybeBuild< Expression >( get_expression() ), designators, maybeConstructed ); 95 if ( get_expression() != 0) { 96 return new SingleInit( maybeBuild< Expression >( get_expression() ), maybeConstructed ); 97 } 100 98 } // if 101 102 99 return 0; 103 100 } -
src/Parser/LinkageSpec.cc
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:22:09 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun Oct 2 23:16:21 201613 // Update Count : 2 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:51:00 2017 13 // Update Count : 24 14 14 // 15 15 … … 28 28 } else if ( *spec == "\"C\"" ) { 29 29 return C; 30 } else if ( *spec == "\"BuiltinC\"" ) { 31 return BuiltinC; 30 32 } else { 31 33 throw SemanticError( "Invalid linkage specifier " + *spec ); … … 36 38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs ); 37 39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = { 38 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", 40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in", 39 41 }; 40 42 return linkageKinds[linkage]; 41 43 } 42 44 43 bool LinkageSpec::is Decoratable( Spec spec ) {45 bool LinkageSpec::isMangled( Spec spec ) { 44 46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 45 47 static bool decoratable[LinkageSpec::NoOfSpecs] = { 46 // Intrinsic, Cforall, C, AutoGen, Compiler 48 // Intrinsic, Cforall, C, AutoGen, Compiler, 47 49 true, true, false, true, false, 50 // Builtin, BuiltinC, 51 true, false, 48 52 }; 49 53 return decoratable[spec]; … … 53 57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 54 58 static bool generatable[LinkageSpec::NoOfSpecs] = { 55 // Intrinsic, Cforall, C, AutoGen, Compiler 59 // Intrinsic, Cforall, C, AutoGen, Compiler, 56 60 true, true, true, true, false, 61 // Builtin, BuiltinC, 62 true, true, 57 63 }; 58 64 return generatable[spec]; … … 62 68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 63 69 static bool overridable[LinkageSpec::NoOfSpecs] = { 64 // Intrinsic, Cforall, C, AutoGen, Compiler 70 // Intrinsic, Cforall, C, AutoGen, Compiler, 65 71 true, false, false, true, false, 72 // Builtin, BuiltinC, 73 false, false, 66 74 }; 67 75 return overridable[spec]; … … 71 79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 72 80 static bool builtin[LinkageSpec::NoOfSpecs] = { 73 // Intrinsic, Cforall, C, AutoGen, Compiler 81 // Intrinsic, Cforall, C, AutoGen, Compiler, 74 82 true, false, false, false, true, 83 // Builtin, BuiltinC, 84 true, true, 75 85 }; 76 86 return builtin[spec]; -
src/Parser/LinkageSpec.h
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Oct 1 23:03:17 201613 // Update Count : 1 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:50:00 2017 13 // Update Count : 12 14 14 // 15 15 … … 26 26 AutoGen, // built by translator (struct assignment) 27 27 Compiler, // gcc internal 28 Builtin, // mangled builtins 29 BuiltinC, // non-mangled builtins 28 30 NoOfSpecs 29 31 }; … … 32 34 static std::string linkageName( Spec ); 33 35 34 static bool is Decoratable( Spec );36 static bool isMangled( Spec ); 35 37 static bool isGeneratable( Spec ); 36 38 static bool isOverridable( Spec ); -
src/Parser/ParseNode.h
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:42:18201713 // Update Count : 77 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:00:00 2017 13 // Update Count : 779 14 14 // 15 15 … … 61 61 } 62 62 63 virtual void print( std::ostream &os,int indent = 0 ) const {}64 virtual void printList( std::ostream &os,int indent = 0 ) const {}63 virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {} 64 virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {} 65 65 66 66 static int indent_by; … … 113 113 ExpressionNode * set_extension( bool exten ) { extension = exten; return this; } 114 114 115 virtual void print( std::ostream &os,int indent = 0 ) const override {}116 void printOneLine( std::ostream &os,int indent = 0 ) const {}115 virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {} 116 void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {} 117 117 118 118 template<typename T> … … 166 166 Expression * build_field_name_REALDECIMALconstant( const std::string & str ); 167 167 168 NameExpr * build_varref( const std::string * name , bool labelp = false);168 NameExpr * build_varref( const std::string * name ); 169 169 Expression * build_typevalue( DeclarationNode * decl ); 170 170 … … 274 274 DeclarationNode * addIdList( DeclarationNode * list ); // old-style functions 275 275 DeclarationNode * addInitializer( InitializerNode * init ); 276 DeclarationNode * addTypeInitializer( DeclarationNode * init ); 276 277 277 278 DeclarationNode * cloneType( std::string * newName ); … … 282 283 } 283 284 284 virtual void print( std::ostream &os,int indent = 0 ) const override;285 virtual void printList( std::ostream &os,int indent = 0 ) const override;285 virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override; 286 virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override; 286 287 287 288 Declaration * build() const; … … 301 302 DeclarationNode::TypeClass tyClass; 302 303 DeclarationNode * assertions; 304 DeclarationNode * initializer; 303 305 }; 304 306 Variable_t variable; … … 361 363 virtual StatementNode * append_last_case( StatementNode * ); 362 364 363 virtual void print( std::ostream &os,int indent = 0 ) const override {}364 virtual void printList( std::ostream &os,int indent = 0 ) const override {}365 virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {} 366 virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {} 365 367 private: 366 368 std::unique_ptr<Statement> stmt; … … 391 393 Statement * build_return( ExpressionNode * ctl ); 392 394 Statement * build_throw( ExpressionNode * ctl ); 395 Statement * build_resume( ExpressionNode * ctl ); 396 Statement * build_resume_at( ExpressionNode * ctl , ExpressionNode * target ); 393 397 Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ); 394 Statement * build_catch( DeclarationNode * decl, StatementNode * stmt, bool catchAny = false);398 Statement * build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ); 395 399 Statement * build_finally( StatementNode * stmt ); 396 400 Statement * build_compound( StatementNode * first ); … … 411 415 result->location = cur->location; 412 416 * out++ = result; 417 } else { 418 assertf(false, "buildList unknown type"); 413 419 } // if 414 420 } catch( SemanticError &e ) { -
src/Parser/StatementNode.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 2 22:16:40201713 // Update Count : 3 2712 // Last Modified On : Wed Jun 28 21:08:37 2017 13 // Update Count : 330 14 14 // 15 15 … … 21 21 #include "SynTree/Statement.h" 22 22 #include "SynTree/Expression.h" 23 #include "parse utility.h"23 #include "parserutility.h" 24 24 #include "Common/utility.h" 25 25 … … 152 152 return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr ); 153 153 } 154 154 155 Statement *build_throw( ExpressionNode *ctl ) { 155 156 std::list< Expression * > exps; 156 157 buildMoveList( ctl, exps ); 157 158 assertf( exps.size() < 2, "This means we are leaking memory"); 158 return new ReturnStmt( noLabels, !exps.empty() ? exps.back() : nullptr, true ); 159 return new ThrowStmt( noLabels, ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr ); 160 } 161 162 Statement *build_resume( ExpressionNode *ctl ) { 163 std::list< Expression * > exps; 164 buildMoveList( ctl, exps ); 165 assertf( exps.size() < 2, "This means we are leaking memory"); 166 return new ThrowStmt( noLabels, ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr ); 167 } 168 169 Statement *build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) { 170 (void)ctl; 171 (void)target; 172 assertf( false, "resume at (non-local throw) is not yet supported," ); 159 173 } 160 174 161 175 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) { 162 std::list< Statement * > branches;163 buildMoveList< Statement, StatementNode >( catch_stmt, branches );176 std::list< CatchStmt * > branches; 177 buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches ); 164 178 CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 165 179 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 166 180 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); 167 181 } 168 Statement *build_catch( DeclarationNode *decl, StatementNode *stmt, bool catchAny ) {169 std::list< Statement * > branches; 170 buildMoveList< Statement, StatementNode >( stmt, branches );171 assert( branches.size() == 1 ); 172 return new CatchStmt( noLabels, maybeMoveBuild< Declaration >(decl), branches.front(), catchAny);182 Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) { 183 std::list< Statement * > branches; 184 buildMoveList< Statement, StatementNode >( body, branches ); 185 assert( branches.size() == 1 ); 186 return new CatchStmt( noLabels, kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() ); 173 187 } 174 188 Statement *build_finally( StatementNode *stmt ) { -
src/Parser/TypeData.cc
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:52:43201713 // Update Count : 56 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 2017 13 // Update Count : 564 14 14 // 15 15 … … 630 630 } // buildReference 631 631 632 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {632 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 633 633 assert( td->kind == TypeData::Aggregate ); 634 634 AggregateDecl * at; … … 638 638 case DeclarationNode::Monitor: 639 639 case DeclarationNode::Thread: 640 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );640 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage ); 641 641 buildForall( td->aggregate.params, at->get_parameters() ); 642 642 break; … … 659 659 } // buildAggregate 660 660 661 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {661 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 662 662 switch ( type->kind ) { 663 663 case TypeData::Enum: { … … 672 672 ReferenceToType * ret; 673 673 if ( type->aggregate.body ) { 674 AggregateDecl * typedecl = buildAggregate( type, attributes );674 AggregateDecl * typedecl = buildAggregate( type, attributes, linkage ); 675 675 switch ( type->aggregate.kind ) { 676 676 case DeclarationNode::Struct: … … 776 776 if ( cur->has_enumeratorValue() ) { 777 777 ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members); 778 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ) , list< Expression * >()) );778 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ) ) ); 779 779 } // if 780 780 } // for … … 793 793 TupleType * buildTuple( const TypeData * td ) { 794 794 assert( td->kind == TypeData::Tuple ); 795 TupleType * ret = new TupleType( buildQualifiers( td ) ); 796 buildTypeList( td->tuple, ret->get_types() ); 795 std::list< Type * > types; 796 buildTypeList( td->tuple, types ); 797 TupleType * ret = new TupleType( buildQualifiers( td ), types ); 797 798 buildForall( td->forall, ret->get_forall() ); 798 799 return ret; … … 818 819 return decl->set_asmName( asmName ); 819 820 } else if ( td->kind == TypeData::Aggregate ) { 820 return buildAggregate( td, attributes );821 return buildAggregate( td, attributes, linkage ); 821 822 } else if ( td->kind == TypeData::Enum ) { 822 823 return buildEnum( td, attributes ); -
src/Parser/TypeData.h
r9c951e3 rb1e63ac5 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 08:32:39201713 // Update Count : 18 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 2017 13 // Update Count : 186 14 14 // 15 15 … … 103 103 ReferenceType * buildReference( const TypeData * ); 104 104 AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > ); 105 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );105 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ); 106 106 ReferenceToType * buildAggInst( const TypeData * ); 107 107 TypeDecl * buildVariable( const TypeData * ); -
src/Parser/TypedefTable.h
r9c951e3 rb1e63ac5 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 15 18:25:04 201613 // Update Count : 2812 // Last Modified On : Wed Jun 28 21:56:34 2017 13 // Update Count : 33 14 14 // 15 15 … … 22 22 #include <stack> 23 23 24 #include " lex.h"24 #include "parser.hh" 25 25 #include "parser.h" 26 26 -
src/Parser/lex.ll
r9c951e3 rb1e63ac5 5 5 * file "LICENCE" distributed with Cforall. 6 6 * 7 * lex.l --7 * lex.ll -- 8 8 * 9 9 * Author : Peter A. Buhr 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Mon Mar 13 08:36:17201713 * Update Count : 5 0612 * Last Modified On : Wed Jun 28 21:03:45 2017 13 * Update Count : 529 14 14 */ 15 15 … … 27 27 #include <cstdio> // FILENAME_MAX 28 28 29 #include "lex.h"30 #include "parser.h" // YACC generated definitions based on C++ grammar31 29 #include "ParseNode.h" 32 30 #include "TypedefTable.h" … … 77 75 // numeric constants, CFA: '_' in constant 78 76 hex_quad {hex}("_"?{hex}){3} 79 integer_suffix "_"?(([uU] [lL]?)|([uU]("ll"|"LL")?)|([lL][uU]?)|("ll"|"LL")[uU]?)77 integer_suffix "_"?(([uU](("ll"|"LL"|[lL])[iI]|[iI]?("ll"|"LL"|[lL])?))|([iI](("ll"|"LL"|[lL])[uU]|[uU]?("ll"|"LL"|[lL])?))|(("ll"|"LL"|[lL])([iI][uU]|[uU]?[iI]?))) 80 78 81 79 octal_digits ({octal})|({octal}({octal}|"_")*{octal}) … … 91 89 92 90 decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal}) 93 real_decimal {decimal_digits}"." 94 real_fraction "."{decimal_digits} 95 real_constant {decimal_digits} ?{real_fraction}91 real_decimal {decimal_digits}"."{exponent}?{floating_suffix}? 92 real_fraction "."{decimal_digits}{exponent}?{floating_suffix}? 93 real_constant {decimal_digits}{real_fraction} 96 94 exponent "_"?[eE]"_"?[+-]?{decimal_digits} 97 // GCC: D (double), DL (long double) and iI (imaginary) suffixes 98 floating_suffix "_"?([fFdDlL][iI]?|"DL"|[iI][lLfFdD]?) 99 //floating_suffix "_"?([fFdD]|[lL]|[D][L])|([iI][lLfFdD])|([lLfFdD][iI])) 95 // GCC: D (double) and iI (imaginary) suffixes, and DL (long double) 96 floating_suffix "_"?([fFdDlL][iI]?|[iI][lLfFdD]?|"DL") 100 97 floating_constant (({real_constant}{exponent}?)|({decimal_digits}{exponent})){floating_suffix}? 101 98 … … 236 233 long { KEYWORD_RETURN(LONG); } 237 234 lvalue { KEYWORD_RETURN(LVALUE); } // CFA 238 monitor { KEYWORD_RETURN(MONITOR); } // CFA235 monitor { KEYWORD_RETURN(MONITOR); } // CFA 239 236 mutex { KEYWORD_RETURN(MUTEX); } // CFA 240 237 _Noreturn { KEYWORD_RETURN(NORETURN); } // C11 … … 378 375 "?"{op_binary_over}"?" { IDENTIFIER_RETURN(); } // binary 379 376 /* 380 This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?" 381 can be lexed as "*"/"?*?" or "*?"/"*?". Since it is common practise to put a unary operator juxtaposed382 to an identifier, e.g., "*i", users will be annoyed if they cannot do this with respect to operator383 identifiers. Even with this special hack, there are 5 general cases that cannot be handled. The first384 case is for the function-call identifier "?()":385 386 int * ?()(); // declaration: space required after '*' 387 * ?()(); // expression: space required after '*'388 389 Without the space, the string "*?()" is ambiguous without N character look ahead; it requires scanning390 ahead to determine if there is a '(', which is the start of an argument/parameter list.391 392 The 4 remaining cases occur in expressions: 393 394 i++?i:0; // space required before '?' 395 i --?i:0; // space required before '?'396 i?++ i:0; // space required after '?'397 i?--i:0; // space required after '?' 398 399 In the first two cases, the string "i++?" is ambiguous, where this string can be lexed as "i"/"++?" or 400 "i++"/"?"; it requires scanning ahead to determine if there is a '(', which is the start of an argument 401 list. In the second two cases, the string "?++x" is ambiguous, where this string can be lexed as 402 "?++"/"x" or "?"/"++x"; it requires scanning ahead to determine if there is a '(', which is the start of403 an argument list.377 This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?" can be 378 lexed as "*?"/"*?" or "*"/"?*?". Since it is common practise to put a unary operator juxtaposed to an identifier, 379 e.g., "*i", users will be annoyed if they cannot do this with respect to operator identifiers. Therefore, there is 380 a lexical look-ahead for the second case, with backtracking to return the leading unary operator and then 381 reparsing the trailing operator identifier. Otherwise a space is needed between the unary operator and operator 382 identifier to disambiguate this common case. 383 384 A similar issue occurs with the dereference, *?(...), and routine-call, ?()(...) identifiers. The ambiguity 385 occurs when the deference operator has no parameters, *?() and *?()(...), requiring arbitrary whitespace 386 look-ahead for the routine-call parameter-list to disambiguate. However, the dereference operator must have a 387 parameter/argument to dereference *?(...). Hence, always interpreting the string *?() as * ?() does not preclude 388 any meaningful program. 389 390 The remaining cases are with the increment/decrement operators and conditional expression: 391 392 i++? ...(...); 393 i?++ ...(...); 394 395 requiring arbitrary whitespace look-ahead for the operator parameter-list, even though that interpretation is an 396 incorrect expression (juxtaposed identifiers). Therefore, it is necessary to disambiguate these cases with a 397 space: 398 399 i++ ? i : 0; 400 i? ++i : 0; 404 401 */ 405 {op_unary}"?"({op_unary_pre_post}|" [?]"|{op_binary_over}"?") {402 {op_unary}"?"({op_unary_pre_post}|"()"|"[?]"|{op_binary_over}"?") { 406 403 // 1 or 2 character unary operator ? 407 404 int i = yytext[1] == '?' ? 1 : 2; -
src/Parser/module.mk
r9c951e3 rb1e63ac5 11 11 ## Created On : Sat May 16 15:29:09 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Tue Aug 16 17:28:34 201614 ## Update Count : 10 113 ## Last Modified On : Wed Jun 28 21:58:29 2017 14 ## Update Count : 104 15 15 ############################################################################### 16 16 … … 29 29 Parser/TypeData.cc \ 30 30 Parser/LinkageSpec.cc \ 31 Parser/parse utility.cc31 Parser/parserutility.cc 32 32 33 33 MAINTAINERCLEANFILES += Parser/parser.output -
src/Parser/parser.hh
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // lex.h --7 // parser.hh -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 21 11:28:47 201613 // Update Count : 34 712 // Last Modified On : Wed Jun 28 22:10:17 2017 13 // Update Count : 349 14 14 // 15 15 16 #ifndef PARSER_ LEX_H17 #define PARSER_ LEX_H16 #ifndef PARSER_HH 17 #define PARSER_HH 18 18 19 19 int yylex(); … … 42 42 }; // Token 43 43 44 #endif // PARSER_ LEX_H44 #endif // PARSER_HH 45 45 46 46 // Local Variables: // -
src/Parser/parser.yy
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // cfa.y --7 // parser.yy -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 30 15:42:32 201713 // Update Count : 2 31812 // Last Modified On : Wed Jun 28 22:11:22 2017 13 // Update Count : 2414 14 14 // 15 15 … … 48 48 #include <cstdio> 49 49 #include <stack> 50 #include "lex.h"51 #include "parser.h"52 50 #include "ParseNode.h" 53 51 #include "TypedefTable.h" … … 85 83 } // for 86 84 } // distExt 85 86 bool forall = false; // aggregate have one or more forall qualifiers ? 87 87 %} 88 89 // Types declaration 90 %union 91 { 92 Token tok; 93 ParseNode * pn; 94 ExpressionNode * en; 95 DeclarationNode * decl; 96 DeclarationNode::Aggregate aggKey; 97 DeclarationNode::TypeClass tclass; 98 StatementNode * sn; 99 ConstantExpr * constant; 100 ForCtl * fctl; 101 LabelNode * label; 102 InitializerNode * in; 103 OperKinds op; 104 std::string * str; 105 bool flag; 106 } 88 107 89 108 //************************* TERMINAL TOKENS ******************************** … … 138 157 %token ATassign // @= 139 158 140 // Types declaration 141 %union 142 { 143 Token tok; 144 ParseNode * pn; 145 ExpressionNode * en; 146 DeclarationNode * decl; 147 DeclarationNode::Aggregate aggKey; 148 DeclarationNode::TypeClass tclass; 149 StatementNode * sn; 150 ConstantExpr * constant; 151 ForCtl * fctl; 152 LabelNode * label; 153 InitializerNode * in; 154 OperKinds op; 155 std::string * str; 156 bool flag; 157 } 158 159 %type<tok> identifier no_01_identifier no_attr_identifier zero_one 160 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name attr_name 159 %type<tok> identifier no_attr_identifier zero_one 160 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name attr_name 161 161 %type<constant> string_literal 162 162 %type<str> string_literal_list … … 191 191 %type<sn> case_value_list case_label case_label_list 192 192 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 193 %type<sn> handler_listhandler_clause finally_clause193 %type<sn> /* handler_list */ handler_clause finally_clause 194 194 195 195 // declarations … … 205 205 %type<en> bit_subrange_size_opt bit_subrange_size 206 206 207 %type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type _name indirect_type_name207 %type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type indirect_type 208 208 209 209 %type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier … … 259 259 %type<decl> type_declarator type_declarator_name type_declaring_list 260 260 261 %type<decl> typedef typedef_type_specifier typedef_declaration typedef_declaration_specifier typedef_expression 261 %type<decl> type_declaration_specifier type_type_specifier type_name typegen_name 262 %type<decl> typedef typedef_declaration typedef_expression 262 263 263 264 %type<decl> variable_type_redeclarator type_ptr type_array type_function 264 265 265 266 %type<decl> type_parameter_redeclarator type_parameter_ptr type_parameter_array type_parameter_function 266 %type<decl> typegen_declaration_specifier typegen_type_specifier typegen_name 267 268 %type<decl> type_name type_name_no_function 269 %type<decl> type_parameter type_parameter_list 270 271 %type<en> type_name_list 267 268 %type<decl> type type_no_function 269 %type<decl> type_parameter type_parameter_list type_initializer_opt 270 271 %type<en> type_list 272 272 273 273 %type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list … … 349 349 IDENTIFIER 350 350 | ATTR_IDENTIFIER // CFA 351 | zero_one // CFA352 ;353 354 no_01_identifier:355 IDENTIFIER356 | ATTR_IDENTIFIER // CFA357 351 ; 358 352 359 353 no_attr_identifier: 360 354 IDENTIFIER 361 | zero_one // CFA362 355 ; 363 356 … … 365 358 ZERO 366 359 | ONE 367 ;360 ; 368 361 369 362 string_literal: … … 393 386 | '(' compound_statement ')' // GCC, lambda expression 394 387 { $$ = new ExpressionNode( build_valexpr( $2 ) ); } 395 | primary_expression '{' argument_expression_list '}' // CFA 388 | primary_expression '{' argument_expression_list '}' // CFA, constructor call 396 389 { 397 390 Token fn; … … 399 392 $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) ); 400 393 } 394 | type_name '.' no_attr_identifier // CFA, nested type 395 { $$ = nullptr; } // FIX ME 396 | type_name '.' '[' push field_list pop ']' // CFA, nested type / tuple field selector 397 { $$ = nullptr; } // FIX ME 401 398 ; 402 399 … … 429 426 | postfix_expression DECR 430 427 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, $1 ) ); } 431 | '(' type_n ame_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal428 | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal 432 429 { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); } 433 430 | '^' primary_expression '{' argument_expression_list '}' // CFA … … 481 478 | no_attr_identifier fraction_constants 482 479 { 483 if( (*$1) == "0" || (*$1) == "1" ) {484 $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantZeroOne( *$1 ), $2 ) );485 } else {486 $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) );487 }480 $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); 481 } 482 | zero_one fraction_constants 483 { 484 $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantZeroOne( *$1 ), $2 ) ); 488 485 } 489 486 ; … … 533 530 | SIZEOF unary_expression 534 531 { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); } 535 | SIZEOF '(' type_n ame_no_function ')'532 | SIZEOF '(' type_no_function ')' 536 533 { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); } 537 534 | ALIGNOF unary_expression // GCC, variable alignment 538 535 { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); } 539 | ALIGNOF '(' type_n ame_no_function ')' // GCC, type alignment536 | ALIGNOF '(' type_no_function ')' // GCC, type alignment 540 537 { $$ = new ExpressionNode( build_alignOftype( $3 ) ); } 541 | OFFSETOF '(' type_n ame_no_function ',' no_attr_identifier ')'538 | OFFSETOF '(' type_no_function ',' no_attr_identifier ')' 542 539 { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); } 543 540 | ATTR_IDENTIFIER … … 545 542 | ATTR_IDENTIFIER '(' argument_expression ')' 546 543 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); } 547 | ATTR_IDENTIFIER '(' type _name')'544 | ATTR_IDENTIFIER '(' type ')' 548 545 { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); } 549 546 // | ANDAND IDENTIFIER // GCC, address of label 550 // { $$ = new ExpressionNode( new OperatorNode( OperKinds::LabelAddress ), new ExpressionNode( build_varref( $2 , true) ); }547 // { $$ = new ExpressionNode( new OperatorNode( OperKinds::LabelAddress ), new ExpressionNode( build_varref( $2 ) ); } 551 548 ; 552 549 … … 567 564 cast_expression: 568 565 unary_expression 569 | '(' type_n ame_no_function ')' cast_expression566 | '(' type_no_function ')' cast_expression 570 567 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 571 // | '(' type_n ame_no_function ')' tuple568 // | '(' type_no_function ')' tuple 572 569 // { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 573 570 ; … … 656 653 | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand 657 654 { $$ = new ExpressionNode( build_cond( $1, $1, $4 ) ); } 658 // | logical_OR_expression '?' comma_expression ':' tuple // CFA, tuple expression659 // { $$ = new ExpressionNode( build_cond( $1, $3, $5 ) ); }660 655 ; 661 656 … … 669 664 | unary_expression assignment_operator assignment_expression 670 665 { $$ = new ExpressionNode( build_binary_ptr( $2, $1, $3 ) ); } 671 // | tuple assignment_opt // CFA, tuple expression672 // { $$ = ( $2 == 0 ) ? $1 : new ExpressionNode( build_binary_ptr( OperKinds::Assign, $1, $2 ) ); }673 666 ; 674 667 … … 936 929 { $$ = new StatementNode( build_throw( $2 ) ); } 937 930 | THROWRESUME assignment_expression_opt ';' // handles reresume 938 { $$ = new StatementNode( build_ throw( $2 ) ); }931 { $$ = new StatementNode( build_resume( $2 ) ); } 939 932 | THROWRESUME assignment_expression_opt AT assignment_expression ';' // handles reresume 940 { $$ = new StatementNode( build_ throw( $2) ); }933 { $$ = new StatementNode( build_resume_at( $2, $4 ) ); } 941 934 ; 942 935 943 936 exception_statement: 944 TRY compound_statement handler_ list937 TRY compound_statement handler_clause 945 938 { $$ = new StatementNode( build_try( $2, $3, 0 ) ); } 946 939 | TRY compound_statement finally_clause 947 940 { $$ = new StatementNode( build_try( $2, 0, $3 ) ); } 948 | TRY compound_statement handler_ listfinally_clause941 | TRY compound_statement handler_clause finally_clause 949 942 { $$ = new StatementNode( build_try( $2, $3, $4 ) ); } 950 943 ; 951 944 952 handler_list:953 handler_clause954 // ISO/IEC 9899:1999 Section 15.3(6 ) If present, a "..." handler shall be the last handler for its try block.955 | CATCH '(' ELLIPSIS ')' compound_statement956 { $$ = new StatementNode( build_catch( 0, $5, true ) ); }957 | handler_clause CATCH '(' ELLIPSIS ')' compound_statement958 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }959 | CATCHRESUME '(' ELLIPSIS ')' compound_statement960 { $$ = new StatementNode( build_catch( 0, $5, true ) ); }961 | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement962 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }963 ;945 //handler_list: 946 // handler_clause 947 // // ISO/IEC 9899:1999 Section 15.3(6 ) If present, a "..." handler shall be the last handler for its try block. 948 // | CATCH '(' ELLIPSIS ')' compound_statement 949 // { $$ = new StatementNode( build_catch( 0, $5, true ) ); } 950 // | handler_clause CATCH '(' ELLIPSIS ')' compound_statement 951 // { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); } 952 // | CATCHRESUME '(' ELLIPSIS ')' compound_statement 953 // { $$ = new StatementNode( build_catch( 0, $5, true ) ); } 954 // | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement 955 // { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); } 956 // ; 964 957 965 958 handler_clause: 966 CATCH '(' push push exception_declaration pop ')' compound_statement pop 967 { $$ = new StatementNode( build_catch( $5, $8 ) ); } 959 // TEMPORARY, TEST EXCEPTIONS 960 CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 961 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); } 962 | handler_clause CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 963 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 964 965 | CATCH '(' push push exception_declaration pop ')' compound_statement pop 966 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); } 968 967 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop 969 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); }968 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, $6, nullptr, $9 ) ) ); } 970 969 | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 971 { $$ = new StatementNode( build_catch( $5, $8 ) ); }970 { $$ = new StatementNode( build_catch( CatchStmt::Resume, $5, nullptr, $8 ) ); } 972 971 | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 973 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); }972 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Resume, $6, nullptr, $9 ) ) ); } 974 973 ; 975 974 … … 1350 1349 basic_declaration_specifier 1351 1350 | sue_declaration_specifier 1352 | typedef_declaration_specifier 1353 | typegen_declaration_specifier 1351 | type_declaration_specifier 1354 1352 ; 1355 1353 … … 1362 1360 basic_declaration_specifier 1363 1361 | sue_declaration_specifier_nobody 1364 | typedef_declaration_specifier 1365 | typegen_declaration_specifier 1362 | type_declaration_specifier 1366 1363 ; 1367 1364 … … 1369 1366 basic_type_specifier 1370 1367 | sue_type_specifier 1371 | typedef_type_specifier 1372 | typegen_type_specifier 1368 | type_type_specifier 1373 1369 ; 1374 1370 … … 1381 1377 basic_type_specifier 1382 1378 | sue_type_specifier_nobody 1383 | typedef_type_specifier 1384 | typegen_type_specifier 1379 | type_type_specifier 1385 1380 ; 1386 1381 … … 1517 1512 1518 1513 basic_type_specifier: 1519 direct_type _name1520 | type_qualifier_list_opt indirect_type _nametype_qualifier_list_opt1514 direct_type 1515 | type_qualifier_list_opt indirect_type type_qualifier_list_opt 1521 1516 { $$ = $2->addQualifiers( $1 )->addQualifiers( $3 ); } 1522 1517 ; 1523 1518 1524 direct_type _name:1519 direct_type: 1525 1520 // A semantic check is necessary for conflicting type qualifiers. 1526 1521 basic_type_name 1527 1522 | type_qualifier_list basic_type_name 1528 1523 { $$ = $2->addQualifiers( $1 ); } 1529 | direct_type _nametype_qualifier1524 | direct_type type_qualifier 1530 1525 { $$ = $1->addQualifiers( $2 ); } 1531 | direct_type _namebasic_type_name1526 | direct_type basic_type_name 1532 1527 { $$ = $1->addType( $2 ); } 1533 1528 ; 1534 1529 1535 indirect_type _name:1536 TYPEOF '(' type _name ')'// GCC: typeof(x) y;1530 indirect_type: 1531 TYPEOF '(' type ')' // GCC: typeof(x) y; 1537 1532 { $$ = $3; } 1538 1533 | TYPEOF '(' comma_expression ')' // GCC: typeof(a+b) y; 1539 1534 { $$ = DeclarationNode::newTypeof( $3 ); } 1540 | ATTR_TYPEGENname '(' type _name ')'// CFA: e.g., @type(x) y;1535 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type(x) y; 1541 1536 { $$ = DeclarationNode::newAttr( $1, $3 ); } 1542 1537 | ATTR_TYPEGENname '(' comma_expression ')' // CFA: e.g., @type(a+b) y; … … 1556 1551 sue_type_specifier: // struct, union, enum + type specifier 1557 1552 elaborated_type 1558 | type_qualifier_list elaborated_type 1559 { $$ = $2->addQualifiers( $1 ); } 1553 | type_qualifier_list 1554 { if ( $1->type != nullptr && $1->type->forall ) forall = true; } // remember generic type 1555 elaborated_type 1556 { $$ = $3->addQualifiers( $1 ); } 1560 1557 | sue_type_specifier type_qualifier 1561 1558 { $$ = $1->addQualifiers( $2 ); } … … 1580 1577 ; 1581 1578 1582 type def_declaration_specifier:1583 type def_type_specifier1584 | declaration_qualifier_list type def_type_specifier1579 type_declaration_specifier: 1580 type_type_specifier 1581 | declaration_qualifier_list type_type_specifier 1585 1582 { $$ = $2->addQualifiers( $1 ); } 1586 | type def_declaration_specifier storage_class// remaining OBSOLESCENT (see 2)1583 | type_declaration_specifier storage_class // remaining OBSOLESCENT (see 2) 1587 1584 { $$ = $1->addQualifiers( $2 ); } 1588 | type def_declaration_specifier storage_class type_qualifier_list1585 | type_declaration_specifier storage_class type_qualifier_list 1589 1586 { $$ = $1->addQualifiers( $2 )->addQualifiers( $3 ); } 1590 1587 ; 1591 1588 1592 typedef_type_specifier: // typedef types 1589 type_type_specifier: // typedef types 1590 type_name 1591 | type_qualifier_list type_name 1592 { $$ = $2->addQualifiers( $1 ); } 1593 | type_type_specifier type_qualifier 1594 { $$ = $1->addQualifiers( $2 ); } 1595 ; 1596 1597 type_name: 1593 1598 TYPEDEFname 1594 1599 { $$ = DeclarationNode::newFromTypedef( $1 ); } 1595 | type_qualifier_list TYPEDEFname 1596 { $$ = DeclarationNode::newFromTypedef( $2 )->addQualifiers( $1 ); } 1597 | typedef_type_specifier type_qualifier 1598 { $$ = $1->addQualifiers( $2 ); } 1600 | '.' TYPEDEFname 1601 { $$ = DeclarationNode::newFromTypedef( $2 ); } // FIX ME 1602 | type_name '.' TYPEDEFname 1603 { $$ = DeclarationNode::newFromTypedef( $3 ); } // FIX ME 1604 | typegen_name 1605 | '.' typegen_name 1606 { $$ = $2; } // FIX ME 1607 | type_name '.' typegen_name 1608 { $$ = $3; } // FIX ME 1609 ; 1610 1611 typegen_name: // CFA 1612 TYPEGENname '(' ')' 1613 { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); } 1614 | TYPEGENname '(' type_list ')' 1615 { $$ = DeclarationNode::newFromTypeGen( $1, $3 ); } 1599 1616 ; 1600 1617 … … 1613 1630 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); } 1614 1631 | aggregate_key attribute_list_opt no_attr_identifier_or_type_name 1615 { typedefTable.makeTypedef( *$3 ); } 1632 { 1633 typedefTable.makeTypedef( *$3 ); // create typedef 1634 if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update 1635 forall = false; // reset 1636 } 1616 1637 '{' field_declaration_list '}' 1617 1638 { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); } 1618 | aggregate_key attribute_list_opt '(' type_ name_list ')' '{' field_declaration_list '}' // CFA1639 | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list '}' // CFA 1619 1640 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); } 1620 1641 | aggregate_type_nobody … … 1622 1643 1623 1644 aggregate_type_nobody: // struct, union - {...} 1624 aggregate_key attribute_list_opt no_attr_identifier _or_type_name1645 aggregate_key attribute_list_opt no_attr_identifier 1625 1646 { 1626 1647 typedefTable.makeTypedef( *$3 ); 1627 1648 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 1628 1649 } 1629 | aggregate_key attribute_list_opt typegen_name // CFA, S/R conflict 1650 | aggregate_key attribute_list_opt TYPEDEFname 1651 { 1652 typedefTable.makeTypedef( *$3 ); 1653 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 1654 } 1655 | aggregate_key attribute_list_opt typegen_name // CFA 1630 1656 { $$ = $3->addQualifiers( $2 ); } 1631 1657 ; … … 1865 1891 ; 1866 1892 1867 no_01_identifier_or_type_name:1868 no_01_identifier1869 | TYPEDEFname1870 | TYPEGENname1871 ;1872 1873 1893 no_attr_identifier_or_type_name: 1874 1894 no_attr_identifier … … 1877 1897 ; 1878 1898 1879 type_n ame_no_function:// sizeof, alignof, cast (constructor)1899 type_no_function: // sizeof, alignof, cast (constructor) 1880 1900 cfa_abstract_declarator_tuple // CFA 1881 1901 | type_specifier … … 1884 1904 ; 1885 1905 1886 type _name:// typeof, assertion1887 type_n ame_no_function1906 type: // typeof, assertion 1907 type_no_function 1888 1908 | cfa_abstract_function // CFA 1889 1909 ; … … 1925 1945 designation: 1926 1946 designator_list ':' // C99, CFA uses ":" instead of "=" 1927 | no_attr_identifier _or_type_name ':'// GCC, field name1947 | no_attr_identifier ':' // GCC, field name 1928 1948 { $$ = new ExpressionNode( build_varref( $1 ) ); } 1929 1949 ; … … 1937 1957 1938 1958 designator: 1939 '.' no_attr_identifier _or_type_name// C99, field name1959 '.' no_attr_identifier // C99, field name 1940 1960 { $$ = new ExpressionNode( build_varref( $2 ) ); } 1941 1961 | '[' push assignment_expression pop ']' // C99, single array element … … 1968 1988 // on type arguments of polymorphic functions. 1969 1989 1970 typegen_declaration_specifier: // CFA1971 typegen_type_specifier1972 | declaration_qualifier_list typegen_type_specifier1973 { $$ = $2->addQualifiers( $1 ); }1974 | typegen_declaration_specifier storage_class // remaining OBSOLESCENT (see 2)1975 { $$ = $1->addQualifiers( $2 ); }1976 | typegen_declaration_specifier storage_class type_qualifier_list1977 { $$ = $1->addQualifiers( $2 )->addQualifiers( $3 ); }1978 ;1979 1980 typegen_type_specifier: // CFA1981 typegen_name1982 | type_qualifier_list typegen_name1983 { $$ = $2->addQualifiers( $1 ); }1984 | typegen_type_specifier type_qualifier1985 { $$ = $1->addQualifiers( $2 ); }1986 ;1987 1988 typegen_name: // CFA1989 TYPEGENname '(' type_name_list ')'1990 { $$ = DeclarationNode::newFromTypeGen( $1, $3 ); }1991 ;1992 1993 1990 type_parameter_list: // CFA 1994 type_parameter assignment_opt 1995 | type_parameter_list ',' type_parameter assignment_opt 1991 type_parameter 1992 { $$ = $1; } 1993 | type_parameter_list ',' type_parameter 1996 1994 { $$ = $1->appendList( $3 ); } 1995 ; 1996 1997 type_initializer_opt: // CFA 1998 // empty 1999 { $$ = nullptr; } 2000 | '=' type 2001 { $$ = $2; } 1997 2002 ; 1998 2003 … … 2000 2005 type_class no_attr_identifier_or_type_name 2001 2006 { typedefTable.addToEnclosingScope( *$2, TypedefTable::TD ); } 2002 assertion_list_opt2003 { $$ = DeclarationNode::newTypeParam( $1, $2 )->add Assertions( $4); }2007 type_initializer_opt assertion_list_opt 2008 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2004 2009 | type_specifier identifier_parameter_declarator 2005 2010 ; … … 2024 2029 2025 2030 assertion: // CFA 2026 '|' no_attr_identifier_or_type_name '(' type_ name_list ')'2031 '|' no_attr_identifier_or_type_name '(' type_list ')' 2027 2032 { 2028 2033 typedefTable.openTrait( *$2 ); … … 2031 2036 | '|' '{' push trait_declaration_list '}' 2032 2037 { $$ = $4; } 2033 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_ name_list ')'2038 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_list ')' 2034 2039 { $$ = nullptr; } 2035 2040 ; 2036 2041 2037 type_ name_list:// CFA2038 type _name2042 type_list: // CFA 2043 type 2039 2044 { $$ = new ExpressionNode( build_typevalue( $1 ) ); } 2040 2045 | assignment_expression 2041 | type_ name_list ',' type_name2046 | type_list ',' type 2042 2047 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( build_typevalue( $3 ) ) ) ); } 2043 | type_ name_list ',' assignment_expression2048 | type_list ',' assignment_expression 2044 2049 { $$ = (ExpressionNode *)( $1->set_last( $3 )); } 2045 2050 ; … … 2057 2062 type_declarator_name assertion_list_opt 2058 2063 { $$ = $1->addAssertions( $2 ); } 2059 | type_declarator_name assertion_list_opt '=' type _name2064 | type_declarator_name assertion_list_opt '=' type 2060 2065 { $$ = $1->addAssertions( $2 )->addType( $4 ); } 2061 2066 ; … … 2067 2072 $$ = DeclarationNode::newTypeDecl( $1, 0 ); 2068 2073 } 2069 | no_ 01_identifier_or_type_name '(' push type_parameter_list pop ')'2074 | no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' 2070 2075 { 2071 2076 typedefTable.addToEnclosingScope( *$1, TypedefTable::TG ); … … 2093 2098 ; 2094 2099 2095 trait_declaration_list: // CFA2100 trait_declaration_list: // CFA 2096 2101 trait_declaration 2097 2102 | trait_declaration_list push trait_declaration … … 2099 2104 ; 2100 2105 2101 trait_declaration: // CFA2106 trait_declaration: // CFA 2102 2107 cfa_trait_declaring_list pop ';' 2103 2108 | trait_declaring_list pop ';' -
src/Parser/parserutility.cc
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.cc --7 // parserutility.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:30:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 14 23:45:03 201613 // Update Count : 312 // Last Modified On : Wed Jun 28 22:11:32 2017 13 // Update Count : 7 14 14 // 15 15 16 #include "parse utility.h"16 #include "parserutility.h" 17 17 #include "SynTree/Type.h" 18 18 #include "SynTree/Expression.h" … … 26 26 UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); 27 27 comparison->get_args().push_back( orig ); 28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" ) ) );28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0", (unsigned long long int)0 ) ) ); 29 29 return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 30 30 } -
src/Parser/parserutility.h
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.h --7 // parserutility.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 15:32:58 201513 // Update Count : 212 // Last Modified On : Wed Jun 28 22:11:40 2017 13 // Update Count : 3 14 14 // 15 15 -
src/ResolvExpr/AlternativeFinder.cc
r9c951e3 rb1e63ac5 97 97 /// Prunes a list of alternatives down to those that have the minimum conversion cost for a given return type; skips ambiguous interpretations 98 98 template< typename InputIterator, typename OutputIterator > 99 void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out , const SymTab::Indexer &indexer) {99 void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out ) { 100 100 // select the alternatives that have the minimum conversion cost for a particular set of result types 101 101 std::map< std::string, PruneStruct > selected; … … 183 183 ) 184 184 AltList::iterator oldBegin = alternatives.begin(); 185 pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) , indexer);185 pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) ); 186 186 if ( alternatives.begin() == oldBegin ) { 187 187 std::ostringstream stream; … … 604 604 // ) 605 605 SymTab::Indexer decls( indexer ); 606 PRINT(607 std::cerr << "============= original indexer" << std::endl;608 indexer.print( std::cerr );609 std::cerr << "============= new indexer" << std::endl;610 decls.print( std::cerr );611 )606 // PRINT( 607 // std::cerr << "============= original indexer" << std::endl; 608 // indexer.print( std::cerr ); 609 // std::cerr << "============= new indexer" << std::endl; 610 // decls.print( std::cerr ); 611 // ) 612 612 addToIndexer( have, decls ); 613 613 AssertionSet newNeed; … … 627 627 TypeEnvironment resultEnv; 628 628 makeUnifiableVars( funcType, openVars, resultNeed ); 629 resultEnv.add( funcType->get_forall() ); // add all type variables as open variables now so that those not used in the parameter list are still considered open 629 630 AltList instantiatedActuals; // filled by instantiate function 630 631 if ( targetType && ! targetType->isVoid() && ! funcType->get_returnVals().empty() ) { … … 808 809 } 809 810 811 Expression * restructureCast( Expression * argExpr, Type * toType ) { 812 if ( argExpr->get_result()->size() > 1 && ! toType->isVoid() ) { 813 // Argument expression is a tuple and the target type is not void. Cast each member of the tuple 814 // to its corresponding target type, producing the tuple of those cast expressions. If there are 815 // more components of the tuple than components in the target type, then excess components do not 816 // come out in the result expression (but UniqueExprs ensure that side effects will still be done). 817 if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) { 818 // expressions which may contain side effects require a single unique instance of the expression. 819 argExpr = new UniqueExpr( argExpr ); 820 } 821 std::list< Expression * > componentExprs; 822 for ( unsigned int i = 0; i < toType->size(); i++ ) { 823 // cast each component 824 TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i ); 825 componentExprs.push_back( restructureCast( idx, toType->getComponent( i ) ) ); 826 } 827 delete argExpr; 828 assert( componentExprs.size() > 0 ); 829 // produce the tuple of casts 830 return new TupleExpr( componentExprs ); 831 } else { 832 // handle normally 833 return new CastExpr( argExpr, toType->clone() ); 834 } 835 } 836 810 837 void AlternativeFinder::visit( CastExpr *castExpr ) { 811 838 Type *& toType = castExpr->get_result(); … … 839 866 thisCost += Cost( 0, 0, discardedValues ); 840 867 841 Expression * argExpr = i->expr->clone(); 842 if ( argExpr->get_result()->size() > 1 && ! castExpr->get_result()->isVoid() ) { 843 // Argument expression is a tuple and the target type is not void. Cast each member of the tuple 844 // to its corresponding target type, producing the tuple of those cast expressions. If there are 845 // more components of the tuple than components in the target type, then excess components do not 846 // come out in the result expression (but UniqueExprs ensure that side effects will still be done). 847 if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) { 848 // expressions which may contain side effects require a single unique instance of the expression. 849 argExpr = new UniqueExpr( argExpr ); 850 } 851 std::list< Expression * > componentExprs; 852 for ( unsigned int i = 0; i < castExpr->get_result()->size(); i++ ) { 853 // cast each component 854 TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i ); 855 componentExprs.push_back( new CastExpr( idx, castExpr->get_result()->getComponent( i )->clone() ) ); 856 } 857 delete argExpr; 858 assert( componentExprs.size() > 0 ); 859 // produce the tuple of casts 860 candidates.push_back( Alternative( new TupleExpr( componentExprs ), i->env, i->cost, thisCost ) ); 861 } else { 862 // handle normally 863 candidates.push_back( Alternative( new CastExpr( argExpr->clone(), toType->clone() ), i->env, i->cost, thisCost ) ); 864 } 868 candidates.push_back( Alternative( restructureCast( i->expr->clone(), toType ), i->env, i->cost, thisCost ) ); 865 869 } // if 866 870 } // for … … 1181 1185 } 1182 1186 1187 void AlternativeFinder::visit( UntypedInitExpr *initExpr ) { 1188 // handle each option like a cast 1189 AltList candidates; 1190 PRINT( std::cerr << "untyped init expr: " << initExpr << std::endl; ) 1191 // O(N^2) checks of d-types with e-types 1192 for ( InitAlternative & initAlt : initExpr->get_initAlts() ) { 1193 Type * toType = resolveTypeof( initAlt.type, indexer ); 1194 SymTab::validateType( toType, &indexer ); 1195 adjustExprType( toType, env, indexer ); 1196 // Ideally the call to findWithAdjustment could be moved out of the loop, but unfortunately it currently has to occur inside or else 1197 // polymorphic return types are not properly bound to the initialization type, since return type variables are only open for the duration of resolving 1198 // the UntypedExpr. This is only actually an issue in initialization contexts that allow more than one possible initialization type, but it is still suboptimal. 1199 AlternativeFinder finder( indexer, env ); 1200 finder.targetType = toType; 1201 finder.findWithAdjustment( initExpr->get_expr() ); 1202 for ( Alternative & alt : finder.get_alternatives() ) { 1203 TypeEnvironment newEnv( alt.env ); 1204 AssertionSet needAssertions, haveAssertions; 1205 OpenVarSet openVars; // find things in env that don't have a "representative type" and claim those are open vars? 1206 PRINT( std::cerr << " @ " << toType << " " << initAlt.designation << std::endl; ) 1207 // It's possible that a cast can throw away some values in a multiply-valued expression. (An example is a 1208 // cast-to-void, which casts from one value to zero.) Figure out the prefix of the subexpression results 1209 // that are cast directly. The candidate is invalid if it has fewer results than there are types to cast 1210 // to. 1211 int discardedValues = alt.expr->get_result()->size() - toType->size(); 1212 if ( discardedValues < 0 ) continue; 1213 // xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not 1214 // allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3])) 1215 // unification run for side-effects 1216 unify( toType, alt.expr->get_result(), newEnv, needAssertions, haveAssertions, openVars, indexer ); // xxx - do some inspecting on this line... why isn't result bound to initAlt.type?? 1217 1218 Cost thisCost = castCost( alt.expr->get_result(), toType, indexer, newEnv ); 1219 if ( thisCost != Cost::infinity ) { 1220 // count one safe conversion for each value that is thrown away 1221 thisCost += Cost( 0, 0, discardedValues ); 1222 candidates.push_back( Alternative( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost ) ); 1223 } 1224 } 1225 } 1226 1227 // findMinCost selects the alternatives with the lowest "cost" members, but has the side effect of copying the 1228 // cvtCost member to the cost member (since the old cost is now irrelevant). Thus, calling findMinCost twice 1229 // selects first based on argument cost, then on conversion cost. 1230 AltList minArgCost; 1231 findMinCost( candidates.begin(), candidates.end(), std::back_inserter( minArgCost ) ); 1232 findMinCost( minArgCost.begin(), minArgCost.end(), std::back_inserter( alternatives ) ); 1233 } 1183 1234 } // namespace ResolvExpr 1184 1235 -
src/ResolvExpr/AlternativeFinder.h
r9c951e3 rb1e63ac5 73 73 virtual void visit( UniqueExpr *unqExpr ); 74 74 virtual void visit( StmtExpr *stmtExpr ); 75 virtual void visit( UntypedInitExpr *initExpr ); 75 76 /// Runs a new alternative finder on each element in [begin, end) 76 77 /// and writes each alternative finder to out. -
src/ResolvExpr/CastCost.cc
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // CastCost.cc -- 7 // CastCost.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 26 26 public: 27 27 CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 28 28 29 29 virtual void visit( BasicType *basicType ); 30 30 virtual void visit( PointerType *pointerType ); … … 36 36 NamedTypeDecl *namedType; 37 37 if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) { 38 return castCost( src, eqvClass.type, indexer, env ); 38 if ( eqvClass.type ) { 39 return castCost( src, eqvClass.type, indexer, env ); 40 } else { 41 return Cost::infinity; 42 } 39 43 } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) { 40 44 TypeDecl *type = dynamic_cast< TypeDecl* >( namedType ); -
src/ResolvExpr/CommonType.cc
r9c951e3 rb1e63ac5 43 43 44 44 void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer ); 45 template< typename RefType > void handleRefType( RefType *inst, Type *other );46 45 47 46 Type *result; … … 126 125 } 127 126 128 void CommonType::visit( VoidType *voidType ) { 129 } 127 void CommonType::visit( __attribute((unused)) VoidType *voidType ) {} 130 128 131 129 void CommonType::visit( BasicType *basicType ) { … … 159 157 void CommonType::visit( PointerType *pointerType ) { 160 158 if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) { 161 if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base() , indexer) ) {159 if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base()) ) { 162 160 getCommonWithVoidPointer( otherPointer, pointerType ); 163 } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base() , indexer) ) {161 } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base()) ) { 164 162 getCommonWithVoidPointer( pointerType, otherPointer ); 165 163 } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst ) … … 189 187 } 190 188 191 void CommonType::visit( ArrayType *arrayType ) { 192 } 193 194 void CommonType::visit( FunctionType *functionType ) { 195 } 196 197 template< typename RefType > void CommonType::handleRefType( RefType *inst, Type *other ) { 198 } 199 200 void CommonType::visit( StructInstType *aggregateUseType ) { 201 } 202 203 void CommonType::visit( UnionInstType *aggregateUseType ) { 204 } 189 void CommonType::visit( __attribute((unused)) ArrayType *arrayType ) {} 190 void CommonType::visit( __attribute((unused)) FunctionType *functionType ) {} 191 void CommonType::visit( __attribute((unused)) StructInstType *aggregateUseType ) {} 192 void CommonType::visit( __attribute((unused)) UnionInstType *aggregateUseType ) {} 205 193 206 194 void CommonType::visit( EnumInstType *enumInstType ) { … … 214 202 } 215 203 216 void CommonType::visit( TraitInstType *aggregateUseType ) {204 void CommonType::visit( __attribute((unused)) TraitInstType *aggregateUseType ) { 217 205 } 218 206 … … 239 227 } 240 228 241 void CommonType::visit( TupleType *tupleType ) { 242 } 243 244 void CommonType::visit( VarArgsType *varArgsType ) { 245 } 229 void CommonType::visit( __attribute((unused)) TupleType *tupleType ) {} 230 void CommonType::visit( __attribute((unused)) VarArgsType *varArgsType ) {} 246 231 247 232 void CommonType::visit( ZeroType *zeroType ) { -
src/ResolvExpr/ConversionCost.cc
r9c951e3 rb1e63ac5 30 30 /// std::cout << "type inst " << destAsTypeInst->get_name(); 31 31 if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) { 32 return conversionCost( src, eqvClass.type, indexer, env ); 32 if ( eqvClass.type ) { 33 return conversionCost( src, eqvClass.type, indexer, env ); 34 } else { 35 return Cost::infinity; 36 } 33 37 } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) { 34 38 /// std::cout << " found" << std::endl; … … 145 149 }; 146 150 147 void ConversionCost::visit( VoidType *voidType) {151 void ConversionCost::visit( __attribute((unused)) VoidType *voidType ) { 148 152 cost = Cost::infinity; 149 153 } … … 182 186 } 183 187 184 void ConversionCost::visit(ArrayType *arrayType) { 185 } 186 187 void ConversionCost::visit(FunctionType *functionType) { 188 } 188 void ConversionCost::visit(__attribute((unused)) ArrayType *arrayType) {} 189 void ConversionCost::visit(__attribute((unused)) FunctionType *functionType) {} 189 190 190 191 void ConversionCost::visit(StructInstType *inst) { … … 204 205 } 205 206 206 void ConversionCost::visit( EnumInstType *inst) {207 void ConversionCost::visit( __attribute((unused)) EnumInstType *inst ) { 207 208 static Type::Qualifiers q; 208 209 static BasicType integer( q, BasicType::SignedInt ); … … 213 214 } 214 215 215 void ConversionCost::visit( TraitInstType *inst) {216 void ConversionCost::visit( __attribute((unused)) TraitInstType *inst) { 216 217 } 217 218 … … 235 236 } 236 237 237 void ConversionCost::visit( TupleType *tupleType) {238 void ConversionCost::visit( __attribute((unused)) TupleType *tupleType) { 238 239 Cost c; 239 240 if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) { … … 255 256 } 256 257 257 void ConversionCost::visit( VarArgsType *varArgsType) {258 void ConversionCost::visit( __attribute((unused)) VarArgsType *varArgsType) { 258 259 if ( dynamic_cast< VarArgsType* >( dest ) ) { 259 260 cost = Cost::zero; … … 261 262 } 262 263 263 void ConversionCost::visit( ZeroType *zeroType) {264 void ConversionCost::visit( __attribute((unused)) ZeroType *zeroType) { 264 265 if ( dynamic_cast< ZeroType* >( dest ) ) { 265 266 cost = Cost::zero; … … 277 278 } 278 279 279 void ConversionCost::visit( OneType *oneType) {280 void ConversionCost::visit( __attribute((unused)) OneType *oneType) { 280 281 if ( dynamic_cast< OneType* >( dest ) ) { 281 282 cost = Cost::zero; -
src/ResolvExpr/PtrsAssignable.cc
r9c951e3 rb1e63ac5 63 63 } 64 64 65 PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) { 66 } 65 PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) {} 67 66 68 void PtrsAssignable::visit( VoidType *voidType ) {67 void PtrsAssignable::visit( __attribute((unused)) VoidType *voidType ) { 69 68 if ( dynamic_cast< FunctionType* >( dest ) ) { 70 69 result = 0; … … 74 73 } 75 74 76 void PtrsAssignable::visit( BasicType *basicType ) { 77 } 78 79 void PtrsAssignable::visit( PointerType *pointerType ) { 80 } 81 82 void PtrsAssignable::visit( ArrayType *arrayType ) { 83 } 84 85 void PtrsAssignable::visit( FunctionType *functionType ) { 75 void PtrsAssignable::visit( __attribute__((unused)) BasicType *basicType ) {} 76 void PtrsAssignable::visit( __attribute__((unused)) PointerType *pointerType ) {} 77 void PtrsAssignable::visit( __attribute__((unused)) ArrayType *arrayType ) {} 78 void PtrsAssignable::visit( __attribute__((unused)) FunctionType *functionType ) { 86 79 result = -1; 87 80 } 88 81 89 void PtrsAssignable::visit( StructInstType *inst ) { 90 // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong 91 } 92 93 void PtrsAssignable::visit( UnionInstType *inst ) { 94 // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong 95 } 82 void PtrsAssignable::visit( __attribute__((unused)) StructInstType *inst ) {} 83 void PtrsAssignable::visit( __attribute__((unused)) UnionInstType *inst ) {} 96 84 97 85 void PtrsAssignable::visit( EnumInstType *inst ) { … … 103 91 } 104 92 105 void PtrsAssignable::visit( TraitInstType *inst ) { 106 // I definitely don't think we should be doing anything here 107 } 108 93 void PtrsAssignable::visit( __attribute__((unused)) TraitInstType *inst ) {} 109 94 void PtrsAssignable::visit( TypeInstType *inst ) { 110 95 EqvClass eqvClass; … … 116 101 } 117 102 118 void PtrsAssignable::visit( TupleType *tupleType ) { 119 /// // This code doesn't belong here, but it might be useful somewhere else 120 /// if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) { 121 /// int ret = 0; 122 /// std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin(); 123 /// std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin(); 124 /// while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) { 125 /// int assignResult = ptrsAssignable( *srcIt++, *destIt++ ); 126 /// if ( assignResult == 0 ) { 127 /// result = assignResult; 128 /// return; 129 /// } else if ( assignResult < 0 ) { 130 /// ret = -1; 131 /// } else if ( ret > 0 ) { 132 /// ret += assignResult; 133 /// } 134 /// } 135 /// if ( srcIt == tupleType->get_types().end() && destIt == destAsTuple->get_types().end() ) { 136 /// result = ret; 137 /// } else { 138 /// result = 0; 139 /// } 140 /// } 141 } 142 143 void PtrsAssignable::visit( VarArgsType *varArgsType ) { 144 } 145 146 void PtrsAssignable::visit( ZeroType *zeroType ) { 147 } 148 149 void PtrsAssignable::visit( OneType *oneType ) { 150 } 103 void PtrsAssignable::visit( __attribute__((unused)) TupleType *tupleType ) {} 104 void PtrsAssignable::visit( __attribute__((unused)) VarArgsType *varArgsType ) {} 105 void PtrsAssignable::visit( __attribute__((unused)) ZeroType *zeroType ) {} 106 void PtrsAssignable::visit( __attribute__((unused)) OneType *oneType ) {} 151 107 152 108 } // namespace ResolvExpr -
src/ResolvExpr/PtrsCastable.cc
r9c951e3 rb1e63ac5 92 92 } 93 93 94 void PtrsCastable::visit( VoidType *voidType) {94 void PtrsCastable::visit( __attribute__((unused)) VoidType *voidType) { 95 95 result = objectCast( dest, env, indexer ); 96 96 } 97 97 98 void PtrsCastable::visit( BasicType *basicType) {98 void PtrsCastable::visit( __attribute__((unused)) BasicType *basicType) { 99 99 result = objectCast( dest, env, indexer ); 100 100 } 101 101 102 void PtrsCastable::visit( PointerType *pointerType) {102 void PtrsCastable::visit( __attribute__((unused)) PointerType *pointerType) { 103 103 result = objectCast( dest, env, indexer ); 104 104 } 105 105 106 void PtrsCastable::visit( ArrayType *arrayType) {106 void PtrsCastable::visit( __attribute__((unused)) ArrayType *arrayType) { 107 107 result = objectCast( dest, env, indexer ); 108 108 } 109 109 110 void PtrsCastable::visit( FunctionType *functionType) {110 void PtrsCastable::visit( __attribute__((unused)) FunctionType *functionType) { 111 111 // result = -1; 112 112 result = functionCast( dest, env, indexer ); 113 113 } 114 114 115 void PtrsCastable::visit( StructInstType *inst) {115 void PtrsCastable::visit( __attribute__((unused)) StructInstType *inst) { 116 116 result = objectCast( dest, env, indexer ); 117 117 } 118 118 119 void PtrsCastable::visit( UnionInstType *inst) {119 void PtrsCastable::visit( __attribute__((unused)) UnionInstType *inst) { 120 120 result = objectCast( dest, env, indexer ); 121 121 } 122 122 123 void PtrsCastable::visit( EnumInstType *inst) {123 void PtrsCastable::visit( __attribute__((unused)) EnumInstType *inst) { 124 124 if ( dynamic_cast< EnumInstType* >( dest ) ) { 125 125 result = 1; … … 135 135 } 136 136 137 void PtrsCastable::visit(TraitInstType *inst) { 138 // I definitely don't think we should be doing anything here 139 } 137 void PtrsCastable::visit( __attribute__((unused)) TraitInstType *inst ) {} 140 138 141 139 void PtrsCastable::visit(TypeInstType *inst) { … … 144 142 } 145 143 146 void PtrsCastable::visit( TupleType *tupleType) {144 void PtrsCastable::visit( __attribute__((unused)) TupleType *tupleType) { 147 145 result = objectCast( dest, env, indexer ); 148 146 } 149 147 150 void PtrsCastable::visit( VarArgsType *varArgsType) {148 void PtrsCastable::visit( __attribute__((unused)) VarArgsType *varArgsType) { 151 149 result = objectCast( dest, env, indexer ); 152 150 } 153 151 154 void PtrsCastable::visit( ZeroType *zeroType) {152 void PtrsCastable::visit( __attribute__((unused)) ZeroType *zeroType) { 155 153 result = objectCast( dest, env, indexer ); 156 154 } 157 155 158 void PtrsCastable::visit( OneType *oneType) {156 void PtrsCastable::visit( __attribute__((unused)) OneType *oneType) { 159 157 result = objectCast( dest, env, indexer ); 160 158 } -
src/ResolvExpr/Resolver.cc
r9c951e3 rb1e63ac5 14 14 // 15 15 16 #include <iostream> 17 18 #include "Alternative.h" 19 #include "AlternativeFinder.h" 20 #include "CurrentObject.h" 21 #include "RenameVars.h" 16 22 #include "Resolver.h" 17 #include "AlternativeFinder.h"18 #include "Alternative.h"19 #include "RenameVars.h"20 23 #include "ResolveTypeof.h" 21 24 #include "typeops.h" 25 26 #include "SynTree/Expression.h" 27 #include "SynTree/Initializer.h" 22 28 #include "SynTree/Statement.h" 23 29 #include "SynTree/Type.h" 24 #include "SynTree/Expression.h" 25 #include "Sy nTree/Initializer.h"30 31 #include "SymTab/Autogen.h" 26 32 #include "SymTab/Indexer.h" 27 #include "SymTab/Autogen.h" 33 28 34 #include "Common/utility.h" 35 29 36 #include "InitTweak/InitTweak.h" 30 37 31 #include <iostream>32 38 using namespace std; 33 39 … … 39 45 if ( const Resolver * res = dynamic_cast< const Resolver * >( &other ) ) { 40 46 functionReturn = res->functionReturn; 41 initContext = res->initContext;47 currentObject = res->currentObject; 42 48 inEnumDecl = res->inEnumDecl; 43 49 } … … 79 85 80 86 Type * functionReturn = nullptr; 81 Type *initContext = nullptr;87 CurrentObject currentObject = nullptr; 82 88 bool inEnumDecl = false; 83 89 }; … … 124 130 } // if 125 131 #endif 126 assert ( finder.get_alternatives().size() == 1);132 assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." ); 127 133 Alternative &choice = finder.get_alternatives().front(); 128 134 Expression *newExpr = choice.expr->clone(); … … 186 192 // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting 187 193 // the RHS. 188 Type *temp = initContext;189 initContext = new_type;190 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext) ) {194 ValueGuard<CurrentObject> temp( currentObject ); 195 currentObject = CurrentObject( objectDecl->get_type() ); 196 if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) { 191 197 // enumerator initializers should not use the enum type to initialize, since 192 198 // the enum type is still incomplete at this point. Use signed int instead. 193 initContext = new BasicType( Type::Qualifiers(), BasicType::SignedInt);199 currentObject = CurrentObject( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 194 200 } 195 201 Parent::visit( objectDecl ); 196 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext) ) {202 if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) { 197 203 // delete newly created signed int type 198 delete initContext; 199 } 200 initContext = temp; 204 // delete currentObject.getType(); 205 } 201 206 } 202 207 … … 315 320 316 321 void Resolver::visit( SwitchStmt *switchStmt ) { 317 ValueGuard< Type * > oldInitContext( initContext );322 ValueGuard< CurrentObject > oldCurrentObject( currentObject ); 318 323 Expression *newExpr; 319 324 newExpr = findIntegralExpression( switchStmt->get_condition(), *this ); … … 321 326 switchStmt->set_condition( newExpr ); 322 327 323 initContext = newExpr->get_result();328 currentObject = CurrentObject( newExpr->get_result() ); 324 329 Parent::visit( switchStmt ); 325 330 } … … 327 332 void Resolver::visit( CaseStmt *caseStmt ) { 328 333 if ( caseStmt->get_condition() ) { 329 assert( initContext ); 330 CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initContext->clone() ); 334 std::list< InitAlternative > initAlts = currentObject.getOptions(); 335 assertf( initAlts.size() == 1, "SwitchStmt did not correctly resolve an integral expression." ); 336 CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() ); 331 337 Expression * newExpr = findSingleExpression( castExpr, *this ); 332 338 castExpr = safe_dynamic_cast< CastExpr * >( newExpr ); … … 370 376 371 377 void Resolver::visit( SingleInit *singleInit ) { 372 if ( singleInit->get_value() ) { 373 // // find all the d's 374 // std::list<Expression *> &designators = singleInit->get_designators(); 375 // std::list<Type *> types1{ initContext }, types2; 376 // for ( Expression * expr: designators ) { 377 // cerr << expr << endl; 378 // if ( NameExpr * nexpr = dynamic_cast<NameExpr *>( expr ) ) { 379 // for ( Type * type: types1 ) { 380 // cerr << type << endl; 381 // ReferenceToType * fred = dynamic_cast<ReferenceToType *>(type); 382 // std::list<Declaration *> members; 383 // if ( fred ) { 384 // fred->lookup( nexpr->get_name(), members ); // concatenate identical field name 385 // for ( Declaration * mem: members ) { 386 // if ( DeclarationWithType * dwt = dynamic_cast<DeclarationWithType *>(mem) ) { 387 // types2.push_back( dwt->get_type() ); 388 // } // if 389 // } // for 390 // } // if 391 // } // for 392 // types1 = types2; 393 // types2.clear(); 394 // } // if 395 // } // for 396 // // for ( Type * type: types1 ) { 397 // // cerr << type << endl; 398 // // } // for 399 400 // // O(N^2) checks of d-types with f-types 401 // // find the minimum cost 402 CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() ); 403 Expression *newExpr = findSingleExpression( castExpr, *this ); 404 delete castExpr; 405 singleInit->set_value( newExpr ); 406 407 // check if initializing type is char[] 408 if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) { 409 if ( isCharType( at->get_base() ) ) { 410 // check if the resolved type is char * 411 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) { 412 if ( isCharType( pt->get_base() ) ) { 413 // strip cast if we're initializing a char[] with a char *, e.g. char x[] = "hello"; 414 CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ); 415 singleInit->set_value( ce->get_arg() ); 416 ce->set_arg( NULL ); 417 delete ce; 418 } 378 // resolve initialization using the possibilities as determined by the currentObject cursor 379 UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() ); 380 Expression * newExpr = findSingleExpression( untyped, *this ); 381 InitExpr * initExpr = safe_dynamic_cast< InitExpr * >( newExpr ); 382 383 // move cursor to the object that is actually initialized 384 currentObject.setNext( initExpr->get_designation() ); 385 386 // discard InitExpr wrapper and retain relevant pieces 387 newExpr = initExpr->get_expr(); 388 newExpr->set_env( initExpr->get_env() ); 389 initExpr->set_expr( nullptr ); 390 initExpr->set_env( nullptr ); 391 delete initExpr; 392 393 // get the actual object's type (may not exactly match what comes back from the resolver due to conversions) 394 Type * initContext = currentObject.getCurrentType(); 395 396 // check if actual object's type is char[] 397 if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) { 398 if ( isCharType( at->get_base() ) ) { 399 // check if the resolved type is char * 400 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) { 401 if ( isCharType( pt->get_base() ) ) { 402 // strip cast if we're initializing a char[] with a char *, e.g. char x[] = "hello"; 403 CastExpr *ce = safe_dynamic_cast< CastExpr * >( newExpr ); 404 newExpr = ce->get_arg(); 405 ce->set_arg( nullptr ); 406 delete ce; 419 407 } 420 408 } 421 409 } 422 } // if 423 } 424 425 template< typename AggrInst > 426 TypeSubstitution makeGenericSubstitutuion( AggrInst * inst ) { 427 assert( inst ); 428 assert( inst->get_baseParameters() ); 429 std::list< TypeDecl * > baseParams = *inst->get_baseParameters(); 430 std::list< Expression * > typeSubs = inst->get_parameters(); 431 TypeSubstitution subs( baseParams.begin(), baseParams.end(), typeSubs.begin() ); 432 return subs; 433 } 434 435 ReferenceToType * isStructOrUnion( Type * type ) { 436 if ( StructInstType * sit = dynamic_cast< StructInstType * >( type ) ) { 437 return sit; 438 } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( type ) ) { 439 return uit; 440 } 441 return nullptr; 442 } 443 444 void Resolver::resolveSingleAggrInit( Declaration * dcl, InitIterator & init, InitIterator & initEnd, TypeSubstitution sub ) { 445 DeclarationWithType * dt = dynamic_cast< DeclarationWithType * >( dcl ); 446 assert( dt ); 447 // need to substitute for generic types, so that casts are to concrete types 448 initContext = dt->get_type()->clone(); 449 sub.apply( initContext ); 450 451 try { 452 if ( init == initEnd ) return; // stop when there are no more initializers 453 (*init)->accept( *this ); 454 ++init; // made it past an initializer 455 } catch( SemanticError & ) { 456 // need to delve deeper, if you can 457 if ( ReferenceToType * type = isStructOrUnion( initContext ) ) { 458 resolveAggrInit( type, init, initEnd ); 459 } else { 460 // member is not an aggregate type, so can't go any deeper 461 462 // might need to rethink what is being thrown 463 throw; 464 } // if 465 } 466 } 467 468 void Resolver::resolveAggrInit( ReferenceToType * inst, InitIterator & init, InitIterator & initEnd ) { 469 if ( StructInstType * sit = dynamic_cast< StructInstType * >( inst ) ) { 470 TypeSubstitution sub = makeGenericSubstitutuion( sit ); 471 StructDecl * st = sit->get_baseStruct(); 472 if(st->get_members().empty()) return; 473 // want to resolve each initializer to the members of the struct, 474 // but if there are more initializers than members we should stop 475 list< Declaration * >::iterator it = st->get_members().begin(); 476 for ( ; it != st->get_members().end(); ++it) { 477 resolveSingleAggrInit( *it, init, initEnd, sub ); 478 } 479 } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( inst ) ) { 480 TypeSubstitution sub = makeGenericSubstitutuion( uit ); 481 UnionDecl * un = uit->get_baseUnion(); 482 if(un->get_members().empty()) return; 483 // only resolve to the first member of a union 484 resolveSingleAggrInit( *un->get_members().begin(), init, initEnd, sub ); 485 } // if 410 } 411 412 // set initializer expr to resolved express 413 singleInit->set_value( newExpr ); 414 415 // move cursor to next object in preparation for next initializer 416 currentObject.increment(); 486 417 } 487 418 488 419 void Resolver::visit( ListInit * listInit ) { 489 InitIterator iter = listInit->begin(); 490 InitIterator end = listInit->end(); 491 492 if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) { 493 // resolve each member to the base type of the array 494 for ( ; iter != end; ++iter ) { 495 initContext = at->get_base(); 496 (*iter)->accept( *this ); 497 } // for 498 } else if ( TupleType * tt = dynamic_cast< TupleType * > ( initContext ) ) { 499 for ( Type * t : *tt ) { 500 if ( iter == end ) break; 501 initContext = t; 502 (*iter++)->accept( *this ); 503 } 504 } else if ( ReferenceToType * type = isStructOrUnion( initContext ) ) { 505 resolveAggrInit( type, iter, end ); 506 } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) { 507 Type * base = tt->get_baseType()->get_base(); 508 if ( base ) { 509 // know the implementation type, so try using that as the initContext 510 initContext = base; 511 visit( listInit ); 512 } else { 513 // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context 514 Parent::visit( listInit ); 515 } 516 } else { 517 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) 518 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) || dynamic_cast < EnumInstType * > ( initContext ) ); 519 // basic types are handled here 520 Parent::visit( listInit ); 521 } 522 523 #if 0 524 if ( ArrayType *at = dynamic_cast<ArrayType*>(initContext) ) { 525 std::list<Initializer *>::iterator iter( listInit->begin_initializers() ); 526 for ( ; iter != listInit->end_initializers(); ++iter ) { 527 initContext = at->get_base(); 528 (*iter)->accept( *this ); 529 } // for 530 } else if ( StructInstType *st = dynamic_cast<StructInstType*>(initContext) ) { 531 StructDecl *baseStruct = st->get_baseStruct(); 532 std::list<Declaration *>::iterator iter1( baseStruct->get_members().begin() ); 533 std::list<Initializer *>::iterator iter2( listInit->begin_initializers() ); 534 for ( ; iter1 != baseStruct->get_members().end() && iter2 != listInit->end_initializers(); ++iter2 ) { 535 if ( (*iter2)->get_designators().empty() ) { 536 DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *iter1 ); 537 initContext = dt->get_type(); 538 (*iter2)->accept( *this ); 539 ++iter1; 540 } else { 541 StructDecl *st = baseStruct; 542 iter1 = st->get_members().begin(); 543 std::list<Expression *>::iterator iter3( (*iter2)->get_designators().begin() ); 544 for ( ; iter3 != (*iter2)->get_designators().end(); ++iter3 ) { 545 NameExpr *key = dynamic_cast<NameExpr *>( *iter3 ); 546 assert( key ); 547 for ( ; iter1 != st->get_members().end(); ++iter1 ) { 548 if ( key->get_name() == (*iter1)->get_name() ) { 549 (*iter1)->print( cout ); 550 cout << key->get_name() << endl; 551 ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 ); 552 assert( fred ); 553 StructInstType *mary = dynamic_cast<StructInstType*>( fred->get_type() ); 554 assert( mary ); 555 st = mary->get_baseStruct(); 556 iter1 = st->get_members().begin(); 557 break; 558 } // if 559 } // for 560 } // for 561 ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 ); 562 assert( fred ); 563 initContext = fred->get_type(); 564 (*listInit->begin_initializers())->accept( *this ); 565 } // if 566 } // for 567 } else if ( UnionInstType *st = dynamic_cast<UnionInstType*>(initContext) ) { 568 DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *st->get_baseUnion()->get_members().begin() ); 569 initContext = dt->get_type(); 570 (*listInit->begin_initializers())->accept( *this ); 571 } // if 572 #endif 420 // move cursor into brace-enclosed initializer-list 421 currentObject.enterListInit(); 422 // xxx - fix this so that the list isn't copied, iterator should be used to change current element 423 std::list<Designation *> newDesignations; 424 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) { 425 // iterate designations and initializers in pairs, moving the cursor to the current designated object and resolving 426 // the initializer against that object. 427 Designation * des = std::get<0>(p); 428 Initializer * init = std::get<1>(p); 429 newDesignations.push_back( currentObject.findNext( des ) ); 430 init->accept( *this ); 431 } 432 // set the set of 'resolved' designations and leave the brace-enclosed initializer-list 433 listInit->get_designations() = newDesignations; // xxx - memory management 434 currentObject.exitListInit(); 435 436 // xxx - this part has not be folded into CurrentObject yet 437 // } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) { 438 // Type * base = tt->get_baseType()->get_base(); 439 // if ( base ) { 440 // // know the implementation type, so try using that as the initContext 441 // ObjectDecl tmpObj( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, base->clone(), nullptr ); 442 // currentObject = &tmpObj; 443 // visit( listInit ); 444 // } else { 445 // // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context 446 // Parent::visit( listInit ); 447 // } 448 // } else { 573 449 } 574 450 -
src/ResolvExpr/TypeMap.h
r9c951e3 rb1e63ac5 110 110 } 111 111 112 virtual void visit( VoidType *voidType ) {112 virtual void visit( __attribute__((unused)) VoidType *voidType ) { 113 113 findAndReplace( typeMap.voidValue ); 114 114 } … … 138 138 } 139 139 140 virtual void visit( FunctionType *functionType ) {140 virtual void visit( __attribute__((unused)) FunctionType *functionType ) { 141 141 findAndReplace( typeMap.functionPointerValue ); 142 142 } -
src/ResolvExpr/Unify.cc
r9c951e3 rb1e63ac5 115 115 } 116 116 117 bool isFtype( Type *type , const SymTab::Indexer &indexer) {117 bool isFtype( Type *type ) { 118 118 if ( dynamic_cast< FunctionType* >( type ) ) { 119 119 return true; … … 124 124 } 125 125 126 bool tyVarCompatible( const TypeDecl::Data & data, Type *type , const SymTab::Indexer &indexer) {126 bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) { 127 127 switch ( data.kind ) { 128 128 case TypeDecl::Any: … … 132 132 // type must also be complete 133 133 // xxx - should this also check that type is not a tuple type and that it's not a ttype? 134 return ! isFtype( type , indexer) && (! data.isComplete || type->isComplete() );134 return ! isFtype( type ) && (! data.isComplete || type->isComplete() ); 135 135 case TypeDecl::Ftype: 136 return isFtype( type , indexer);136 return isFtype( type ); 137 137 case TypeDecl::Ttype: 138 138 // ttype unifies with any tuple type … … 145 145 OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() ); 146 146 assert( tyvar != openVars.end() ); 147 if ( ! tyVarCompatible( tyvar->second, other , indexer) ) {147 if ( ! tyVarCompatible( tyvar->second, other ) ) { 148 148 return false; 149 149 } // if … … 345 345 std::cerr << "unifyInexact type 1 is "; 346 346 type1->print( std::cerr ); 347 std::cerr << " type 2 is ";347 std::cerr << " type 2 is "; 348 348 type2->print( std::cerr ); 349 349 std::cerr << std::endl; … … 389 389 } 390 390 391 void Unify::visit( VoidType *voidType) {391 void Unify::visit( __attribute__((unused)) VoidType *voidType) { 392 392 result = dynamic_cast< VoidType* >( type2 ); 393 393 } … … 615 615 } else if ( tupleParam ) { 616 616 // bundle other parameters into tuple to match 617 TupleType* binder = new TupleType{ paramTy->get_qualifiers() };617 std::list< Type * > binderTypes; 618 618 619 619 do { 620 binder ->get_types().push_back( otherParam->get_type()->clone() );620 binderTypes.push_back( otherParam->get_type()->clone() ); 621 621 ++jt; 622 622 … … 627 627 } while (true); 628 628 629 otherParamTy = binder;629 otherParamTy = new TupleType{ paramTy->get_qualifiers(), binderTypes }; 630 630 ++it; // skip ttype parameter for break 631 631 } else if ( otherTupleParam ) { 632 632 // bundle parameters into tuple to match other 633 TupleType* binder = new TupleType{ otherParamTy->get_qualifiers() };633 std::list< Type * > binderTypes; 634 634 635 635 do { 636 binder ->get_types().push_back( param->get_type()->clone() );636 binderTypes.push_back( param->get_type()->clone() ); 637 637 ++it; 638 638 … … 643 643 } while (true); 644 644 645 paramTy = binder;645 paramTy = new TupleType{ otherParamTy->get_qualifiers(), binderTypes }; 646 646 ++jt; // skip ttype parameter for break 647 647 } … … 692 692 693 693 template< typename Iterator1, typename Iterator2 > 694 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode,const SymTab::Indexer &indexer ) {694 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, const SymTab::Indexer &indexer ) { 695 695 auto get_type = [](Type * t) { return t; }; 696 696 for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) { … … 742 742 flatten( flat2.get(), back_inserter( types2 ) ); 743 743 744 result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, widenMode,indexer );745 } // if 746 } 747 748 void Unify::visit( VarArgsType *varArgsType) {744 result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, indexer ); 745 } // if 746 } 747 748 void Unify::visit( __attribute__((unused)) VarArgsType *varArgsType ) { 749 749 result = dynamic_cast< VarArgsType* >( type2 ); 750 750 } 751 751 752 void Unify::visit( ZeroType *zeroType) {752 void Unify::visit( __attribute__((unused)) ZeroType *zeroType ) { 753 753 result = dynamic_cast< ZeroType* >( type2 ); 754 754 } 755 755 756 void Unify::visit( OneType *oneType) {756 void Unify::visit( __attribute__((unused)) OneType *oneType ) { 757 757 result = dynamic_cast< OneType* >( type2 ); 758 758 } … … 765 765 return function->get_returnVals().front()->get_type()->clone(); 766 766 } else { 767 TupleType * tupleType = new TupleType( Type::Qualifiers() );767 std::list< Type * > types; 768 768 for ( DeclarationWithType * decl : function->get_returnVals() ) { 769 t upleType->get_types().push_back( decl->get_type()->clone() );769 types.push_back( decl->get_type()->clone() ); 770 770 } // for 771 return tupleType;771 return new TupleType( Type::Qualifiers(), types ); 772 772 } 773 773 } -
src/ResolvExpr/module.mk
r9c951e3 rb1e63ac5 6 6 ## file "LICENCE" distributed with Cforall. 7 7 ## 8 ## module.mk -- 8 ## module.mk -- 9 9 ## 10 10 ## Author : Richard C. Bilson … … 31 31 ResolvExpr/PolyCost.cc \ 32 32 ResolvExpr/Occurs.cc \ 33 ResolvExpr/TypeEnvironment.cc 33 ResolvExpr/TypeEnvironment.cc \ 34 ResolvExpr/CurrentObject.cc -
src/ResolvExpr/typeops.h
r9c951e3 rb1e63ac5 118 118 119 119 // in Unify.cc 120 bool isFtype( Type *type , const SymTab::Indexer &indexer);120 bool isFtype( Type *type ); 121 121 bool typesCompatible( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 122 122 bool typesCompatibleIgnoreQualifiers( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env ); … … 130 130 TypeEnvironment env; 131 131 return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env ); 132 }133 134 template< typename Container1, typename Container2 >135 bool typesCompatibleList( Container1 &c1, Container2 &c2, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {136 typename Container1::iterator i1 = c1.begin();137 typename Container2::iterator i2 = c2.begin();138 for ( ; i1 != c1.end() && i2 != c2.end(); ++i1, ++i2 ) {139 if ( ! typesCompatible( *i1, *i2, indexer ) ) {140 return false;141 } // if142 }143 return ( i1 == c1.end() ) && ( i2 == c2.end() );144 132 } 145 133 -
src/SymTab/Autogen.cc
r9c951e3 rb1e63ac5 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:41:08201713 // Update Count : 6 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:30:00 2017 13 // Update Count : 61 14 14 // 15 15 … … 263 263 // E ?=?(E volatile*, int), 264 264 // ?=?(E _Atomic volatile*, int); 265 void makeEnumFunctions( Enum Decl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {265 void makeEnumFunctions( EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) { 266 266 267 267 // T ?=?(E *, E); … … 401 401 /// generates struct constructors, destructor, and assignment functions 402 402 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 403 // Builtins do not use autogeneration. 404 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin || 405 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) { 406 return; 407 } 408 403 409 // Make function polymorphic in same parameters as generic struct, if applicable 404 410 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions … … 487 493 488 494 /// generates the body of a union assignment/copy constructor/field constructor 489 void makeUnionAssignBody( FunctionDecl * funcDecl , bool isDynamicLayout) {495 void makeUnionAssignBody( FunctionDecl * funcDecl ) { 490 496 FunctionType * ftype = funcDecl->get_functionType(); 491 497 assert( ftype->get_parameters().size() == 2 ); … … 507 513 // Make function polymorphic in same parameters as generic union, if applicable 508 514 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions 509 bool isDynamicLayout = hasDynamicLayout( aggregateDecl ); // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 510 515 511 516 // default ctor/dtor need only first parameter 512 517 // void ?{}(T *); void ^?{}(T *); … … 534 539 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting ); 535 540 536 makeUnionAssignBody( assignDecl , isDynamicLayout);541 makeUnionAssignBody( assignDecl ); 537 542 538 543 // body of assignment and copy ctor is the same 539 makeUnionAssignBody( copyCtorDecl , isDynamicLayout);544 makeUnionAssignBody( copyCtorDecl ); 540 545 541 546 // create a constructor which takes the first member type as a parameter. … … 552 557 FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting ); 553 558 554 makeUnionAssignBody( ctor , isDynamicLayout);559 makeUnionAssignBody( ctor ); 555 560 memCtors.push_back( ctor ); 556 561 // only generate a ctor for the first field … … 579 584 EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() ); 580 585 // enumInst->set_baseEnum( enumDecl ); 581 makeEnumFunctions( enum Decl, enumInst, functionNesting, declsToAddAfter );586 makeEnumFunctions( enumInst, functionNesting, declsToAddAfter ); 582 587 } 583 588 } -
src/SymTab/Autogen.h
r9c951e3 rb1e63ac5 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:10:41201713 // Update Count : 912 // Last Modified On : Wed Jun 21 17:25:26 2017 13 // Update Count : 14 14 14 // 15 15 … … 43 43 template< typename OutputIterator > 44 44 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 45 // want to be able to generate assignment, ctor, and dtor generically,46 // so fname is either ?=?, ?{}, or ^?{}47 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );45 // want to be able to generate assignment, ctor, and dtor generically, 46 // so fname is either ?=?, ?{}, or ^?{} 47 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 48 48 49 // do something special for unnamed members 50 dstParam = new AddressExpr( dstParam ); 51 if ( addCast ) { 52 // cast to T* with qualifiers removed, so that qualified objects can be constructed 53 // and destructed with the same functions as non-qualified objects. 54 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 55 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 56 // remove lvalue as a qualifier, this can change to 57 // type->get_qualifiers() = Type::Qualifiers(); 58 assert( type ); 59 Type * castType = type->clone(); 60 // castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, false); 61 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 62 castType->set_lvalue( true ); // xxx - might not need this 63 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 64 } 65 fExpr->get_args().push_back( dstParam ); 49 // do something special for unnamed members 50 dstParam = new AddressExpr( dstParam ); 51 if ( addCast ) { 52 // cast to T* with qualifiers removed, so that qualified objects can be constructed 53 // and destructed with the same functions as non-qualified objects. 54 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 55 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 56 // remove lvalue as a qualifier, this can change to 57 // type->get_qualifiers() = Type::Qualifiers(); 58 assert( type ); 59 Type * castType = type->clone(); 60 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 61 castType->set_lvalue( true ); // xxx - might not need this 62 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 63 } 64 fExpr->get_args().push_back( dstParam ); 66 65 67 Statement * listInit = srcParam.buildListInit( fExpr );66 Statement * listInit = srcParam.buildListInit( fExpr ); 68 67 69 std::list< Expression * > args = *++srcParam;70 fExpr->get_args().splice( fExpr->get_args().end(), args );68 std::list< Expression * > args = *++srcParam; 69 fExpr->get_args().splice( fExpr->get_args().end(), args ); 71 70 72 *out++ = new ExprStmt( noLabels, fExpr );71 *out++ = new ExprStmt( noLabels, fExpr ); 73 72 74 srcParam.clearArrayIndices();73 srcParam.clearArrayIndices(); 75 74 76 return listInit;75 return listInit; 77 76 } 78 77 … … 88 87 Expression * begin, * end, * update, * cmp; 89 88 if ( forward ) { 90 // generate: for ( int i = 0; i < 0; ++i )91 begin = new ConstantExpr( Constant ( new ZeroType( emptyQualifiers ), "0") );89 // generate: for ( int i = 0; i < N; ++i ) 90 begin = new ConstantExpr( Constant::from_int( 0 ) ); 92 91 end = array->get_dimension()->clone(); 93 92 cmp = new NameExpr( "?<?" ); … … 97 96 begin = new UntypedExpr( new NameExpr( "?-?" ) ); 98 97 ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() ); 99 ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant ( new OneType( emptyQualifiers ), "1") ) );100 end = new ConstantExpr( Constant ( new ZeroType( emptyQualifiers ), "0") );98 ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) ); 99 end = new ConstantExpr( Constant::from_int( 0 ) ); 101 100 cmp = new NameExpr( "?>=?" ); 102 101 update = new NameExpr( "--?" ); 103 102 } 104 103 105 ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin , std::list<Expression*>()) );104 ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin ) ); 106 105 107 106 UntypedExpr *cond = new UntypedExpr( cmp ); -
src/SymTab/FixFunction.cc
r9c951e3 rb1e63ac5 24 24 25 25 DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) { 26 ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type() ->clone()), 0, functionDecl->get_attributes() );26 ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type() ), 0, functionDecl->get_attributes() ); 27 27 functionDecl->get_attributes().clear(); 28 // can't delete function type because it may contain assertions, but can't transfer ownership without a clone since set_type checks for nullptr 29 functionDecl->set_type( functionDecl->get_type()->clone() ); 28 30 delete functionDecl; 29 31 return pointer; -
src/SymTab/ImplementationType.cc
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ImplementationType.cc -- 7 // ImplementationType.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 61 61 } 62 62 63 void ImplementationType::visit(VoidType *voidType) { 64 } 65 66 void ImplementationType::visit(BasicType *basicType) { 67 } 63 void ImplementationType::visit( __attribute__((unused)) VoidType *voidType ) {} 64 void ImplementationType::visit( __attribute__((unused)) BasicType *basicType ) {} 68 65 69 66 void ImplementationType::visit(PointerType *pointerType) { … … 79 76 } 80 77 81 void ImplementationType::visit(FunctionType *functionType) { 82 /// FunctionType *newType = functionType->clone(); 83 /// for ( std::list< DeclarationWithType* >::iterator i = newType->get_parameters().begin(); i != newType->get_parameters().end(); ++i ) { 84 /// i->set_type( implementationType( i->get_type(), indexer ) ); 85 /// } 86 /// for ( std::list< DeclarationWithType* >::iterator i = newType->get_parameters().begin(); i != newType->get_parameters().end(); ++i ) { 87 /// i->set_type( implementationType( i->get_type(), indexer ) ); 88 /// } 89 } 90 91 void ImplementationType::visit(StructInstType *aggregateUseType) { 92 } 93 94 void ImplementationType::visit(UnionInstType *aggregateUseType) { 95 } 96 97 void ImplementationType::visit(EnumInstType *aggregateUseType) { 98 } 99 100 void ImplementationType::visit(TraitInstType *aggregateUseType) { 101 } 78 void ImplementationType::visit( __attribute__((unused)) FunctionType *functionType ) {} 79 void ImplementationType::visit( __attribute__((unused)) StructInstType * aggregateUseType ) {} 80 void ImplementationType::visit( __attribute__((unused)) UnionInstType * aggregateUseType ) {} 81 void ImplementationType::visit( __attribute__((unused)) EnumInstType * aggregateUseType ) {} 82 void ImplementationType::visit( __attribute__((unused)) TraitInstType * aggregateUseType ) {} 102 83 103 84 void ImplementationType::visit(TypeInstType *inst) { … … 111 92 112 93 void ImplementationType::visit(TupleType *tupleType) { 113 TupleType *newType = new TupleType( Type::Qualifiers() );94 std::list< Type * > types; 114 95 for ( std::list< Type* >::iterator i = tupleType->get_types().begin(); i != tupleType->get_types().end(); ++i ) { 115 96 Type *implType = implementationType( *i, indexer ); 116 97 implType->get_qualifiers() |= tupleType->get_qualifiers(); 117 newType->get_types().push_back( implType );98 types.push_back( implType ); 118 99 } // for 119 result = new Type;100 result = new TupleType( Type::Qualifiers(), types ); 120 101 } 121 102 122 void ImplementationType::visit(VarArgsType *varArgsType) { 123 } 124 125 void ImplementationType::visit(ZeroType *zeroType) { 126 } 127 128 void ImplementationType::visit(OneType *oneType) { 129 } 103 void ImplementationType::visit( __attribute__((unused)) VarArgsType *varArgsType ) {} 104 void ImplementationType::visit( __attribute__((unused)) ZeroType *zeroType ) {} 105 void ImplementationType::visit( __attribute__((unused)) OneType *oneType ) {} 130 106 } // namespace SymTab 131 107 -
src/SymTab/Indexer.cc
r9c951e3 rb1e63ac5 124 124 }; 125 125 // properties for this type 126 bool userDefinedFunc = false; // any user-defined function found 127 bool userDefinedCtor = false; // any user-defined constructor found 128 bool userDefinedDtor = false; // any user-defined destructor found 129 bool userDefinedCopyFunc = false; // user-defined copy ctor found 126 bool existsUserDefinedFunc = false; // any user-defined function found 127 bool existsUserDefinedCtor = false; // any user-defined constructor found 128 bool existsUserDefinedDtor = false; // any user-defined destructor found 129 bool existsUserDefinedCopyFunc = false; // user-defined copy ctor found 130 bool existsUserDefinedDefaultCtor = false; // user-defined default ctor found 130 131 std::list< DeclBall > decls; 131 132 … … 138 139 bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() ); 139 140 decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefaultCtor, isDtor, isCopyFunc } ); 140 userDefinedFunc = userDefinedFunc || isUserDefinedFunc; 141 userDefinedCtor = userDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) ); 142 userDefinedDtor = userDefinedDtor || (isUserDefinedFunc && isDtor); 143 userDefinedCopyFunc = userDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc); 141 existsUserDefinedFunc = existsUserDefinedFunc || isUserDefinedFunc; 142 existsUserDefinedCtor = existsUserDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) ); 143 existsUserDefinedDtor = existsUserDefinedDtor || (isUserDefinedFunc && isDtor); 144 existsUserDefinedCopyFunc = existsUserDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc); 145 existsUserDefinedDefaultCtor = existsUserDefinedDefaultCtor || (isUserDefinedFunc && isDefaultCtor); 144 146 return *this; 145 147 } … … 164 166 } 165 167 166 // if a type contains user defined ctor/dtor s, then special rules trigger, which determine167 // the set of ctor/dtor sthat are seen by the requester. In particular, if the user defines168 // if a type contains user defined ctor/dtor/assign, then special rules trigger, which determine 169 // the set of ctor/dtor/assign that are seen by the requester. In particular, if the user defines 168 170 // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor 169 171 // and dtor. If the user defines any ctor/dtor, then no generated field ctors should be seen. 170 // If the user defines any ctor then the generated default ctor should not be seen. 172 // If the user defines any ctor then the generated default ctor should not be seen (intrinsic default 173 // ctor must be overridden exactly). 171 174 for ( std::pair< const std::string, ValueType > & pair : funcMap ) { 172 175 ValueType & val = pair.second; 173 176 for ( ValueType::DeclBall ball : val.decls ) { 174 if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefinedCtor && ball.isDefaultCtor) || (! val.userDefinedCopyFunc && ball.isCopyFunc) || (! val.userDefinedDtor && ball.isDtor) ) { 177 bool noUserDefinedFunc = ! val.existsUserDefinedFunc; 178 bool isUserDefinedFunc = ball.isUserDefinedFunc; 179 bool isAcceptableDefaultCtor = (! val.existsUserDefinedCtor || (! val.existsUserDefinedDefaultCtor && ball.decl->get_linkage() == LinkageSpec::Intrinsic)) && ball.isDefaultCtor; // allow default constructors only when no user-defined constructors exist, except in the case of intrinsics, which require exact overrides 180 bool isAcceptableCopyFunc = ! val.existsUserDefinedCopyFunc && ball.isCopyFunc; // handles copy ctor and assignment operator 181 bool isAcceptableDtor = ! val.existsUserDefinedDtor && ball.isDtor; 182 if ( noUserDefinedFunc || isUserDefinedFunc || isAcceptableDefaultCtor || isAcceptableCopyFunc || isAcceptableDtor ) { 175 183 // decl conforms to the rules described above, so it should be seen by the requester 176 184 out.push_back( ball.decl ); … … 278 286 addType( typeDecl ); 279 287 acceptAll( typeDecl->get_assertions(), *this ); 288 acceptNewScope( typeDecl->get_init(), *this ); 280 289 } 281 290 … … 487 496 } 488 497 489 void Indexer::visit( UntypedValofExpr *valofExpr ) {490 acceptNewScope( valofExpr->get_result(), *this );491 maybeAccept( valofExpr->get_body(), *this );492 }493 494 498 void Indexer::visit( RangeExpr *rangeExpr ) { 495 499 maybeAccept( rangeExpr->get_low(), *this ); … … 510 514 acceptNewScope( tupleExpr->get_result(), *this ); 511 515 maybeAccept( tupleExpr->get_tuple(), *this ); 512 }513 514 void Indexer::visit( MemberTupleExpr *tupleExpr ) {515 acceptNewScope( tupleExpr->get_result(), *this );516 maybeAccept( tupleExpr->get_member(), *this );517 maybeAccept( tupleExpr->get_aggregate(), *this );518 516 } 519 517 -
src/SymTab/Indexer.h
r9c951e3 rb1e63ac5 69 69 virtual void visit( ConstructorExpr * ctorExpr ); 70 70 virtual void visit( CompoundLiteralExpr *compLitExpr ); 71 virtual void visit( UntypedValofExpr *valofExpr );72 71 virtual void visit( RangeExpr *rangeExpr ); 73 72 virtual void visit( UntypedTupleExpr *tupleExpr ); 74 73 virtual void visit( TupleExpr *tupleExpr ); 75 74 virtual void visit( TupleIndexExpr *tupleExpr ); 76 virtual void visit( MemberTupleExpr *tupleExpr );77 75 virtual void visit( TupleAssignExpr *tupleExpr ); 78 76 virtual void visit( StmtExpr * stmtExpr ); -
src/SymTab/Mangler.cc
r9c951e3 rb1e63ac5 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:40:29 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:40:01201713 // Update Count : 2 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:31:00 2017 13 // Update Count : 21 14 14 // 15 15 … … 72 72 } else { 73 73 // if we add another kind of overridable function, this has to change 74 assert( false );74 assert( false && "unknown overrideable linkage" ); 75 75 } // if 76 76 } … … 236 236 } 237 237 238 void Mangler::visit( ZeroType *zeroType ) {238 void Mangler::visit( __attribute__((unused)) ZeroType *zeroType ) { 239 239 mangleName << "Z"; 240 240 } 241 241 242 void Mangler::visit( OneType *oneType ) {242 void Mangler::visit( __attribute__((unused)) OneType *oneType ) { 243 243 mangleName << "O"; 244 244 } -
src/SymTab/Validate.cc
r9c951e3 rb1e63ac5 38 38 // definition occurs later in the input. 39 39 40 #include <algorithm> 41 #include <iterator> 40 42 #include <list> 41 #include <iterator> 43 44 #include "CodeGen/CodeGenerator.h" 45 46 #include "Common/PassVisitor.h" 42 47 #include "Common/ScopedMap.h" 48 #include "Common/UniqueName.h" 43 49 #include "Common/utility.h" 44 #include "Common/UniqueName.h" 50 45 51 #include "Concurrency/Keywords.h" 46 #include "Validate.h" 47 #include "SynTree/Visitor.h" 48 #include "SynTree/Mutator.h" 49 #include "SynTree/Type.h" 50 #include "SynTree/Expression.h" 51 #include "SynTree/Statement.h" 52 #include "SynTree/TypeSubstitution.h" 53 #include "Indexer.h" 52 53 #include "GenPoly/DeclMutator.h" 54 55 #include "InitTweak/InitTweak.h" 56 57 #include "AddVisit.h" 58 #include "Autogen.h" 54 59 #include "FixFunction.h" 55 60 // #include "ImplementationType.h" 56 #include "GenPoly/DeclMutator.h" 57 #include "AddVisit.h" 61 #include "Indexer.h" 58 62 #include "MakeLibCfa.h" 59 63 #include "TypeEquality.h" 60 #include "Autogen.h" 64 #include "Validate.h" 65 61 66 #include "ResolvExpr/typeops.h" 62 #include <algorithm> 63 #include "InitTweak/InitTweak.h" 64 #include "CodeGen/CodeGenerator.h" 67 68 #include "SynTree/Attribute.h" 69 #include "SynTree/Expression.h" 70 #include "SynTree/Mutator.h" 71 #include "SynTree/Statement.h" 72 #include "SynTree/Type.h" 73 #include "SynTree/TypeSubstitution.h" 74 #include "SynTree/Visitor.h" 65 75 66 76 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } … … 96 106 97 107 /// Fix return types so that every function returns exactly one value 98 class ReturnTypeFixer final : public Visitor { 99 public: 100 typedef Visitor Parent; 101 using Parent::visit; 102 108 struct ReturnTypeFixer { 103 109 static void fix( std::list< Declaration * > &translationUnit ); 104 110 105 v irtual voidvisit( FunctionDecl * functionDecl );106 v irtual voidvisit( FunctionType * ftype );111 void postvisit( FunctionDecl * functionDecl ); 112 void postvisit( FunctionType * ftype ); 107 113 }; 108 114 109 115 /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers. 110 class EnumAndPointerDecayPass final : public Visitor { 111 typedef Visitor Parent; 112 virtual void visit( EnumDecl *aggregateDecl ); 113 virtual void visit( FunctionType *func ); 116 struct EnumAndPointerDecay { 117 void previsit( EnumDecl *aggregateDecl ); 118 void previsit( FunctionType *func ); 114 119 }; 115 120 … … 119 124 public: 120 125 LinkReferenceToTypes( bool doDebug, const Indexer *indexer ); 121 private:122 126 using Parent::visit; 123 127 void visit( EnumInstType *enumInst ) final; … … 129 133 void visit( UnionDecl *unionDecl ) final; 130 134 void visit( TypeInstType *typeInst ) final; 131 135 private: 132 136 const Indexer *indexer; 133 137 … … 140 144 }; 141 145 142 /// Replaces array and function types in forall lists by appropriate pointer type 143 class Pass3final : public Indexer {146 /// Replaces array and function types in forall lists by appropriate pointer type and assigns each Object and Function declaration a unique ID. 147 class ForallPointerDecay final : public Indexer { 144 148 typedef Indexer Parent; 145 149 public: 146 150 using Parent::visit; 147 Pass3( const Indexer *indexer );148 private: 151 ForallPointerDecay( const Indexer *indexer ); 152 149 153 virtual void visit( ObjectDecl *object ) override; 150 154 virtual void visit( FunctionDecl *func ) override; … … 153 157 }; 154 158 155 class ReturnChecker : public Visitor { 156 public: 159 struct ReturnChecker : public WithGuards { 157 160 /// Checks that return statements return nothing if their return type is void 158 161 /// and return something if the return type is non-void. 159 162 static void checkFunctionReturns( std::list< Declaration * > & translationUnit ); 160 private: 161 virtual void visit( FunctionDecl * functionDecl ); 162 virtual void visit( ReturnStmt * returnStmt ); 163 164 std::list< DeclarationWithType * > returnVals; 163 164 void previsit( FunctionDecl * functionDecl ); 165 void previsit( ReturnStmt * returnStmt ); 166 167 typedef std::list< DeclarationWithType * > ReturnVals; 168 ReturnVals returnVals; 165 169 }; 166 170 … … 198 202 }; 199 203 200 class VerifyCtorDtorAssign : public Visitor { 201 public: 204 struct VerifyCtorDtorAssign { 202 205 /// ensure that constructors, destructors, and assignment have at least one 203 206 /// parameter, the first of which must be a pointer, and that ctor/dtors have no … … 205 208 static void verify( std::list< Declaration * > &translationUnit ); 206 209 207 virtual void visit( FunctionDecl *funcDecl ); 208 }; 209 210 class ArrayLength : public Visitor { 211 public: 210 void previsit( FunctionDecl *funcDecl ); 211 }; 212 213 /// ensure that generic types have the correct number of type arguments 214 struct ValidateGenericParameters { 215 void previsit( StructInstType * inst ); 216 void previsit( UnionInstType * inst ); 217 }; 218 219 struct ArrayLength { 212 220 /// for array types without an explicit length, compute the length and store it so that it 213 221 /// is known to the rest of the phases. For example, … … 219 227 static void computeLength( std::list< Declaration * > & translationUnit ); 220 228 221 v irtual voidvisit( ObjectDecl * objDecl );222 }; 223 224 class CompoundLiteral final : public GenPoly::DeclMutator{229 void previsit( ObjectDecl * objDecl ); 230 }; 231 232 struct CompoundLiteral final : public WithDeclsToAdd, public WithVisitorRef<CompoundLiteral> { 225 233 Type::StorageClasses storageClasses; 226 234 227 using GenPoly::DeclMutator::mutate; 228 DeclarationWithType * mutate( ObjectDecl *objectDecl ) final; 229 Expression *mutate( CompoundLiteralExpr *compLitExpr ) final; 235 void premutate( ObjectDecl *objectDecl ); 236 Expression * postmutate( CompoundLiteralExpr *compLitExpr ); 230 237 }; 231 238 232 239 void validate( std::list< Declaration * > &translationUnit, bool doDebug ) { 233 EnumAndPointerDecayPassepc;240 PassVisitor<EnumAndPointerDecay> epc; 234 241 LinkReferenceToTypes lrt( doDebug, 0 ); 235 Pass3 pass3( 0 );236 CompoundLiteralcompoundliteral;237 238 HoistStruct::hoistStruct( translationUnit ); 242 ForallPointerDecay fpd( 0 ); 243 PassVisitor<CompoundLiteral> compoundliteral; 244 PassVisitor<ValidateGenericParameters> genericParams; 245 239 246 EliminateTypedef::eliminateTypedef( translationUnit ); 247 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 240 248 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 241 249 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 250 acceptAll( translationUnit, genericParams ); // check as early as possible - can't happen before LinkReferenceToTypes 242 251 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist 243 252 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors 244 253 Concurrency::applyKeywords( translationUnit ); 245 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay Pass254 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay 246 255 Concurrency::implementMutexFuncs( translationUnit ); 247 256 Concurrency::implementThreadStarter( translationUnit ); 248 257 ReturnChecker::checkFunctionReturns( translationUnit ); 249 compoundliteral.mutateDeclarationList( translationUnit);250 acceptAll( translationUnit, pass3);258 mutateAll( translationUnit, compoundliteral ); 259 acceptAll( translationUnit, fpd ); 251 260 ArrayLength::computeLength( translationUnit ); 252 261 } 253 262 254 263 void validateType( Type *type, const Indexer *indexer ) { 255 EnumAndPointerDecayPassepc;264 PassVisitor<EnumAndPointerDecay> epc; 256 265 LinkReferenceToTypes lrt( false, indexer ); 257 Pass3 pass3( indexer );266 ForallPointerDecay fpd( indexer ); 258 267 type->accept( epc ); 259 268 type->accept( lrt ); 260 type->accept( pass3);269 type->accept( fpd ); 261 270 } 262 271 … … 337 346 } 338 347 339 void EnumAndPointerDecay Pass::visit( EnumDecl *enumDecl ) {348 void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) { 340 349 // Set the type of each member of the enumeration to be EnumConstant 341 350 for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) { … … 344 353 obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) ); 345 354 } // for 346 Parent::visit( enumDecl );347 355 } 348 356 … … 351 359 void fixFunctionList( DWTList & dwts, FunctionType * func ) { 352 360 // the only case in which "void" is valid is where it is the only one in the list; then it should be removed 353 // entirely other fix ups are handled by the FixFunction class361 // entirely. other fix ups are handled by the FixFunction class 354 362 typedef typename DWTList::iterator DWTIterator; 355 363 DWTIterator begin( dwts.begin() ), end( dwts.end() ); … … 370 378 for ( ; i != end; ++i ) { 371 379 FixFunction fixer; 372 *i = (*i )->acceptMutator( fixer );380 *i = (*i)->acceptMutator( fixer ); 373 381 if ( fixer.get_isVoid() ) { 374 382 throw SemanticError( "invalid type void in function type ", func ); … … 379 387 } 380 388 381 void EnumAndPointerDecay Pass::visit( FunctionType *func ) {389 void EnumAndPointerDecay::previsit( FunctionType *func ) { 382 390 // Fix up parameters and return types 383 391 fixFunctionList( func->get_parameters(), func ); 384 392 fixFunctionList( func->get_returnVals(), func ); 385 Visitor::visit( func );386 393 } 387 394 … … 496 503 void LinkReferenceToTypes::visit( StructDecl *structDecl ) { 497 504 // visit struct members first so that the types of self-referencing members are updated properly 505 // xxx - need to ensure that type parameters match up between forward declarations and definition (most importantly, number of type parameters and and their defaults) 498 506 Parent::visit( structDecl ); 499 507 if ( ! structDecl->get_members().empty() ) { … … 529 537 } 530 538 531 Pass3::Pass3( const Indexer *other_indexer ) : Indexer( false ) {539 ForallPointerDecay::ForallPointerDecay( const Indexer *other_indexer ) : Indexer( false ) { 532 540 if ( other_indexer ) { 533 541 indexer = other_indexer; … … 567 575 } 568 576 569 void Pass3::visit( ObjectDecl *object ) {577 void ForallPointerDecay::visit( ObjectDecl *object ) { 570 578 forallFixer( object->get_type() ); 571 579 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) { … … 576 584 } 577 585 578 void Pass3::visit( FunctionDecl *func ) {586 void ForallPointerDecay::visit( FunctionDecl *func ) { 579 587 forallFixer( func->get_type() ); 580 588 Parent::visit( func ); … … 583 591 584 592 void ReturnChecker::checkFunctionReturns( std::list< Declaration * > & translationUnit ) { 585 ReturnCheckerchecker;593 PassVisitor<ReturnChecker> checker; 586 594 acceptAll( translationUnit, checker ); 587 595 } 588 596 589 void ReturnChecker:: visit( FunctionDecl * functionDecl ) {590 std::list< DeclarationWithType * > oldReturnVals = returnVals;597 void ReturnChecker::previsit( FunctionDecl * functionDecl ) { 598 GuardValue( returnVals ); 591 599 returnVals = functionDecl->get_functionType()->get_returnVals(); 592 Visitor::visit( functionDecl ); 593 returnVals = oldReturnVals; 594 } 595 596 void ReturnChecker::visit( ReturnStmt * returnStmt ) { 600 } 601 602 void ReturnChecker::previsit( ReturnStmt * returnStmt ) { 597 603 // Previously this also checked for the existence of an expr paired with no return values on 598 604 // the function return type. This is incorrect, since you can have an expression attached to … … 804 810 805 811 void VerifyCtorDtorAssign::verify( std::list< Declaration * > & translationUnit ) { 806 VerifyCtorDtorAssignverifier;812 PassVisitor<VerifyCtorDtorAssign> verifier; 807 813 acceptAll( translationUnit, verifier ); 808 814 } 809 815 810 void VerifyCtorDtorAssign:: visit( FunctionDecl * funcDecl ) {816 void VerifyCtorDtorAssign::previsit( FunctionDecl * funcDecl ) { 811 817 FunctionType * funcType = funcDecl->get_functionType(); 812 818 std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals(); … … 826 832 } 827 833 } 828 829 Visitor::visit( funcDecl ); 830 } 831 832 DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) { 834 } 835 836 template< typename Aggr > 837 void validateGeneric( Aggr * inst ) { 838 std::list< TypeDecl * > * params = inst->get_baseParameters(); 839 if ( params != NULL ) { 840 std::list< Expression * > & args = inst->get_parameters(); 841 842 // insert defaults arguments when a type argument is missing (currently only supports missing arguments at the end of the list). 843 // A substitution is used to ensure that defaults are replaced correctly, e.g., 844 // forall(otype T, otype alloc = heap_allocator(T)) struct vector; 845 // vector(int) v; 846 // after insertion of default values becomes 847 // vector(int, heap_allocator(T)) 848 // and the substitution is built with T=int so that after substitution, the result is 849 // vector(int, heap_allocator(int)) 850 TypeSubstitution sub; 851 auto paramIter = params->begin(); 852 for ( size_t i = 0; paramIter != params->end(); ++paramIter, ++i ) { 853 if ( i < args.size() ) { 854 TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) ); 855 sub.add( (*paramIter)->get_name(), expr->get_type()->clone() ); 856 } else if ( i == args.size() ) { 857 Type * defaultType = (*paramIter)->get_init(); 858 if ( defaultType ) { 859 args.push_back( new TypeExpr( defaultType->clone() ) ); 860 sub.add( (*paramIter)->get_name(), defaultType->clone() ); 861 } 862 } 863 } 864 865 sub.apply( inst ); 866 if ( args.size() < params->size() ) throw SemanticError( "Too few type arguments in generic type ", inst ); 867 if ( args.size() > params->size() ) throw SemanticError( "Too many type arguments in generic type ", inst ); 868 } 869 } 870 871 void ValidateGenericParameters::previsit( StructInstType * inst ) { 872 validateGeneric( inst ); 873 } 874 875 void ValidateGenericParameters::previsit( UnionInstType * inst ) { 876 validateGeneric( inst ); 877 } 878 879 void CompoundLiteral::premutate( ObjectDecl *objectDecl ) { 833 880 storageClasses = objectDecl->get_storageClasses(); 834 DeclarationWithType * temp = Mutator::mutate( objectDecl ); 835 return temp; 836 } 837 838 Expression *CompoundLiteral::mutate( CompoundLiteralExpr *compLitExpr ) { 881 } 882 883 Expression *CompoundLiteral::postmutate( CompoundLiteralExpr *compLitExpr ) { 839 884 // transform [storage_class] ... (struct S){ 3, ... }; 840 885 // into [storage_class] struct S temp = { 3, ... }; 841 886 static UniqueName indexName( "_compLit" ); 842 887 843 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_result(), compLitExpr->get_initializer() );844 compLitExpr->set_result( 0);845 compLitExpr->set_initializer( 0);888 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() ); 889 compLitExpr->set_result( nullptr ); 890 compLitExpr->set_initializer( nullptr ); 846 891 delete compLitExpr; 847 DeclarationWithType * newtempvar = mutate( tempvar ); 848 addDeclaration( newtempvar ); // add modified temporary to current block 849 return new VariableExpr( newtempvar ); 892 declsToAddBefore.push_back( tempvar ); // add modified temporary to current block 893 return new VariableExpr( tempvar ); 850 894 } 851 895 852 896 void ReturnTypeFixer::fix( std::list< Declaration * > &translationUnit ) { 853 ReturnTypeFixerfixer;897 PassVisitor<ReturnTypeFixer> fixer; 854 898 acceptAll( translationUnit, fixer ); 855 899 } 856 900 857 void ReturnTypeFixer::visit( FunctionDecl * functionDecl ) { 858 Parent::visit( functionDecl ); 901 void ReturnTypeFixer::postvisit( FunctionDecl * functionDecl ) { 859 902 FunctionType * ftype = functionDecl->get_functionType(); 860 903 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals(); … … 867 910 ret->set_name( toString( "_retval_", CodeGen::genName( functionDecl ) ) ); 868 911 } 869 } 870 } 871 872 void ReturnTypeFixer::visit( FunctionType * ftype ) { 912 ret->get_attributes().push_back( new Attribute( "unused" ) ); 913 } 914 } 915 916 void ReturnTypeFixer::postvisit( FunctionType * ftype ) { 873 917 // xxx - need to handle named return values - this information needs to be saved somehow 874 918 // so that resolution has access to the names. … … 888 932 889 933 void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) { 890 ArrayLengthlen;934 PassVisitor<ArrayLength> len; 891 935 acceptAll( translationUnit, len ); 892 936 } 893 937 894 void ArrayLength:: visit( ObjectDecl * objDecl ) {938 void ArrayLength::previsit( ObjectDecl * objDecl ) { 895 939 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 896 940 if ( at->get_dimension() != nullptr ) return; -
src/SynTree/AggregateDecl.cc
r9c951e3 rb1e63ac5 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 23:56:39 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T hu Mar 16 07:49:07201713 // Update Count : 2 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:30:00 2017 13 // Update Count : 21 14 14 // 15 15 … … 20 20 21 21 22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall), body( false ), attributes( attributes ) {22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) { 23 23 } 24 24 -
src/SynTree/Attribute.h
r9c951e3 rb1e63ac5 40 40 }; 41 41 42 const std::list< Attribute * > noAttributes; 43 42 44 #endif 43 45 -
src/SynTree/BaseSyntaxNode.h
r9c951e3 rb1e63ac5 24 24 CodeLocation location; 25 25 26 virtual void accept( Visitor & v ) = 0; // temporary -- needs to be here so that BaseSyntaxNode is polymorphic and can be dynamic_cast 26 virtual ~BaseSyntaxNode() {} 27 28 virtual void accept( Visitor & v ) = 0; 27 29 }; 28 30 -
src/SynTree/Constant.cc
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Constant.cc -- 7 // Constant.cc -- 8 8 // 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 : Th u Jul 30 15:18:38 201513 // Update Count : 1211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:11:00 2017 13 // Update Count : 28 14 14 // 15 15 … … 21 21 #include "Type.h" 22 22 23 Constant::Constant( Type *type_, std::string value_ ) : type( type_ ), value( value_ ) {} 23 Constant::Constant( Type * type, std::string rep, unsigned long long val ) : type( type ), rep( rep ), val( val ) {} 24 Constant::Constant( Type * type, std::string rep, double val ) : type( type ), rep( rep ), val( val ) {} 24 25 25 Constant::Constant( const Constant &other ) {26 Constant::Constant( const Constant &other ) : rep( other.rep ), val( other.val ) { 26 27 type = other.type->clone(); 27 value = other.value;28 28 } 29 29 30 30 Constant::~Constant() { delete type; } 31 31 32 Constant Constant::from_bool( bool b ) { 33 return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b ); 34 } 35 32 36 Constant Constant::from_int( int i ) { 33 return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) );37 return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ), (unsigned long long int)i ); 34 38 } 35 39 36 40 Constant Constant::from_ulong( unsigned long i ) { 37 return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) );41 return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ), (unsigned long long int)i ); 38 42 } 39 43 40 44 Constant Constant::from_double( double d ) { 41 return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) );45 return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ), d ); 42 46 } 43 47 44 Constant *Constant::clone() const { assert( false ); return 0; } 48 unsigned long long Constant::get_ival() const { 49 assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); 50 return val.ival; 51 } 52 53 double Constant::get_dval() const { 54 assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." ); 55 return val.dval; 56 } 45 57 46 58 void Constant::print( std::ostream &os ) const { 47 os << "(" << value;59 os << "(" << rep << " " << val.ival; 48 60 if ( type ) { 49 61 os << ": "; -
src/SynTree/Constant.h
r9c951e3 rb1e63ac5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Constant.h -- 7 // Constant.h -- 8 8 // 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 : Th u Jun 30 13:33:17 201613 // Update Count : 611 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:13:00 2017 13 // Update Count : 15 14 14 // 15 15 … … 23 23 class Constant { 24 24 public: 25 Constant( Type *type, std::string value ); 26 Constant( const Constant &other ); 25 Constant( Type * type, std::string rep, unsigned long long val ); 26 Constant( Type * type, std::string rep, double val ); 27 Constant( const Constant & other ); 27 28 virtual ~Constant(); 28 29 29 Type *get_type() { return type; } 30 void set_type( Type *newValue ) { type = newValue; } 31 std::string &get_value() { return value; } 32 void set_value( std::string newValue ) { value = newValue; } 30 Type * get_type() { return type; } 31 void set_type( Type * newValue ) { type = newValue; } 32 std::string & get_value() { return rep; } 33 void set_value( std::string newValue ) { rep = newValue; } 34 unsigned long long get_ival() const; 35 double get_dval() const; 33 36 37 /// generates a boolean constant of the given bool 38 static Constant from_bool( bool b ); 34 39 /// generates an integer constant of the given int 35 40 static Constant from_int( int i ); … … 39 44 static Constant from_double( double d ); 40 45 41 virtual Constant *clone() const; 42 virtual void accept( Visitor &v ) { v.visit( this ); } 43 virtual Constant *acceptMutator( Mutator &m ) { return m.mutate( this ); } 44 virtual void print( std::ostream &os ) const; 46 virtual void accept( Visitor & v ) { v.visit( this ); } 47 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } 48 virtual void print( std::ostream & os ) const; 45 49 private: 46 Type *type; 47 std::string value; 50 Type * type; 51 std::string rep; 52 union Val { 53 unsigned long long ival; 54 double dval; 55 Val( unsigned long long ival ) : ival( ival ) {} 56 Val( double dval ) : dval( dval ) {} 57 } val; 48 58 }; 49 59 -
src/SynTree/Declaration.h
r9c951e3 rb1e63ac5 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 : Fri Mar 17 16:05:08201713 // Update Count : 12 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 2017 13 // Update Count : 122 14 14 // 15 15 … … 194 194 }; 195 195 196 TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind );196 TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init = nullptr ); 197 197 TypeDecl( const TypeDecl &other ); 198 virtual ~TypeDecl(); 198 199 199 200 Kind get_kind() const { return kind; } 201 202 Type * get_init() const { return init; } 203 TypeDecl * set_init( Type * newValue ) { init = newValue; return this; } 200 204 201 205 bool isComplete() const { return kind == Any || sized; } … … 209 213 virtual void accept( Visitor &v ) { v.visit( this ); } 210 214 virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } 215 virtual void print( std::ostream &os, int indent = 0 ) const; 216 211 217 private: 212 218 Kind kind; 219 Type * init; 213 220 bool sized; 214 221 }; … … 231 238 typedef Declaration Parent; 232 239 public: 233 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );240 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); 234 241 AggregateDecl( const AggregateDecl &other ); 235 242 virtual ~AggregateDecl(); … … 259 266 typedef AggregateDecl Parent; 260 267 public: 261 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes), kind( kind ) {}268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 262 269 StructDecl( const StructDecl &other ) : Parent( other ) {} 263 270 … … 277 284 typedef AggregateDecl Parent; 278 285 public: 279 UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes) {}286 UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} 280 287 UnionDecl( const UnionDecl &other ) : Parent( other ) {} 281 288 … … 290 297 typedef AggregateDecl Parent; 291 298 public: 292 EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes) {}299 EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} 293 300 EnumDecl( const EnumDecl &other ) : Parent( other ) {} 294 301 -
src/SynTree/Expression.cc
r9c951e3 rb1e63ac5 21 21 #include <iterator> 22 22 23 #include "Declaration.h" 24 #include "Expression.h" 25 #include "Initializer.h" 26 #include "Statement.h" 23 27 #include "Type.h" 24 #include "Initializer.h"25 #include "Expression.h"26 #include "Declaration.h"27 #include "Statement.h"28 28 #include "TypeSubstitution.h" 29 #include "VarExprReplacer.h" 30 29 31 #include "Common/utility.h" 32 #include "Common/PassVisitor.h" 33 30 34 #include "InitTweak/InitTweak.h" 31 35 … … 92 96 93 97 Declaration *decl = get_var(); 94 // if ( decl != 0) decl->print(os, indent + 2);95 98 if ( decl != 0) decl->printShort(os, indent + 2); 96 99 os << std::endl; … … 287 290 delete arg; 288 291 } 289 290 // CastExpr *CastExpr::clone() const { return 0; }291 292 292 293 void CastExpr::print( std::ostream &os, int indent ) const { … … 355 356 } 356 357 357 //// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned...358 358 MemberExpr::MemberExpr( const MemberExpr &other ) : 359 359 Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) { … … 361 361 362 362 MemberExpr::~MemberExpr() { 363 // d elete member;363 // don't delete the member declaration, since it points somewhere else in the tree 364 364 delete aggregate; 365 365 } … … 591 591 } 592 592 593 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}594 595 UntypedValofExpr::~UntypedValofExpr() { delete body; }596 597 void UntypedValofExpr::print( std::ostream &os, int indent ) const {598 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl;599 if ( get_body() != 0 )600 get_body()->print( os, indent + 2 );601 }602 603 593 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {} 604 594 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {} … … 670 660 } 671 661 662 InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {} 663 InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {} 664 InitAlternative::~InitAlternative() { 665 delete type; 666 delete designation; 667 } 668 669 UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {} 670 UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {} 671 UntypedInitExpr::~UntypedInitExpr() { 672 delete expr; 673 } 674 675 void UntypedInitExpr::print( std::ostream & os, int indent ) const { 676 os << "Untyped Init Expression" << std::endl << std::string( indent+2, ' ' ); 677 expr->print( os, indent+2 ); 678 if ( ! initAlts.empty() ) { 679 for ( const InitAlternative & alt : initAlts ) { 680 os << std::string( indent+2, ' ' ) << "InitAlternative: "; 681 alt.type->print( os, indent+2 ); 682 alt.designation->print( os, indent+2 ); 683 } 684 } 685 } 686 687 InitExpr::InitExpr( Expression * expr, Designation * designation ) : expr( expr ), designation( designation ) { 688 set_result( expr->get_result()->clone() ); 689 } 690 InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {} 691 InitExpr::~InitExpr() { 692 delete expr; 693 delete designation; 694 } 695 696 void InitExpr::print( std::ostream & os, int indent ) const { 697 os << "Init Expression" << std::endl << std::string( indent+2, ' ' ); 698 expr->print( os, indent+2 ); 699 os << std::string( indent+2, ' ' ) << "with designation: "; 700 designation->print( os, indent+2 ); 701 } 702 703 672 704 std::ostream & operator<<( std::ostream & out, const Expression * expr ) { 673 705 if ( expr ) { -
src/SynTree/Expression.h
r9c951e3 rb1e63ac5 226 226 }; 227 227 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer. 229 /// Does not take ownership of member. 229 230 class MemberExpr : public Expression { 230 231 public: … … 247 248 }; 248 249 249 /// VariableExpr represents an expression that simply refers to the value of a named variable 250 /// VariableExpr represents an expression that simply refers to the value of a named variable. 251 /// Does not take ownership of var. 250 252 class VariableExpr : public Expression { 251 253 public: … … 598 600 }; 599 601 600 /// ValofExpr represents a GCC 'lambda expression'601 class UntypedValofExpr : public Expression {602 public:603 UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}604 UntypedValofExpr( const UntypedValofExpr & other );605 virtual ~UntypedValofExpr();606 607 Expression * get_value();608 Statement * get_body() const { return body; }609 610 virtual UntypedValofExpr * clone() const { return new UntypedValofExpr( * this ); }611 virtual void accept( Visitor & v ) { v.visit( this ); }612 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }613 virtual void print( std::ostream & os, int indent = 0 ) const;614 private:615 Statement * body;616 };617 618 602 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10' 619 603 class RangeExpr : public Expression { … … 688 672 Expression * tuple; 689 673 unsigned int index; 690 };691 692 /// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer693 class MemberTupleExpr : public Expression {694 public:695 MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );696 MemberTupleExpr( const MemberTupleExpr & other );697 virtual ~MemberTupleExpr();698 699 Expression * get_member() const { return member; }700 Expression * get_aggregate() const { return aggregate; }701 MemberTupleExpr * set_member( Expression * newValue ) { member = newValue; return this; }702 MemberTupleExpr * set_aggregate( Expression * newValue ) { aggregate = newValue; return this; }703 704 virtual MemberTupleExpr * clone() const { return new MemberTupleExpr( * this ); }705 virtual void accept( Visitor & v ) { v.visit( this ); }706 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }707 virtual void print( std::ostream & os, int indent = 0 ) const;708 private:709 Expression * member;710 Expression * aggregate;711 674 }; 712 675 … … 781 744 }; 782 745 746 struct InitAlternative { 747 public: 748 Type * type = nullptr; 749 Designation * designation = nullptr; 750 InitAlternative( Type * type, Designation * designation ); 751 InitAlternative( const InitAlternative & other ); 752 InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it 753 ~InitAlternative(); 754 }; 755 756 class UntypedInitExpr : public Expression { 757 public: 758 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ); 759 UntypedInitExpr( const UntypedInitExpr & other ); 760 ~UntypedInitExpr(); 761 762 Expression * get_expr() const { return expr; } 763 UntypedInitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; } 764 765 std::list<InitAlternative> & get_initAlts() { return initAlts; } 766 767 virtual UntypedInitExpr * clone() const { return new UntypedInitExpr( * this ); } 768 virtual void accept( Visitor & v ) { v.visit( this ); } 769 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 770 virtual void print( std::ostream & os, int indent = 0 ) const; 771 private: 772 Expression * expr; 773 std::list<InitAlternative> initAlts; 774 }; 775 776 class InitExpr : public Expression { 777 public: 778 InitExpr( Expression * expr, Designation * designation ); 779 InitExpr( const InitExpr & other ); 780 ~InitExpr(); 781 782 Expression * get_expr() const { return expr; } 783 InitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; } 784 785 Designation * get_designation() const { return designation; } 786 InitExpr * set_designation( Designation * newValue ) { designation = newValue; return this; } 787 788 virtual InitExpr * clone() const { return new InitExpr( * this ); } 789 virtual void accept( Visitor & v ) { v.visit( this ); } 790 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 791 virtual void print( std::ostream & os, int indent = 0 ) const; 792 private: 793 Expression * expr; 794 Designation * designation; 795 }; 796 797 783 798 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 784 799 -
src/SynTree/Initializer.cc
r9c951e3 rb1e63ac5 19 19 #include "Common/utility.h" 20 20 21 Designation::Designation( const std::list< Expression * > & designators ) : designators( designators ) {} 22 Designation::Designation( const Designation & other ) : BaseSyntaxNode( other ) { 23 // std::cerr << "cloning designation" << std::endl; 24 cloneAll( other.designators, designators ); 25 // std::cerr << "finished cloning designation" << std::endl; 26 } 27 28 Designation::~Designation() { 29 // std::cerr << "destroying designation" << std::endl; 30 deleteAll( designators ); 31 // std::cerr << "finished destroying designation" << std::endl; 32 } 33 34 void Designation::print( std::ostream &os, int indent ) const { 35 if ( ! designators.empty() ) { 36 os << std::string(indent + 2, ' ' ) << "designated by: " << std::endl; 37 for ( std::list < Expression * >::const_iterator i = designators.begin(); i != designators.end(); i++ ) { 38 os << std::string(indent + 4, ' ' ); 39 ( *i )->print(os, indent + 4 ); 40 } 41 os << std::endl; 42 } // if 43 } 44 21 45 Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {} 22 46 Initializer::Initializer( const Initializer & other ) : BaseSyntaxNode( other ), maybeConstructed( other.maybeConstructed ) { 23 47 } 24 25 26 48 Initializer::~Initializer() {} 27 49 28 std::string Initializer::designator_name( Expression *des ) { 29 if ( NameExpr *n = dynamic_cast<NameExpr *>(des) ) 30 return n->get_name(); 31 else 32 throw 0; 33 } 34 35 void Initializer::print( std::ostream &os, int indent ) {} 36 37 SingleInit::SingleInit( Expression *v, const std::list< Expression *> &_designators, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ), designators( _designators ) { 50 SingleInit::SingleInit( Expression *v, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ) { 38 51 } 39 52 40 53 SingleInit::SingleInit( const SingleInit &other ) : Initializer(other), value ( maybeClone( other.value ) ) { 41 cloneAll(other.designators, designators );42 54 } 43 55 44 56 SingleInit::~SingleInit() { 45 57 delete value; 46 deleteAll(designators);47 58 } 48 59 49 void SingleInit::print( std::ostream &os, int indent ) {50 os << std:: endl << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;60 void SingleInit::print( std::ostream &os, int indent ) const { 61 os << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl; 51 62 os << std::string(indent+4, ' ' ); 52 63 value->print( os, indent+4 ); 53 54 if ( ! designators.empty() ) {55 os << std::endl << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;56 for ( std::list < Expression * >::iterator i = designators.begin(); i != designators.end(); i++ ) {57 os << std::string(indent + 4, ' ' );58 ( *i )->print(os, indent + 4 );59 }60 } // if61 64 } 62 65 63 ListInit::ListInit( const std::list<Initializer*> &_initializers, const std::list<Expression *> &_designators, bool maybeConstructed ) 64 : Initializer( maybeConstructed ), initializers( _initializers ), designators( _designators ) { 66 67 ListInit::ListInit( const std::list<Initializer*> &inits, const std::list<Designation *> &des, bool maybeConstructed ) 68 : Initializer( maybeConstructed ), initializers( inits ), designations( des ) { 69 // handle the common case where a ListInit is created without designations by making a list of empty designations with the same length as the initializer 70 if ( designations.empty() ) { 71 for ( auto & i : initializers ) { 72 (void)i; 73 designations.push_back( new Designation( {} ) ); 74 } 75 } 76 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%d) and designations (%d)", initializers.size(), designations.size() ); 65 77 } 66 78 67 79 ListInit::ListInit( const ListInit & other ) : Initializer( other ) { 68 80 cloneAll( other.initializers, initializers ); 69 cloneAll( other.designat ors, designators );81 cloneAll( other.designations, designations ); 70 82 } 71 72 83 73 84 ListInit::~ListInit() { 74 85 deleteAll( initializers ); 75 deleteAll( designat ors );86 deleteAll( designations ); 76 87 } 77 88 78 void ListInit::print( std::ostream &os, int indent ) { 79 os << std::endl << std::string(indent, ' ') << "Compound initializer: "; 80 if ( ! designators.empty() ) { 81 os << std::string(indent + 2, ' ' ) << "designated by: ["; 82 for ( std::list < Expression * >::iterator i = designators.begin(); 83 i != designators.end(); i++ ) { 84 ( *i )->print(os, indent + 4 ); 85 } // for 89 void ListInit::print( std::ostream &os, int indent ) const { 90 os << std::string(indent, ' ') << "Compound initializer: " << std::endl; 91 for ( Designation * d : designations ) { 92 d->print( os, indent + 2 ); 93 } 86 94 87 os << std::string(indent + 2, ' ' ) << "]"; 88 } // if 89 90 for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 91 (*i)->print( os, indent + 2 ); 95 for ( const Initializer * init : initializers ) { 96 init->print( os, indent + 2 ); 97 os << std::endl; 98 } 92 99 } 93 100 … … 103 110 } 104 111 105 void ConstructorInit::print( std::ostream &os, int indent ) {112 void ConstructorInit::print( std::ostream &os, int indent ) const { 106 113 os << std::endl << std::string(indent, ' ') << "Constructor initializer: " << std::endl; 107 114 if ( ctor ) { … … 124 131 } 125 132 126 std::ostream & operator<<( std::ostream & out, Initializer * init ) { 127 init->print( out ); 133 std::ostream & operator<<( std::ostream & out, const Initializer * init ) { 134 if ( init ) { 135 init->print( out ); 136 } else { 137 out << "nullptr"; 138 } 139 return out; 140 } 141 142 std::ostream & operator<<( std::ostream & out, const Designation * des ) { 143 if ( des ) { 144 des->print( out ); 145 } else { 146 out << "nullptr"; 147 } 128 148 return out; 129 149 } -
src/SynTree/Initializer.h
r9c951e3 rb1e63ac5 25 25 #include "Visitor.h" 26 26 27 const std::list<Expression*> noDesignators; 27 // Designation: list of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an object being initialized. 28 class Designation : public BaseSyntaxNode { 29 public: 30 Designation( const std::list< Expression * > & designators ); 31 Designation( const Designation & other ); 32 virtual ~Designation(); 33 34 std::list< Expression * > & get_designators() { return designators; } 35 36 virtual Designation * clone() const { return new Designation( *this ); }; 37 virtual void accept( Visitor &v ) { v.visit( this ); } 38 virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); } 39 virtual void print( std::ostream &os, int indent = 0 ) const; 40 private: 41 std::list< Expression * > designators; 42 }; 43 44 const std::list<Designation *> noDesignators; 28 45 29 46 // Initializer: base class for object initializers (provide default values) 30 47 class Initializer : public BaseSyntaxNode { 31 48 public: 32 // Initializer( std::string _name = std::string(""), int _pos = 0 );33 49 Initializer( bool maybeConstructed ); 34 50 Initializer( const Initializer & other ); 35 51 virtual ~Initializer(); 36 37 static std::string designator_name( Expression *designator );38 39 // void set_name( std::string newValue ) { name = newValue; }40 // std::string get_name() const { return name; }41 42 // void set_pos( int newValue ) { pos = newValue; }43 // int get_pos() const { return pos; }44 virtual void set_designators( std::list<Expression *> & ) { assert(false); }45 virtual std::list<Expression *> &get_designators() {46 assert(false);47 std::list<Expression *> *ret = 0; return *ret; // never reached48 }49 52 50 53 bool get_maybeConstructed() { return maybeConstructed; } … … 53 56 virtual void accept( Visitor &v ) = 0; 54 57 virtual Initializer *acceptMutator( Mutator &m ) = 0; 55 virtual void print( std::ostream &os, int indent = 0 ) ;58 virtual void print( std::ostream &os, int indent = 0 ) const = 0; 56 59 private: 57 // std::string name;58 // int pos;59 60 bool maybeConstructed; 60 61 }; … … 63 64 class SingleInit : public Initializer { 64 65 public: 65 SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(),bool maybeConstructed = false );66 SingleInit( Expression *value, bool maybeConstructed = false ); 66 67 SingleInit( const SingleInit &other ); 67 68 virtual ~SingleInit(); … … 70 71 void set_value( Expression *newValue ) { value = newValue; } 71 72 72 std::list<Expression *> &get_designators() { return designators; }73 void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }74 75 73 virtual SingleInit *clone() const { return new SingleInit( *this); } 76 74 virtual void accept( Visitor &v ) { v.visit( this ); } 77 75 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 78 virtual void print( std::ostream &os, int indent = 0 ) ;76 virtual void print( std::ostream &os, int indent = 0 ) const; 79 77 private: 80 78 //Constant *value; 81 79 Expression *value; // has to be a compile-time constant 82 std::list< Expression * > designators;83 80 }; 84 81 … … 88 85 public: 89 86 ListInit( const std::list<Initializer*> &initializers, 90 const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );87 const std::list<Designation *> &designators = {}, bool maybeConstructed = false ); 91 88 ListInit( const ListInit & other ); 92 89 virtual ~ListInit(); 93 90 94 void set_designators( std::list<Expression *> &newValue ) { designators = newValue; } 95 std::list<Expression *> &get_designators() { return designators; } 96 void set_initializers( std::list<Initializer*> &newValue ) { initializers = newValue; } 97 std::list<Initializer*> &get_initializers() { return initializers; } 91 std::list<Designation *> & get_designations() { return designations; } 92 std::list<Initializer *> & get_initializers() { return initializers; } 98 93 99 94 typedef std::list<Initializer*>::iterator iterator; 95 typedef std::list<Initializer*>::const_iterator const_iterator; 100 96 iterator begin() { return initializers.begin(); } 101 97 iterator end() { return initializers.end(); } 98 const_iterator begin() const { return initializers.begin(); } 99 const_iterator end() const { return initializers.end(); } 102 100 103 101 virtual ListInit *clone() const { return new ListInit( *this ); } 104 102 virtual void accept( Visitor &v ) { v.visit( this ); } 105 103 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 106 virtual void print( std::ostream &os, int indent = 0 ) ;104 virtual void print( std::ostream &os, int indent = 0 ) const; 107 105 private: 108 std::list<Initializer *> initializers; // order *is* important109 std::list< Expression *> designators;106 std::list<Initializer *> initializers; // order *is* important 107 std::list<Designation *> designations; // order/length is consistent with initializers 110 108 }; 111 109 … … 130 128 virtual void accept( Visitor &v ) { v.visit( this ); } 131 129 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 132 virtual void print( std::ostream &os, int indent = 0 ) ;130 virtual void print( std::ostream &os, int indent = 0 ) const; 133 131 134 132 private: … … 140 138 }; 141 139 142 std::ostream & operator<<( std::ostream & out, Initializer * init ); 140 std::ostream & operator<<( std::ostream & out, const Initializer * init ); 141 std::ostream & operator<<( std::ostream & out, const Designation * des ); 143 142 144 143 #endif // INITIALIZER_H -
src/SynTree/Mutator.cc
r9c951e3 rb1e63ac5 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 Mar 30 16:45:19201713 // Update Count : 2 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:43:00 2017 13 // Update Count : 24 14 14 // 15 15 … … 77 77 TypeDecl *Mutator::mutate( TypeDecl *typeDecl ) { 78 78 handleNamedTypeDecl( typeDecl ); 79 typeDecl->set_init( maybeMutate( typeDecl->get_init(), *this ) ); 79 80 return typeDecl; 80 81 } … … 152 153 } 153 154 155 Statement *Mutator::mutate( ThrowStmt *throwStmt ) { 156 throwStmt->set_expr( maybeMutate( throwStmt->get_expr(), *this ) ); 157 throwStmt->set_target( maybeMutate( throwStmt->get_target(), *this ) ); 158 return throwStmt; 159 } 160 154 161 Statement *Mutator::mutate( TryStmt *tryStmt ) { 155 162 tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) ); 156 163 mutateAll( tryStmt->get_catchers(), *this ); 164 tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) ); 157 165 return tryStmt; 158 166 } … … 160 168 Statement *Mutator::mutate( CatchStmt *catchStmt ) { 161 169 catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) ); 170 catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) ); 162 171 catchStmt->set_body( maybeMutate( catchStmt->get_body(), *this ) ); 163 172 return catchStmt; … … 373 382 } 374 383 375 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {376 valofExpr->set_env( maybeMutate( valofExpr->get_env(), *this ) );377 valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );378 return valofExpr;379 }380 381 384 Expression *Mutator::mutate( RangeExpr *rangeExpr ) { 382 385 rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) ); … … 404 407 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) ); 405 408 tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) ); 406 return tupleExpr;407 }408 409 Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {410 tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );411 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );412 tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );413 tupleExpr->set_aggregate( maybeMutate( tupleExpr->get_aggregate(), *this ) );414 409 return tupleExpr; 415 410 } … … 438 433 } 439 434 435 Expression *Mutator::mutate( UntypedInitExpr * initExpr ) { 436 initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) ); 437 initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) ); 438 initExpr->set_expr( maybeMutate( initExpr->get_expr(), *this ) ); 439 // not currently mutating initAlts, but this doesn't matter since this node is only used in the resolver. 440 return initExpr; 441 } 442 443 Expression *Mutator::mutate( InitExpr * initExpr ) { 444 initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) ); 445 initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) ); 446 initExpr->set_expr( maybeMutate( initExpr->get_expr(), *this ) ); 447 initExpr->set_designation( maybeMutate( initExpr->get_designation(), *this ) ); 448 return initExpr; 449 } 450 440 451 441 452 Type *Mutator::mutate( VoidType *voidType ) { … … 510 521 mutateAll( tupleType->get_forall(), *this ); 511 522 mutateAll( tupleType->get_types(), *this ); 523 mutateAll( tupleType->get_members(), *this ); 512 524 return tupleType; 513 525 } … … 546 558 547 559 560 Designation *Mutator::mutate( Designation * designation ) { 561 mutateAll( designation->get_designators(), *this ); 562 return designation; 563 } 564 548 565 Initializer *Mutator::mutate( SingleInit *singleInit ) { 549 566 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); … … 552 569 553 570 Initializer *Mutator::mutate( ListInit *listInit ) { 554 mutateAll( listInit->get_designat ors(), *this );571 mutateAll( listInit->get_designations(), *this ); 555 572 mutateAll( listInit->get_initializers(), *this ); 556 573 return listInit; -
src/SynTree/Mutator.h
r9c951e3 rb1e63ac5 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 Feb 9 14:23:23201713 // Update Count : 1 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 15:45:00 2017 13 // Update Count : 14 14 14 // 15 15 #include <cassert> … … 46 46 virtual Statement* mutate( BranchStmt *branchStmt ); 47 47 virtual Statement* mutate( ReturnStmt *returnStmt ); 48 virtual Statement* mutate( TryStmt *returnStmt ); 48 virtual Statement* mutate( ThrowStmt *throwStmt ); 49 virtual Statement* mutate( TryStmt *tryStmt ); 49 50 virtual Statement* mutate( CatchStmt *catchStmt ); 50 51 virtual Statement* mutate( FinallyStmt *catchStmt ); … … 77 78 virtual Expression* mutate( ConstructorExpr *ctorExpr ); 78 79 virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ); 79 virtual Expression* mutate( UntypedValofExpr *valofExpr );80 80 virtual Expression* mutate( RangeExpr *rangeExpr ); 81 81 virtual Expression* mutate( UntypedTupleExpr *tupleExpr ); 82 82 virtual Expression* mutate( TupleExpr *tupleExpr ); 83 83 virtual Expression* mutate( TupleIndexExpr *tupleExpr ); 84 virtual Expression* mutate( MemberTupleExpr *tupleExpr );85 84 virtual Expression* mutate( TupleAssignExpr *assignExpr ); 86 85 virtual Expression* mutate( StmtExpr * stmtExpr ); 87 86 virtual Expression* mutate( UniqueExpr * uniqueExpr ); 87 virtual Expression* mutate( UntypedInitExpr * initExpr ); 88 virtual Expression* mutate( InitExpr * initExpr ); 88 89 89 90 virtual Type* mutate( VoidType *basicType ); … … 105 106 virtual Type* mutate( OneType *oneType ); 106 107 108 virtual Designation* mutate( Designation *designation ); 107 109 virtual Initializer* mutate( SingleInit *singleInit ); 108 110 virtual Initializer* mutate( ListInit *listInit ); -
src/SynTree/ObjectDecl.cc
r9c951e3 rb1e63ac5 56 56 57 57 if ( init ) { 58 os << " with initializer " ;59 init->print( os, indent );60 os << std::endl << std::string(indent , ' ');58 os << " with initializer " << std::endl; 59 init->print( os, indent+2 ); 60 os << std::endl << std::string(indent+2, ' '); 61 61 os << "maybeConstructed? " << init->get_maybeConstructed(); 62 62 } // if -
src/SynTree/Statement.cc
r9c951e3 rb1e63ac5 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 : Fri Aug 12 13:58:48 201613 // Update Count : 6 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 10:37:00 2017 13 // Update Count : 64 14 14 // 15 15 … … 30 30 Statement::Statement( std::list<Label> _labels ) : labels( _labels ) {} 31 31 32 void Statement::print( std::ostream &,int indent ) const {}32 void Statement::print( __attribute__((unused)) std::ostream &, __attribute__((unused)) int indent ) const {} 33 33 34 34 Statement::~Statement() {} … … 101 101 } 102 102 103 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr , bool throwP ) : Statement( labels ), expr( _expr ), isThrow( throwP) {}104 105 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) , isThrow( other.isThrow ){}103 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr ) : Statement( labels ), expr( _expr ) {} 104 105 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {} 106 106 107 107 ReturnStmt::~ReturnStmt() { … … 110 110 111 111 void ReturnStmt::print( std::ostream &os, int indent ) const { 112 os << string ( isThrow? "Throw":"Return" ) << "Statement, returning: ";112 os << "Return Statement, returning: "; 113 113 if ( expr != 0 ) { 114 114 os << endl << string( indent+2, ' ' ); … … 287 287 } 288 288 289 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &_handlers, FinallyStmt *_finallyBlock ) : 289 ThrowStmt::ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target ) : 290 Statement( labels ), kind(kind), expr(expr), target(target) { 291 assertf(Resume == kind || nullptr == target, "Non-local termination throw is not accepted." ); 292 } 293 294 ThrowStmt::ThrowStmt( const ThrowStmt &other ) : 295 Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) { 296 } 297 298 ThrowStmt::~ThrowStmt() { 299 delete expr; 300 delete target; 301 } 302 303 void ThrowStmt::print( std::ostream &os, int indent) const { 304 if ( target ) { 305 os << "Non-Local "; 306 } 307 os << "Throw Statement, raising: "; 308 expr->print(os, indent + 4); 309 if ( target ) { 310 os << "At: "; 311 target->print(os, indent + 4); 312 } 313 } 314 315 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &_handlers, FinallyStmt *_finallyBlock ) : 290 316 Statement( labels ), block( tryBlock ), handlers( _handlers ), finallyBlock( _finallyBlock ) { 291 317 } … … 308 334 // handlers 309 335 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 310 for ( std::list< Statement *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)336 for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) 311 337 (*i )->print( os, indent + 4 ); 312 338 … … 318 344 } 319 345 320 CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool catchAny ) :321 Statement( labels ), decl ( _decl ), body( _body ), catchRest ( catchAny ) {346 CatchStmt::CatchStmt( std::list<Label> labels, Kind _kind, Declaration *_decl, Expression *_cond, Statement *_body ) : 347 Statement( labels ), kind ( _kind ), decl ( _decl ), cond ( _cond ), body( _body ) { 322 348 } 323 349 324 350 CatchStmt::CatchStmt( const CatchStmt & other ) : 325 Statement( other ), decl ( maybeClone( other.decl ) ), body( maybeClone( other.body ) ), catchRest ( other.catchRest) {351 Statement( other ), kind ( other.kind ), decl ( maybeClone( other.decl ) ), cond ( maybeClone( other.cond ) ), body( maybeClone( other.body ) ) { 326 352 } 327 353 … … 332 358 333 359 void CatchStmt::print( std::ostream &os, int indent ) const { 334 os << "Catch Statement" << endl;360 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; 335 361 336 362 os << string( indent, ' ' ) << "... catching" << endl; … … 338 364 decl->printShort( os, indent + 4 ); 339 365 os << endl; 340 } else if ( catchRest ) 341 os << string( indent + 4 , ' ' ) << "the rest" << endl; 366 } 342 367 else 343 368 os << string( indent + 4 , ' ' ) << ">>> Error: this catch clause must have a declaration <<<" << endl; … … 365 390 NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {} 366 391 367 void NullStmt::print( std::ostream &os, int indent ) const {392 void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const { 368 393 os << "Null Statement" << endl ; 369 394 } -
src/SynTree/Statement.h
r9c951e3 rb1e63ac5 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 : Fri Aug 12 13:57:46 201613 // Update Count : 6 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:35:00 2017 13 // Update Count : 67 14 14 // 15 15 … … 57 57 private: 58 58 std::list<Statement*> kids; 59 }; 60 61 class NullStmt : public CompoundStmt { 62 public: 63 NullStmt(); 64 NullStmt( std::list<Label> labels ); 65 66 virtual NullStmt *clone() const { return new NullStmt( *this ); } 67 virtual void accept( Visitor &v ) { v.visit( this ); } 68 virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 69 virtual void print( std::ostream &os, int indent = 0 ) const; 70 71 private: 59 72 }; 60 73 … … 261 274 class ReturnStmt : public Statement { 262 275 public: 263 ReturnStmt( std::list<Label> labels, Expression *expr , bool throwP = false);276 ReturnStmt( std::list<Label> labels, Expression *expr ); 264 277 ReturnStmt( const ReturnStmt &other ); 265 278 virtual ~ReturnStmt(); … … 274 287 private: 275 288 Expression *expr; 276 bool isThrow; 277 }; 278 279 280 class NullStmt : public CompoundStmt { 281 public: 282 NullStmt(); 283 NullStmt( std::list<Label> labels ); 284 285 virtual NullStmt *clone() const { return new NullStmt( *this ); } 286 virtual void accept( Visitor &v ) { v.visit( this ); } 287 virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 288 virtual void print( std::ostream &os, int indent = 0 ) const; 289 290 private: 289 }; 290 291 class ThrowStmt : public Statement { 292 public: 293 enum Kind { Terminate, Resume }; 294 295 ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr ); 296 ThrowStmt( const ThrowStmt &other ); 297 virtual ~ThrowStmt(); 298 299 Kind get_kind() { return kind; } 300 Expression * get_expr() { return expr; } 301 void set_expr( Expression * newExpr ) { expr = newExpr; } 302 Expression * get_target() { return target; } 303 void set_target( Expression * newTarget ) { target = newTarget; } 304 305 virtual ThrowStmt *clone() const { return new ThrowStmt( *this ); } 306 virtual void accept( Visitor &v ) { v.visit( this ); } 307 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 308 virtual void print( std::ostream &os, int indent = 0 ) const; 309 private: 310 Kind kind; 311 Expression * expr; 312 Expression * target; 291 313 }; 292 314 293 315 class TryStmt : public Statement { 294 316 public: 295 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list< Statement *> &handlers, FinallyStmt *finallyBlock = 0 );317 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 ); 296 318 TryStmt( const TryStmt &other ); 297 319 virtual ~TryStmt(); … … 299 321 CompoundStmt *get_block() const { return block; } 300 322 void set_block( CompoundStmt *newValue ) { block = newValue; } 301 std::list< Statement *>& get_catchers() { return handlers; }323 std::list<CatchStmt *>& get_catchers() { return handlers; } 302 324 303 325 FinallyStmt *get_finally() const { return finallyBlock; } … … 311 333 private: 312 334 CompoundStmt *block; 313 std::list< Statement *> handlers;335 std::list<CatchStmt *> handlers; 314 336 FinallyStmt *finallyBlock; 315 337 }; … … 317 339 class CatchStmt : public Statement { 318 340 public: 319 CatchStmt( std::list<Label> labels, Declaration *decl, Statement *body, bool catchAny = false ); 341 enum Kind { Terminate, Resume }; 342 343 CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, 344 Expression *cond, Statement *body ); 320 345 CatchStmt( const CatchStmt &other ); 321 346 virtual ~CatchStmt(); 322 347 348 Kind get_kind() { return kind; } 323 349 Declaration *get_decl() { return decl; } 324 350 void set_decl( Declaration *newValue ) { decl = newValue; } 325 351 Expression *get_cond() { return cond; } 352 void set_cond( Expression *newCond ) { cond = newCond; } 326 353 Statement *get_body() { return body; } 327 354 void set_body( Statement *newValue ) { body = newValue; } … … 333 360 334 361 private: 362 Kind kind; 335 363 Declaration *decl; 364 Expression *cond; 336 365 Statement *body; 337 bool catchRest;338 366 }; 339 367 -
src/SynTree/SynTree.h
r9c951e3 rb1e63ac5 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 Feb 9 14:23:49201713 // Update Count : 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 17:00:00 2017 13 // Update Count : 9 14 14 // 15 15 … … 51 51 class BranchStmt; 52 52 class ReturnStmt; 53 class ThrowStmt; 53 54 class TryStmt; 54 55 class CatchStmt; … … 89 90 class TupleExpr; 90 91 class TupleIndexExpr; 91 class MemberTupleExpr;92 92 class TupleAssignExpr; 93 93 class StmtExpr; 94 94 class UniqueExpr; 95 class UntypedInitExpr; 96 class InitExpr; 95 97 96 98 class Type; … … 114 116 class OneType; 115 117 118 class Designation; 116 119 class Initializer; 117 120 class SingleInit; -
src/SynTree/TupleExpr.cc
r9c951e3 rb1e63ac5 78 78 } 79 79 80 MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) {81 set_result( maybeClone( member->get_result() ) ); // xxx - ???82 }83 84 MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) {85 }86 87 MemberTupleExpr::~MemberTupleExpr() {88 delete member;89 delete aggregate;90 }91 92 void MemberTupleExpr::print( std::ostream &os, int indent ) const {93 os << "Member Tuple Expression, with aggregate:" << std::endl;94 os << std::string( indent+2, ' ' );95 aggregate->print( os, indent+2 );96 os << std::string( indent+2, ' ' ) << "with member: " << std::endl;97 os << std::string( indent+2, ' ' );98 member->print( os, indent+2 );99 Expression::print( os, indent );100 }101 102 80 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ) { 103 81 // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments -
src/SynTree/TupleType.cc
r9c951e3 rb1e63ac5 14 14 // 15 15 16 #include "Declaration.h" 17 #include "Initializer.h" 16 18 #include "Type.h" 17 19 #include "Common/utility.h" 20 #include "Parser/LinkageSpec.h" 18 21 19 22 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) { 23 for ( Type * t : *this ) { 24 // xxx - this is very awkward. TupleTypes should contain objects so that members can be named, but if they don't have an initializer node then 25 // they end up getting constructors, which end up being inserted causing problems. This happens because the object decls have to be visited so that 26 // their types are kept in sync with the types list here. Ultimately, the types list here should be eliminated and perhaps replaced with a list-view 27 // of the object types list, but I digress. The temporary solution here is to make a ListInit with maybeConstructed = false, that way even when the 28 // object is visited, it is never constructed. Ultimately, a better solution might be either: 29 // a) to separate TupleType from its declarations, into TupleDecl and Tuple{Inst?}Type, ala StructDecl and StructInstType 30 // b) separate initializer nodes better, e.g. add a MaybeConstructed node that is replaced by genInit, rather than what currently exists in a bool 31 members.push_back( new ObjectDecl( "" , Type::StorageClasses(), LinkageSpec::Cforall, nullptr, t->clone(), new ListInit( {}, {}, false ) ) ); 32 } 20 33 } 21 34 22 35 TupleType::TupleType( const TupleType& other ) : Type( other ) { 23 36 cloneAll( other.types, types ); 37 cloneAll( other.members, members ); 24 38 } 25 39 26 40 TupleType::~TupleType() { 27 41 deleteAll( types ); 42 deleteAll( members ); 28 43 } 29 44 -
src/SynTree/Type.h
r9c951e3 rb1e63ac5 307 307 private: 308 308 Type *base; 309 unsigned int level = 0;310 309 }; 311 310 … … 354 353 virtual void print( std::ostream & os, int indent = 0 ) const; 355 354 356 virtual void lookup( const std::string & name,std::list< Declaration* > & foundDecls ) const {}355 virtual void lookup( __attribute__((unused)) const std::string & name, __attribute__((unused)) std::list< Declaration* > & foundDecls ) const {} 357 356 protected: 358 357 virtual std::string typeString() const = 0; … … 501 500 class TupleType : public Type { 502 501 public: 503 TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >() );502 TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 504 503 TupleType( const TupleType& ); 505 504 virtual ~TupleType(); … … 508 507 typedef value_type::iterator iterator; 509 508 510 std::list<Type *>& get_types() { return types; }509 std::list<Type *> & get_types() { return types; } 511 510 virtual unsigned size() const { return types.size(); }; 511 512 // For now, this is entirely synthetic -- tuple types always have unnamed members. 513 // Eventually, we may allow named tuples, in which case members should subsume types 514 std::list<Declaration *> & get_members() { return members; } 512 515 513 516 iterator begin() { return types.begin(); } … … 526 529 virtual void print( std::ostream & os, int indent = 0 ) const; 527 530 private: 528 std::list<Type*> types; 531 std::list<Type *> types; 532 std::list<Declaration *> members; 529 533 }; 530 534 -
src/SynTree/TypeDecl.cc
r9c951e3 rb1e63ac5 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind), sized( kind == Any || kind == Ttype ) {20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), kind( kind ), init( init ), sized( kind == Any || kind == Ttype ) { 21 21 } 22 22 23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), sized( other.sized ) { 23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), init( maybeClone( other.init ) ), sized( other.sized ) { 24 } 25 26 TypeDecl::~TypeDecl() { 27 delete init; 24 28 } 25 29 … … 34 38 } 35 39 40 void TypeDecl::print( std::ostream &os, int indent ) const { 41 NamedTypeDecl::print( os, indent ); 42 if ( init ) { 43 os << std::endl << std::string( indent, ' ' ) << "with type initializer: "; 44 init->print( os, indent + 2 ); 45 } 46 } 47 48 36 49 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) { 37 50 return os << data.kind << ", " << data.isComplete; -
src/SynTree/TypeSubstitution.cc
r9c951e3 rb1e63ac5 166 166 boundVars.insert( (*tyvar )->get_name() ); 167 167 } // for 168 } // if169 // bind type variables from generic type instantiations170 std::list< TypeDecl* > *baseParameters = type->get_baseParameters();171 if ( baseParameters && ! type->get_parameters().empty()) {172 for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) {173 boundVars.insert( (*tyvar)->get_name() );174 } // for168 // bind type variables from generic type instantiations 169 std::list< TypeDecl* > *baseParameters = type->get_baseParameters(); 170 if ( baseParameters && ! type->get_parameters().empty() ) { 171 for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) { 172 boundVars.insert( (*tyvar)->get_name() ); 173 } // for 174 } // if 175 175 } // if 176 176 Type *ret = Mutator::mutate( type ); -
src/SynTree/VarExprReplacer.cc
r9c951e3 rb1e63ac5 14 14 // 15 15 16 #include "Declaration.h" 16 17 #include "Expression.h" 17 18 #include "VarExprReplacer.h" 18 19 19 VarExprReplacer::VarExprReplacer( const DeclMap & declMap ) : declMap( declMap) {}20 VarExprReplacer::VarExprReplacer( const DeclMap & declMap, bool debug ) : declMap( declMap ), debug( debug ) {} 20 21 21 22 // replace variable with new node from decl map 22 23 void VarExprReplacer::visit( VariableExpr * varExpr ) { 23 // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are) 24 if ( declMap.count( varExpr->get_var() ) ) { 25 varExpr->set_var( declMap.at( varExpr->get_var() ) ); 26 } 24 // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are) 25 if ( declMap.count( varExpr->get_var() ) ) { 26 if ( debug ) { 27 std::cerr << "replacing variable reference: " << (void*)varExpr->get_var() << " " << varExpr->get_var() << " with " << (void*)declMap.at( varExpr->get_var() ) << " " << declMap.at( varExpr->get_var() ) << std::endl; 28 } 29 varExpr->set_var( declMap.at( varExpr->get_var() ) ); 30 } 27 31 } -
src/SynTree/VarExprReplacer.h
r9c951e3 rb1e63ac5 27 27 private: 28 28 const DeclMap & declMap; 29 bool debug; 29 30 public: 30 VarExprReplacer( const DeclMap & declMap );31 VarExprReplacer( const DeclMap & declMap, bool debug = false ); 31 32 32 33 // replace variable with new node from decl map -
src/SynTree/Visitor.cc
r9c951e3 rb1e63ac5 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 Mar 30 16:45:25201713 // Update Count : 2 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:41:00 2017 13 // Update Count : 26 14 14 // 15 15 … … 67 67 void Visitor::visit( TypeDecl *typeDecl ) { 68 68 handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) ); 69 maybeAccept( typeDecl->get_init(), *this ); 69 70 } 70 71 … … 121 122 } 122 123 123 void Visitor::visit( BranchStmt *branchStmt ) {124 void Visitor::visit( __attribute__((unused)) BranchStmt *branchStmt ) { 124 125 } 125 126 126 127 void Visitor::visit( ReturnStmt *returnStmt ) { 127 128 maybeAccept( returnStmt->get_expr(), *this ); 129 } 130 131 void Visitor::visit( ThrowStmt * throwStmt ) { 132 maybeAccept( throwStmt->get_expr(), *this ); 133 maybeAccept( throwStmt->get_target(), *this ); 128 134 } 129 135 … … 131 137 maybeAccept( tryStmt->get_block(), *this ); 132 138 acceptAll( tryStmt->get_catchers(), *this ); 139 maybeAccept( tryStmt->get_finally(), *this ); 133 140 } 134 141 135 142 void Visitor::visit( CatchStmt *catchStmt ) { 136 143 maybeAccept( catchStmt->get_decl(), *this ); 144 maybeAccept( catchStmt->get_cond(), *this ); 137 145 maybeAccept( catchStmt->get_body(), *this ); 138 146 } … … 142 150 } 143 151 144 void Visitor::visit( NullStmt *nullStmt ) {152 void Visitor::visit( __attribute__((unused)) NullStmt *nullStmt ) { 145 153 } 146 154 … … 295 303 } 296 304 297 void Visitor::visit( UntypedValofExpr *valofExpr ) {298 maybeAccept( valofExpr->get_result(), *this );299 maybeAccept( valofExpr->get_body(), *this );300 }301 302 305 void Visitor::visit( RangeExpr *rangeExpr ) { 303 306 maybeAccept( rangeExpr->get_low(), *this ); … … 318 321 maybeAccept( tupleExpr->get_result(), *this ); 319 322 maybeAccept( tupleExpr->get_tuple(), *this ); 320 }321 322 void Visitor::visit( MemberTupleExpr *tupleExpr ) {323 maybeAccept( tupleExpr->get_result(), *this );324 maybeAccept( tupleExpr->get_member(), *this );325 maybeAccept( tupleExpr->get_aggregate(), *this );326 323 } 327 324 … … 343 340 } 344 341 342 void Visitor::visit( UntypedInitExpr * initExpr ) { 343 maybeAccept( initExpr->get_result(), *this ); 344 maybeAccept( initExpr->get_expr(), *this ); 345 // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. 346 } 347 348 void Visitor::visit( InitExpr * initExpr ) { 349 maybeAccept( initExpr->get_result(), *this ); 350 maybeAccept( initExpr->get_expr(), *this ); 351 maybeAccept( initExpr->get_designation(), *this ); 352 } 353 345 354 346 355 void Visitor::visit( VoidType *voidType ) { … … 404 413 acceptAll( tupleType->get_forall(), *this ); 405 414 acceptAll( tupleType->get_types(), *this ); 415 acceptAll( tupleType->get_members(), *this ); 406 416 } 407 417 … … 433 443 } 434 444 445 void Visitor::visit( Designation * designation ) { 446 acceptAll( designation->get_designators(), *this ); 447 } 435 448 436 449 void Visitor::visit( SingleInit *singleInit ) { … … 439 452 440 453 void Visitor::visit( ListInit *listInit ) { 441 acceptAll( listInit->get_designat ors(), *this );454 acceptAll( listInit->get_designations(), *this ); 442 455 acceptAll( listInit->get_initializers(), *this ); 443 456 } … … 450 463 451 464 452 void Visitor::visit( Subrange *subrange ) {}453 454 455 void Visitor::visit( Constant *constant ) {}465 void Visitor::visit( __attribute__((unused)) Subrange *subrange ) {} 466 467 468 void Visitor::visit( __attribute__((unused)) Constant *constant ) {} 456 469 // Local Variables: // 457 470 // tab-width: 4 // -
src/SynTree/Visitor.h
r9c951e3 rb1e63ac5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 3 08:58:00 201713 // Update Count : 1 012 // Last Modified On : Thr Jun 08 15:45:00 2017 13 // Update Count : 11 14 14 // 15 15 … … 49 49 virtual void visit( BranchStmt *branchStmt ); 50 50 virtual void visit( ReturnStmt *returnStmt ); 51 virtual void visit( ThrowStmt *throwStmt ); 51 52 virtual void visit( TryStmt *tryStmt ); 52 53 virtual void visit( CatchStmt *catchStmt ); … … 80 81 virtual void visit( ConstructorExpr * ctorExpr ); 81 82 virtual void visit( CompoundLiteralExpr *compLitExpr ); 82 virtual void visit( UntypedValofExpr *valofExpr );83 83 virtual void visit( RangeExpr *rangeExpr ); 84 84 virtual void visit( UntypedTupleExpr *tupleExpr ); 85 85 virtual void visit( TupleExpr *tupleExpr ); 86 86 virtual void visit( TupleIndexExpr *tupleExpr ); 87 virtual void visit( MemberTupleExpr *tupleExpr );88 87 virtual void visit( TupleAssignExpr *assignExpr ); 89 88 virtual void visit( StmtExpr * stmtExpr ); 90 89 virtual void visit( UniqueExpr * uniqueExpr ); 90 virtual void visit( UntypedInitExpr * initExpr ); 91 virtual void visit( InitExpr * initExpr ); 91 92 92 93 virtual void visit( VoidType *basicType ); … … 108 109 virtual void visit( OneType *oneType ); 109 110 111 virtual void visit( Designation *designation ); 110 112 virtual void visit( SingleInit *singleInit ); 111 113 virtual void visit( ListInit *listInit ); -
src/SynTree/ZeroOneType.cc
r9c951e3 rb1e63ac5 20 20 ZeroType::ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {} 21 21 22 void ZeroType::print( std::ostream &os, int indent ) const {22 void ZeroType::print( std::ostream &os, __attribute__((unused)) int indent ) const { 23 23 os << "zero_t"; 24 24 } … … 28 28 OneType::OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {} 29 29 30 void OneType::print( std::ostream &os, int indent ) const {30 void OneType::print( std::ostream &os, __attribute__((unused)) int indent ) const { 31 31 os << "one_t"; 32 32 } -
src/Tuples/TupleExpansion.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 08:05:17201713 // Update Count : 1 512 // Last Modified On : Wed Jun 21 17:35:04 2017 13 // Update Count : 19 14 14 // 15 15 … … 18 18 #include <cassert> 19 19 #include "Tuples.h" 20 #include "Common/PassVisitor.h" 21 #include "Common/ScopedMap.h" 20 22 #include "GenPoly/DeclMutator.h" 23 #include "InitTweak/GenInit.h" 24 #include "InitTweak/InitTweak.h" 25 #include "ResolvExpr/typeops.h" 26 #include "SymTab/Mangler.h" 27 #include "SynTree/Declaration.h" 28 #include "SynTree/Expression.h" 29 #include "SynTree/Initializer.h" 21 30 #include "SynTree/Mutator.h" 22 31 #include "SynTree/Statement.h" 23 #include "SynTree/Declaration.h"24 32 #include "SynTree/Type.h" 25 #include "SynTree/Expression.h"26 #include "SynTree/Initializer.h"27 #include "SymTab/Mangler.h"28 #include "Common/ScopedMap.h"29 #include "ResolvExpr/typeops.h"30 #include "InitTweak/GenInit.h"31 #include "InitTweak/InitTweak.h"32 33 33 34 namespace Tuples { … … 82 83 }; 83 84 84 class TupleIndexExpander final : public Mutator { 85 public: 86 typedef Mutator Parent; 87 using Parent::mutate; 88 89 virtual Expression * mutate( TupleIndexExpr * tupleExpr ) override; 85 class TupleIndexExpander { 86 public: 87 Expression * postmutate( TupleIndexExpr * tupleExpr ); 90 88 }; 91 89 … … 116 114 replacer.mutateDeclarationList( translationUnit ); 117 115 118 TupleIndexExpanderidxExpander;116 PassVisitor<TupleIndexExpander> idxExpander; 119 117 mutateAll( translationUnit, idxExpander ); 120 118 … … 193 191 commaExpr->set_arg1( nullptr ); 194 192 } 195 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );196 ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators) );193 ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), 194 new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) ); 197 195 addDeclaration( finished ); 198 196 // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N)) 199 197 // This pattern ensures that each unique expression is evaluated once, regardless of evaluation order of the generated C code. 200 Expression * assignFinished = UntypedExpr::createAssign( new VariableExpr(finished), new ConstantExpr( Constant ( boolType->clone(), "1") ) );198 Expression * assignFinished = UntypedExpr::createAssign( new VariableExpr(finished), new ConstantExpr( Constant::from_int( 1 ) ) ); 201 199 ConditionalExpr * condExpr = new ConditionalExpr( new VariableExpr( finished ), var->clone(), 202 200 new CommaExpr( new CommaExpr( assignUnq, assignFinished ), var->clone() ) ); … … 250 248 } 251 249 252 Expression * TupleIndexExpander:: mutate( TupleIndexExpr * tupleExpr ) {253 Expression * tuple = maybeMutate( tupleExpr->get_tuple(), *this);250 Expression * TupleIndexExpander::postmutate( TupleIndexExpr * tupleExpr ) { 251 Expression * tuple = tupleExpr->get_tuple(); 254 252 assert( tuple ); 255 253 tupleExpr->set_tuple( nullptr ); … … 312 310 Type * makeTupleType( const std::list< Expression * > & exprs ) { 313 311 // produce the TupleType which aggregates the types of the exprs 314 TupleType *tupleType = new TupleType( Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ) );315 Type::Qualifiers &qualifiers = tupleType->get_qualifiers();312 std::list< Type * > types; 313 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ); 316 314 for ( Expression * expr : exprs ) { 317 315 assert( expr->get_result() ); 318 316 if ( expr->get_result()->isVoid() ) { 319 317 // if the type of any expr is void, the type of the entire tuple is void 320 delete tupleType;321 318 return new VoidType( Type::Qualifiers() ); 322 319 } 323 320 Type * type = expr->get_result()->clone(); 324 t upleType->get_types().push_back( type );321 types.push_back( type ); 325 322 // the qualifiers on the tuple type are the qualifiers that exist on all component types 326 323 qualifiers &= type->get_qualifiers(); 327 324 } // for 328 325 if ( exprs.empty() ) qualifiers = Type::Qualifiers(); 329 return tupleType;326 return new TupleType( qualifiers, types ); 330 327 } 331 328 332 329 TypeInstType * isTtype( Type * type ) { 333 330 if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( type ) ) { 334 if ( inst->get_baseType() ->get_kind() == TypeDecl::Ttype ) {331 if ( inst->get_baseType() && inst->get_baseType()->get_kind() == TypeDecl::Ttype ) { 335 332 return inst; 336 333 } … … 356 353 maybeImpure = true; 357 354 } 358 virtual void visit( UntypedExpr * untypedExpr ) { maybeImpure = true; }355 virtual void visit( __attribute__((unused)) UntypedExpr * untypedExpr ) { maybeImpure = true; } 359 356 bool maybeImpure = false; 360 357 }; -
src/driver/Makefile.am
r9c951e3 rb1e63ac5 16 16 17 17 # applies to both programs 18 AM_CXXFLAGS = -Wall -O2 18 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 19 19 if BUILD_NO_LIB 20 20 else -
src/driver/Makefile.in
r9c951e3 rb1e63ac5 208 208 209 209 # applies to both programs 210 AM_CXXFLAGS = -Wall -O2 $(am__append_1) $(am__append_2) \210 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 $(am__append_1) $(am__append_2) \ 211 211 $(am__append_3) 212 212 cfa_SOURCES = cfa.cc -
src/driver/cc1.cc
r9c951e3 rb1e63ac5 84 84 85 85 86 void sigTermHandler( int signal ) {86 void sigTermHandler( __attribute__((unused)) int signal ) { 87 87 if ( tmpfilefd != -1 ) { // RACE, file created ? 88 88 rmtmpfile(); // remove … … 469 469 470 470 471 int main( const int argc, const char * const argv[], const char * const env[] ) {471 int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) { 472 472 #ifdef __DEBUG_H__ 473 473 for ( int i = 0; env[i] != NULL; i += 1 ) { -
src/driver/cfa.cc
r9c951e3 rb1e63ac5 271 271 args[nargs] = "-ldl"; 272 272 nargs += 1; 273 args[nargs] = "-lrt"; 274 nargs += 1; 273 275 args[nargs] = "-Xlinker"; 274 276 nargs += 1; -
src/libcfa/Makefile.am
r9c951e3 rb1e63ac5 10 10 ## Author : Peter A. Buhr 11 11 ## Created On : Sun May 31 08:54:01 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Sun May 14 21:04:21201714 ## Update Count : 21 412 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 15:36:00 2017 14 ## Update Count : 215 15 15 ############################################################################### 16 16 … … 41 41 CC = ${abs_top_srcdir}/src/driver/cfa 42 42 43 headers = limits stdlib math iostream fstream iterator rational assert containers/pair containers/vector 43 headers = assert fstream iostream iterator limits math rational stdlib \ 44 containers/maybe containers/pair containers/result containers/vector 44 45 45 46 # not all platforms support concurrency, add option do disable it … … 53 54 # not all platforms support concurrency, add option do disable it 54 55 if BUILD_CONCURRENCY 55 libsrc += concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/ invoke.c56 libsrc += concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c 56 57 endif 57 58 … … 63 64 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 64 65 66 libcfa_a-exception.o : exception.c 67 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 68 65 69 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 70 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 71 72 libcfa_d_a-exception.o : exception.c 66 73 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 67 74 … … 71 78 libcfa_a_CFLAGS = -nodebug -O2 72 79 libcfa_d_a_SOURCES = ${libsrc} 73 libcfa_d_a_CFLAGS = -debug -O0 80 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 74 81 75 82 stdhdr = ${shell echo stdhdr/*} -
src/libcfa/Makefile.in
r9c951e3 rb1e63ac5 46 46 47 47 # not all platforms support concurrency, add option do disable it 48 @BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/ invoke.c48 @BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c 49 49 subdir = src/libcfa 50 50 DIST_COMMON = $(am__nobase_cfa_include_HEADERS_DIST) \ … … 98 98 libcfa_d_a_LIBADD = 99 99 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 100 libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \ 101 fstream.c iterator.c rational.c assert.c containers/pair.c \ 102 containers/vector.c concurrency/coroutine.c \ 103 concurrency/thread.c concurrency/kernel.c \ 104 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 105 concurrency/invoke.c 100 libhdr/libdebug.c assert.c fstream.c iostream.c iterator.c \ 101 limits.c math.c rational.c stdlib.c containers/maybe.c \ 102 containers/pair.c containers/result.c containers/vector.c \ 103 concurrency/coroutine.c concurrency/thread.c \ 104 concurrency/kernel.c concurrency/monitor.c \ 105 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \ 106 concurrency/invoke.c concurrency/preemption.c 106 107 am__dirstamp = $(am__leading_dot)dirstamp 107 108 @BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \ … … 109 110 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-kernel.$(OBJEXT) \ 110 111 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-monitor.$(OBJEXT) 111 am__objects_2 = libcfa_d_a-limits.$(OBJEXT) \ 112 libcfa_d_a-stdlib.$(OBJEXT) libcfa_d_a-math.$(OBJEXT) \ 113 libcfa_d_a-iostream.$(OBJEXT) libcfa_d_a-fstream.$(OBJEXT) \ 114 libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 115 libcfa_d_a-assert.$(OBJEXT) \ 112 am__objects_2 = libcfa_d_a-assert.$(OBJEXT) \ 113 libcfa_d_a-fstream.$(OBJEXT) libcfa_d_a-iostream.$(OBJEXT) \ 114 libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-limits.$(OBJEXT) \ 115 libcfa_d_a-math.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 116 libcfa_d_a-stdlib.$(OBJEXT) \ 117 containers/libcfa_d_a-maybe.$(OBJEXT) \ 116 118 containers/libcfa_d_a-pair.$(OBJEXT) \ 119 containers/libcfa_d_a-result.$(OBJEXT) \ 117 120 containers/libcfa_d_a-vector.$(OBJEXT) $(am__objects_1) 118 121 @BUILD_CONCURRENCY_TRUE@am__objects_3 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \ 119 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-invoke.$(OBJEXT) 122 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-alarm.$(OBJEXT) \ 123 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-invoke.$(OBJEXT) \ 124 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-preemption.$(OBJEXT) 120 125 am__objects_4 = libcfa_d_a-libcfa-prelude.$(OBJEXT) \ 121 126 libcfa_d_a-interpose.$(OBJEXT) \ … … 127 132 libcfa_a_LIBADD = 128 133 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 129 libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \ 130 fstream.c iterator.c rational.c assert.c containers/pair.c \ 131 containers/vector.c concurrency/coroutine.c \ 132 concurrency/thread.c concurrency/kernel.c \ 133 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 134 concurrency/invoke.c 134 libhdr/libdebug.c assert.c fstream.c iostream.c iterator.c \ 135 limits.c math.c rational.c stdlib.c containers/maybe.c \ 136 containers/pair.c containers/result.c containers/vector.c \ 137 concurrency/coroutine.c concurrency/thread.c \ 138 concurrency/kernel.c concurrency/monitor.c \ 139 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \ 140 concurrency/invoke.c concurrency/preemption.c 135 141 @BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \ 136 142 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-thread.$(OBJEXT) \ 137 143 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-kernel.$(OBJEXT) \ 138 144 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-monitor.$(OBJEXT) 139 am__objects_6 = libcfa_a-limits.$(OBJEXT) libcfa_a-stdlib.$(OBJEXT) \ 140 libcfa_a-math.$(OBJEXT) libcfa_a-iostream.$(OBJEXT) \ 141 libcfa_a-fstream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \ 142 libcfa_a-rational.$(OBJEXT) libcfa_a-assert.$(OBJEXT) \ 145 am__objects_6 = libcfa_a-assert.$(OBJEXT) libcfa_a-fstream.$(OBJEXT) \ 146 libcfa_a-iostream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \ 147 libcfa_a-limits.$(OBJEXT) libcfa_a-math.$(OBJEXT) \ 148 libcfa_a-rational.$(OBJEXT) libcfa_a-stdlib.$(OBJEXT) \ 149 containers/libcfa_a-maybe.$(OBJEXT) \ 143 150 containers/libcfa_a-pair.$(OBJEXT) \ 151 containers/libcfa_a-result.$(OBJEXT) \ 144 152 containers/libcfa_a-vector.$(OBJEXT) $(am__objects_5) 145 153 @BUILD_CONCURRENCY_TRUE@am__objects_7 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \ 146 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-invoke.$(OBJEXT) 154 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-alarm.$(OBJEXT) \ 155 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-invoke.$(OBJEXT) \ 156 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-preemption.$(OBJEXT) 147 157 am__objects_8 = libcfa_a-libcfa-prelude.$(OBJEXT) \ 148 158 libcfa_a-interpose.$(OBJEXT) \ … … 179 189 DIST_SOURCES = $(am__libcfa_d_a_SOURCES_DIST) \ 180 190 $(am__libcfa_a_SOURCES_DIST) 181 am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream\182 fstream iterator rational assertcontainers/pair \183 containers/ vector concurrency/coroutine concurrency/thread\184 concurrency/ kernel concurrency/monitor ${shell echo stdhdr/*}\185 gmp concurrency/invoke.h191 am__nobase_cfa_include_HEADERS_DIST = assert fstream iostream iterator \ 192 limits math rational stdlib containers/maybe containers/pair \ 193 containers/result containers/vector concurrency/coroutine \ 194 concurrency/thread concurrency/kernel concurrency/monitor \ 195 ${shell echo stdhdr/*} gmp concurrency/invoke.h 186 196 HEADERS = $(nobase_cfa_include_HEADERS) 187 197 ETAGS = etags … … 313 323 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@ 314 324 AM_CCASFLAGS = @CFA_FLAGS@ 315 headers = limits stdlib math iostream fstream iterator rational assert \ 316 containers/pair containers/vector $(am__append_3) 325 headers = assert fstream iostream iterator limits math rational stdlib \ 326 containers/maybe containers/pair containers/result \ 327 containers/vector $(am__append_3) 317 328 libobjs = ${headers:=.o} 318 329 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ … … 321 332 libcfa_a_CFLAGS = -nodebug -O2 322 333 libcfa_d_a_SOURCES = ${libsrc} 323 libcfa_d_a_CFLAGS = -debug -O0 334 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 324 335 stdhdr = ${shell echo stdhdr/*} 325 336 cfa_includedir = $(CFA_INCDIR) … … 404 415 @$(MKDIR_P) containers/$(DEPDIR) 405 416 @: > containers/$(DEPDIR)/$(am__dirstamp) 417 containers/libcfa_d_a-maybe.$(OBJEXT): containers/$(am__dirstamp) \ 418 containers/$(DEPDIR)/$(am__dirstamp) 406 419 containers/libcfa_d_a-pair.$(OBJEXT): containers/$(am__dirstamp) \ 420 containers/$(DEPDIR)/$(am__dirstamp) 421 containers/libcfa_d_a-result.$(OBJEXT): containers/$(am__dirstamp) \ 407 422 containers/$(DEPDIR)/$(am__dirstamp) 408 423 containers/libcfa_d_a-vector.$(OBJEXT): containers/$(am__dirstamp) \ … … 426 441 concurrency/$(am__dirstamp) \ 427 442 concurrency/$(DEPDIR)/$(am__dirstamp) 443 concurrency/libcfa_d_a-alarm.$(OBJEXT): concurrency/$(am__dirstamp) \ 444 concurrency/$(DEPDIR)/$(am__dirstamp) 428 445 concurrency/libcfa_d_a-invoke.$(OBJEXT): concurrency/$(am__dirstamp) \ 446 concurrency/$(DEPDIR)/$(am__dirstamp) 447 concurrency/libcfa_d_a-preemption.$(OBJEXT): \ 448 concurrency/$(am__dirstamp) \ 429 449 concurrency/$(DEPDIR)/$(am__dirstamp) 430 450 libcfa-d.a: $(libcfa_d_a_OBJECTS) $(libcfa_d_a_DEPENDENCIES) $(EXTRA_libcfa_d_a_DEPENDENCIES) … … 434 454 libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \ 435 455 libhdr/$(DEPDIR)/$(am__dirstamp) 456 containers/libcfa_a-maybe.$(OBJEXT): containers/$(am__dirstamp) \ 457 containers/$(DEPDIR)/$(am__dirstamp) 436 458 containers/libcfa_a-pair.$(OBJEXT): containers/$(am__dirstamp) \ 459 containers/$(DEPDIR)/$(am__dirstamp) 460 containers/libcfa_a-result.$(OBJEXT): containers/$(am__dirstamp) \ 437 461 containers/$(DEPDIR)/$(am__dirstamp) 438 462 containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \ … … 446 470 concurrency/libcfa_a-monitor.$(OBJEXT): concurrency/$(am__dirstamp) \ 447 471 concurrency/$(DEPDIR)/$(am__dirstamp) 472 concurrency/libcfa_a-alarm.$(OBJEXT): concurrency/$(am__dirstamp) \ 473 concurrency/$(DEPDIR)/$(am__dirstamp) 448 474 concurrency/libcfa_a-invoke.$(OBJEXT): concurrency/$(am__dirstamp) \ 475 concurrency/$(DEPDIR)/$(am__dirstamp) 476 concurrency/libcfa_a-preemption.$(OBJEXT): \ 477 concurrency/$(am__dirstamp) \ 449 478 concurrency/$(DEPDIR)/$(am__dirstamp) 450 479 libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES) … … 456 485 -rm -f *.$(OBJEXT) 457 486 -rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) 487 -rm -f concurrency/libcfa_a-alarm.$(OBJEXT) 458 488 -rm -f concurrency/libcfa_a-coroutine.$(OBJEXT) 459 489 -rm -f concurrency/libcfa_a-invoke.$(OBJEXT) 460 490 -rm -f concurrency/libcfa_a-kernel.$(OBJEXT) 461 491 -rm -f concurrency/libcfa_a-monitor.$(OBJEXT) 492 -rm -f concurrency/libcfa_a-preemption.$(OBJEXT) 462 493 -rm -f concurrency/libcfa_a-thread.$(OBJEXT) 494 -rm -f concurrency/libcfa_d_a-alarm.$(OBJEXT) 463 495 -rm -f concurrency/libcfa_d_a-coroutine.$(OBJEXT) 464 496 -rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT) 465 497 -rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT) 466 498 -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT) 499 -rm -f concurrency/libcfa_d_a-preemption.$(OBJEXT) 467 500 -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT) 501 -rm -f containers/libcfa_a-maybe.$(OBJEXT) 468 502 -rm -f containers/libcfa_a-pair.$(OBJEXT) 503 -rm -f containers/libcfa_a-result.$(OBJEXT) 469 504 -rm -f containers/libcfa_a-vector.$(OBJEXT) 505 -rm -f containers/libcfa_d_a-maybe.$(OBJEXT) 470 506 -rm -f containers/libcfa_d_a-pair.$(OBJEXT) 507 -rm -f containers/libcfa_d_a-result.$(OBJEXT) 471 508 -rm -f containers/libcfa_d_a-vector.$(OBJEXT) 472 509 -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT) … … 497 534 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@ 498 535 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@ 536 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@ 499 537 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutine.Po@am__quote@ 500 538 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-invoke.Po@am__quote@ 501 539 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-kernel.Po@am__quote@ 502 540 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-monitor.Po@am__quote@ 541 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-preemption.Po@am__quote@ 503 542 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-thread.Po@am__quote@ 543 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-alarm.Po@am__quote@ 504 544 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po@am__quote@ 505 545 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-invoke.Po@am__quote@ 506 546 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-kernel.Po@am__quote@ 507 547 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@ 548 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-preemption.Po@am__quote@ 508 549 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread.Po@am__quote@ 550 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-maybe.Po@am__quote@ 509 551 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-pair.Po@am__quote@ 552 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-result.Po@am__quote@ 510 553 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@ 554 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-maybe.Po@am__quote@ 511 555 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-pair.Po@am__quote@ 556 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-result.Po@am__quote@ 512 557 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@ 513 558 @AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@ … … 581 626 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_d_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 582 627 628 libcfa_d_a-assert.o: assert.c 629 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 630 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 631 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.o' libtool=no @AMDEPBACKSLASH@ 632 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 633 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 634 635 libcfa_d_a-assert.obj: assert.c 636 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 637 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 638 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 639 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 640 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 641 642 libcfa_d_a-fstream.o: fstream.c 643 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-fstream.Tpo -c -o libcfa_d_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 644 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-fstream.Tpo $(DEPDIR)/libcfa_d_a-fstream.Po 645 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_d_a-fstream.o' libtool=no @AMDEPBACKSLASH@ 646 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 647 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 648 649 libcfa_d_a-fstream.obj: fstream.c 650 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-fstream.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-fstream.Tpo -c -o libcfa_d_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 651 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-fstream.Tpo $(DEPDIR)/libcfa_d_a-fstream.Po 652 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_d_a-fstream.obj' libtool=no @AMDEPBACKSLASH@ 653 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 654 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 655 656 libcfa_d_a-iostream.o: iostream.c 657 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iostream.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-iostream.Tpo -c -o libcfa_d_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 658 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iostream.Tpo $(DEPDIR)/libcfa_d_a-iostream.Po 659 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_d_a-iostream.o' libtool=no @AMDEPBACKSLASH@ 660 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 661 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 662 663 libcfa_d_a-iostream.obj: iostream.c 664 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iostream.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-iostream.Tpo -c -o libcfa_d_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 665 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iostream.Tpo $(DEPDIR)/libcfa_d_a-iostream.Po 666 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_d_a-iostream.obj' libtool=no @AMDEPBACKSLASH@ 667 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 668 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 669 670 libcfa_d_a-iterator.o: iterator.c 671 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iterator.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-iterator.Tpo -c -o libcfa_d_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 672 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iterator.Tpo $(DEPDIR)/libcfa_d_a-iterator.Po 673 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_d_a-iterator.o' libtool=no @AMDEPBACKSLASH@ 674 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 675 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 676 677 libcfa_d_a-iterator.obj: iterator.c 678 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iterator.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-iterator.Tpo -c -o libcfa_d_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 679 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iterator.Tpo $(DEPDIR)/libcfa_d_a-iterator.Po 680 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_d_a-iterator.obj' libtool=no @AMDEPBACKSLASH@ 681 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 682 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 683 583 684 libcfa_d_a-limits.o: limits.c 584 685 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-limits.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-limits.Tpo -c -o libcfa_d_a-limits.o `test -f 'limits.c' || echo '$(srcdir)/'`limits.c … … 595 696 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi` 596 697 698 libcfa_d_a-math.o: math.c 699 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 700 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 701 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.o' libtool=no @AMDEPBACKSLASH@ 702 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 703 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 704 705 libcfa_d_a-math.obj: math.c 706 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 707 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 708 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.obj' libtool=no @AMDEPBACKSLASH@ 709 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 710 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 711 712 libcfa_d_a-rational.o: rational.c 713 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 714 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-rational.Tpo $(DEPDIR)/libcfa_d_a-rational.Po 715 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_d_a-rational.o' libtool=no @AMDEPBACKSLASH@ 716 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 717 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 718 719 libcfa_d_a-rational.obj: rational.c 720 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 721 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-rational.Tpo $(DEPDIR)/libcfa_d_a-rational.Po 722 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_d_a-rational.obj' libtool=no @AMDEPBACKSLASH@ 723 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 724 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 725 597 726 libcfa_d_a-stdlib.o: stdlib.c 598 727 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-stdlib.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-stdlib.Tpo -c -o libcfa_d_a-stdlib.o `test -f 'stdlib.c' || echo '$(srcdir)/'`stdlib.c … … 609 738 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-stdlib.obj `if test -f 'stdlib.c'; then $(CYGPATH_W) 'stdlib.c'; else $(CYGPATH_W) '$(srcdir)/stdlib.c'; fi` 610 739 611 libcfa_d_a-math.o: math.c 612 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 613 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 614 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.o' libtool=no @AMDEPBACKSLASH@ 615 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 616 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 617 618 libcfa_d_a-math.obj: math.c 619 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 620 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 621 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.obj' libtool=no @AMDEPBACKSLASH@ 622 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 623 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 624 625 libcfa_d_a-iostream.o: iostream.c 626 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iostream.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-iostream.Tpo -c -o libcfa_d_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 627 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iostream.Tpo $(DEPDIR)/libcfa_d_a-iostream.Po 628 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_d_a-iostream.o' libtool=no @AMDEPBACKSLASH@ 629 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 630 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 631 632 libcfa_d_a-iostream.obj: iostream.c 633 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iostream.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-iostream.Tpo -c -o libcfa_d_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 634 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iostream.Tpo $(DEPDIR)/libcfa_d_a-iostream.Po 635 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_d_a-iostream.obj' libtool=no @AMDEPBACKSLASH@ 636 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 637 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 638 639 libcfa_d_a-fstream.o: fstream.c 640 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-fstream.Tpo -c -o libcfa_d_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 641 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-fstream.Tpo $(DEPDIR)/libcfa_d_a-fstream.Po 642 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_d_a-fstream.o' libtool=no @AMDEPBACKSLASH@ 643 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 644 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 645 646 libcfa_d_a-fstream.obj: fstream.c 647 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-fstream.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-fstream.Tpo -c -o libcfa_d_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 648 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-fstream.Tpo $(DEPDIR)/libcfa_d_a-fstream.Po 649 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_d_a-fstream.obj' libtool=no @AMDEPBACKSLASH@ 650 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 651 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 652 653 libcfa_d_a-iterator.o: iterator.c 654 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iterator.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-iterator.Tpo -c -o libcfa_d_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 655 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iterator.Tpo $(DEPDIR)/libcfa_d_a-iterator.Po 656 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_d_a-iterator.o' libtool=no @AMDEPBACKSLASH@ 657 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 658 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 659 660 libcfa_d_a-iterator.obj: iterator.c 661 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-iterator.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-iterator.Tpo -c -o libcfa_d_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 662 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-iterator.Tpo $(DEPDIR)/libcfa_d_a-iterator.Po 663 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_d_a-iterator.obj' libtool=no @AMDEPBACKSLASH@ 664 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 665 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 666 667 libcfa_d_a-rational.o: rational.c 668 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 669 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-rational.Tpo $(DEPDIR)/libcfa_d_a-rational.Po 670 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_d_a-rational.o' libtool=no @AMDEPBACKSLASH@ 671 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 672 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 673 674 libcfa_d_a-rational.obj: rational.c 675 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 676 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-rational.Tpo $(DEPDIR)/libcfa_d_a-rational.Po 677 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_d_a-rational.obj' libtool=no @AMDEPBACKSLASH@ 678 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 679 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 680 681 libcfa_d_a-assert.o: assert.c 682 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 683 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 684 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.o' libtool=no @AMDEPBACKSLASH@ 685 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 686 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 687 688 libcfa_d_a-assert.obj: assert.c 689 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 690 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 691 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 692 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 693 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 740 containers/libcfa_d_a-maybe.o: containers/maybe.c 741 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-maybe.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-maybe.Tpo -c -o containers/libcfa_d_a-maybe.o `test -f 'containers/maybe.c' || echo '$(srcdir)/'`containers/maybe.c 742 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-maybe.Tpo containers/$(DEPDIR)/libcfa_d_a-maybe.Po 743 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/maybe.c' object='containers/libcfa_d_a-maybe.o' libtool=no @AMDEPBACKSLASH@ 744 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 745 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-maybe.o `test -f 'containers/maybe.c' || echo '$(srcdir)/'`containers/maybe.c 746 747 containers/libcfa_d_a-maybe.obj: containers/maybe.c 748 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-maybe.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-maybe.Tpo -c -o containers/libcfa_d_a-maybe.obj `if test -f 'containers/maybe.c'; then $(CYGPATH_W) 'containers/maybe.c'; else $(CYGPATH_W) '$(srcdir)/containers/maybe.c'; fi` 749 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-maybe.Tpo containers/$(DEPDIR)/libcfa_d_a-maybe.Po 750 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/maybe.c' object='containers/libcfa_d_a-maybe.obj' libtool=no @AMDEPBACKSLASH@ 751 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 752 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-maybe.obj `if test -f 'containers/maybe.c'; then $(CYGPATH_W) 'containers/maybe.c'; else $(CYGPATH_W) '$(srcdir)/containers/maybe.c'; fi` 694 753 695 754 containers/libcfa_d_a-pair.o: containers/pair.c … … 707 766 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 708 767 768 containers/libcfa_d_a-result.o: containers/result.c 769 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-result.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-result.Tpo -c -o containers/libcfa_d_a-result.o `test -f 'containers/result.c' || echo '$(srcdir)/'`containers/result.c 770 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-result.Tpo containers/$(DEPDIR)/libcfa_d_a-result.Po 771 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/result.c' object='containers/libcfa_d_a-result.o' libtool=no @AMDEPBACKSLASH@ 772 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 773 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-result.o `test -f 'containers/result.c' || echo '$(srcdir)/'`containers/result.c 774 775 containers/libcfa_d_a-result.obj: containers/result.c 776 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-result.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-result.Tpo -c -o containers/libcfa_d_a-result.obj `if test -f 'containers/result.c'; then $(CYGPATH_W) 'containers/result.c'; else $(CYGPATH_W) '$(srcdir)/containers/result.c'; fi` 777 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-result.Tpo containers/$(DEPDIR)/libcfa_d_a-result.Po 778 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/result.c' object='containers/libcfa_d_a-result.obj' libtool=no @AMDEPBACKSLASH@ 779 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 780 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-result.obj `if test -f 'containers/result.c'; then $(CYGPATH_W) 'containers/result.c'; else $(CYGPATH_W) '$(srcdir)/containers/result.c'; fi` 781 709 782 containers/libcfa_d_a-vector.o: containers/vector.c 710 783 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-vector.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-vector.Tpo -c -o containers/libcfa_d_a-vector.o `test -f 'containers/vector.c' || echo '$(srcdir)/'`containers/vector.c … … 777 850 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi` 778 851 852 concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c 853 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo -c -o concurrency/libcfa_d_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c 854 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo concurrency/$(DEPDIR)/libcfa_d_a-alarm.Po 855 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/alarm.c' object='concurrency/libcfa_d_a-alarm.o' libtool=no @AMDEPBACKSLASH@ 856 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 857 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c 858 859 concurrency/libcfa_d_a-alarm.obj: concurrency/alarm.c 860 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-alarm.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo -c -o concurrency/libcfa_d_a-alarm.obj `if test -f 'concurrency/alarm.c'; then $(CYGPATH_W) 'concurrency/alarm.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/alarm.c'; fi` 861 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo concurrency/$(DEPDIR)/libcfa_d_a-alarm.Po 862 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/alarm.c' object='concurrency/libcfa_d_a-alarm.obj' libtool=no @AMDEPBACKSLASH@ 863 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 864 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-alarm.obj `if test -f 'concurrency/alarm.c'; then $(CYGPATH_W) 'concurrency/alarm.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/alarm.c'; fi` 865 779 866 concurrency/libcfa_d_a-invoke.obj: concurrency/invoke.c 780 867 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-invoke.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-invoke.Tpo -c -o concurrency/libcfa_d_a-invoke.obj `if test -f 'concurrency/invoke.c'; then $(CYGPATH_W) 'concurrency/invoke.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/invoke.c'; fi` … … 784 871 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-invoke.obj `if test -f 'concurrency/invoke.c'; then $(CYGPATH_W) 'concurrency/invoke.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/invoke.c'; fi` 785 872 873 concurrency/libcfa_d_a-preemption.o: concurrency/preemption.c 874 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-preemption.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-preemption.Tpo -c -o concurrency/libcfa_d_a-preemption.o `test -f 'concurrency/preemption.c' || echo '$(srcdir)/'`concurrency/preemption.c 875 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-preemption.Tpo concurrency/$(DEPDIR)/libcfa_d_a-preemption.Po 876 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/preemption.c' object='concurrency/libcfa_d_a-preemption.o' libtool=no @AMDEPBACKSLASH@ 877 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 878 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-preemption.o `test -f 'concurrency/preemption.c' || echo '$(srcdir)/'`concurrency/preemption.c 879 880 concurrency/libcfa_d_a-preemption.obj: concurrency/preemption.c 881 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-preemption.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-preemption.Tpo -c -o concurrency/libcfa_d_a-preemption.obj `if test -f 'concurrency/preemption.c'; then $(CYGPATH_W) 'concurrency/preemption.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/preemption.c'; fi` 882 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-preemption.Tpo concurrency/$(DEPDIR)/libcfa_d_a-preemption.Po 883 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/preemption.c' object='concurrency/libcfa_d_a-preemption.obj' libtool=no @AMDEPBACKSLASH@ 884 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 885 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-preemption.obj `if test -f 'concurrency/preemption.c'; then $(CYGPATH_W) 'concurrency/preemption.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/preemption.c'; fi` 886 786 887 libcfa_a-libcfa-prelude.obj: libcfa-prelude.c 787 888 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-libcfa-prelude.obj -MD -MP -MF $(DEPDIR)/libcfa_a-libcfa-prelude.Tpo -c -o libcfa_a-libcfa-prelude.obj `if test -f 'libcfa-prelude.c'; then $(CYGPATH_W) 'libcfa-prelude.c'; else $(CYGPATH_W) '$(srcdir)/libcfa-prelude.c'; fi` … … 819 920 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 820 921 922 libcfa_a-assert.o: assert.c 923 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 924 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 925 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.o' libtool=no @AMDEPBACKSLASH@ 926 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 927 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 928 929 libcfa_a-assert.obj: assert.c 930 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 931 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 932 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 933 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 934 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 935 936 libcfa_a-fstream.o: fstream.c 937 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_a-fstream.Tpo -c -o libcfa_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 938 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-fstream.Tpo $(DEPDIR)/libcfa_a-fstream.Po 939 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_a-fstream.o' libtool=no @AMDEPBACKSLASH@ 940 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 941 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 942 943 libcfa_a-fstream.obj: fstream.c 944 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-fstream.obj -MD -MP -MF $(DEPDIR)/libcfa_a-fstream.Tpo -c -o libcfa_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 945 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-fstream.Tpo $(DEPDIR)/libcfa_a-fstream.Po 946 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_a-fstream.obj' libtool=no @AMDEPBACKSLASH@ 947 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 948 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 949 950 libcfa_a-iostream.o: iostream.c 951 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iostream.o -MD -MP -MF $(DEPDIR)/libcfa_a-iostream.Tpo -c -o libcfa_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 952 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iostream.Tpo $(DEPDIR)/libcfa_a-iostream.Po 953 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_a-iostream.o' libtool=no @AMDEPBACKSLASH@ 954 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 955 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 956 957 libcfa_a-iostream.obj: iostream.c 958 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iostream.obj -MD -MP -MF $(DEPDIR)/libcfa_a-iostream.Tpo -c -o libcfa_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 959 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iostream.Tpo $(DEPDIR)/libcfa_a-iostream.Po 960 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_a-iostream.obj' libtool=no @AMDEPBACKSLASH@ 961 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 962 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 963 964 libcfa_a-iterator.o: iterator.c 965 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iterator.o -MD -MP -MF $(DEPDIR)/libcfa_a-iterator.Tpo -c -o libcfa_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 966 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iterator.Tpo $(DEPDIR)/libcfa_a-iterator.Po 967 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_a-iterator.o' libtool=no @AMDEPBACKSLASH@ 968 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 969 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 970 971 libcfa_a-iterator.obj: iterator.c 972 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iterator.obj -MD -MP -MF $(DEPDIR)/libcfa_a-iterator.Tpo -c -o libcfa_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 973 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iterator.Tpo $(DEPDIR)/libcfa_a-iterator.Po 974 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_a-iterator.obj' libtool=no @AMDEPBACKSLASH@ 975 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 976 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 977 821 978 libcfa_a-limits.o: limits.c 822 979 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-limits.o -MD -MP -MF $(DEPDIR)/libcfa_a-limits.Tpo -c -o libcfa_a-limits.o `test -f 'limits.c' || echo '$(srcdir)/'`limits.c … … 833 990 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi` 834 991 992 libcfa_a-math.o: math.c 993 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 994 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 995 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.o' libtool=no @AMDEPBACKSLASH@ 996 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 997 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 998 999 libcfa_a-math.obj: math.c 1000 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 1001 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 1002 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.obj' libtool=no @AMDEPBACKSLASH@ 1003 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1004 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 1005 1006 libcfa_a-rational.o: rational.c 1007 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_a-rational.Tpo -c -o libcfa_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 1008 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-rational.Tpo $(DEPDIR)/libcfa_a-rational.Po 1009 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_a-rational.o' libtool=no @AMDEPBACKSLASH@ 1010 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1011 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 1012 1013 libcfa_a-rational.obj: rational.c 1014 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-rational.obj -MD -MP -MF $(DEPDIR)/libcfa_a-rational.Tpo -c -o libcfa_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 1015 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-rational.Tpo $(DEPDIR)/libcfa_a-rational.Po 1016 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_a-rational.obj' libtool=no @AMDEPBACKSLASH@ 1017 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1018 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 1019 835 1020 libcfa_a-stdlib.o: stdlib.c 836 1021 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-stdlib.o -MD -MP -MF $(DEPDIR)/libcfa_a-stdlib.Tpo -c -o libcfa_a-stdlib.o `test -f 'stdlib.c' || echo '$(srcdir)/'`stdlib.c … … 847 1032 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-stdlib.obj `if test -f 'stdlib.c'; then $(CYGPATH_W) 'stdlib.c'; else $(CYGPATH_W) '$(srcdir)/stdlib.c'; fi` 848 1033 849 libcfa_a-math.o: math.c 850 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 851 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 852 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.o' libtool=no @AMDEPBACKSLASH@ 853 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 854 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 855 856 libcfa_a-math.obj: math.c 857 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 858 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 859 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.obj' libtool=no @AMDEPBACKSLASH@ 860 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 861 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 862 863 libcfa_a-iostream.o: iostream.c 864 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iostream.o -MD -MP -MF $(DEPDIR)/libcfa_a-iostream.Tpo -c -o libcfa_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 865 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iostream.Tpo $(DEPDIR)/libcfa_a-iostream.Po 866 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_a-iostream.o' libtool=no @AMDEPBACKSLASH@ 867 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 868 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iostream.o `test -f 'iostream.c' || echo '$(srcdir)/'`iostream.c 869 870 libcfa_a-iostream.obj: iostream.c 871 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iostream.obj -MD -MP -MF $(DEPDIR)/libcfa_a-iostream.Tpo -c -o libcfa_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 872 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iostream.Tpo $(DEPDIR)/libcfa_a-iostream.Po 873 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iostream.c' object='libcfa_a-iostream.obj' libtool=no @AMDEPBACKSLASH@ 874 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 875 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iostream.obj `if test -f 'iostream.c'; then $(CYGPATH_W) 'iostream.c'; else $(CYGPATH_W) '$(srcdir)/iostream.c'; fi` 876 877 libcfa_a-fstream.o: fstream.c 878 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_a-fstream.Tpo -c -o libcfa_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 879 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-fstream.Tpo $(DEPDIR)/libcfa_a-fstream.Po 880 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_a-fstream.o' libtool=no @AMDEPBACKSLASH@ 881 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 882 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c 883 884 libcfa_a-fstream.obj: fstream.c 885 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-fstream.obj -MD -MP -MF $(DEPDIR)/libcfa_a-fstream.Tpo -c -o libcfa_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 886 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-fstream.Tpo $(DEPDIR)/libcfa_a-fstream.Po 887 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fstream.c' object='libcfa_a-fstream.obj' libtool=no @AMDEPBACKSLASH@ 888 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 889 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-fstream.obj `if test -f 'fstream.c'; then $(CYGPATH_W) 'fstream.c'; else $(CYGPATH_W) '$(srcdir)/fstream.c'; fi` 890 891 libcfa_a-iterator.o: iterator.c 892 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iterator.o -MD -MP -MF $(DEPDIR)/libcfa_a-iterator.Tpo -c -o libcfa_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 893 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iterator.Tpo $(DEPDIR)/libcfa_a-iterator.Po 894 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_a-iterator.o' libtool=no @AMDEPBACKSLASH@ 895 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 896 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iterator.o `test -f 'iterator.c' || echo '$(srcdir)/'`iterator.c 897 898 libcfa_a-iterator.obj: iterator.c 899 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-iterator.obj -MD -MP -MF $(DEPDIR)/libcfa_a-iterator.Tpo -c -o libcfa_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 900 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-iterator.Tpo $(DEPDIR)/libcfa_a-iterator.Po 901 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iterator.c' object='libcfa_a-iterator.obj' libtool=no @AMDEPBACKSLASH@ 902 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 903 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-iterator.obj `if test -f 'iterator.c'; then $(CYGPATH_W) 'iterator.c'; else $(CYGPATH_W) '$(srcdir)/iterator.c'; fi` 904 905 libcfa_a-rational.o: rational.c 906 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_a-rational.Tpo -c -o libcfa_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 907 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-rational.Tpo $(DEPDIR)/libcfa_a-rational.Po 908 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_a-rational.o' libtool=no @AMDEPBACKSLASH@ 909 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 910 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c 911 912 libcfa_a-rational.obj: rational.c 913 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-rational.obj -MD -MP -MF $(DEPDIR)/libcfa_a-rational.Tpo -c -o libcfa_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 914 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-rational.Tpo $(DEPDIR)/libcfa_a-rational.Po 915 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rational.c' object='libcfa_a-rational.obj' libtool=no @AMDEPBACKSLASH@ 916 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 917 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi` 918 919 libcfa_a-assert.o: assert.c 920 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 921 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 922 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.o' libtool=no @AMDEPBACKSLASH@ 923 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 924 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 925 926 libcfa_a-assert.obj: assert.c 927 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 928 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 929 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 930 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 931 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 1034 containers/libcfa_a-maybe.o: containers/maybe.c 1035 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-maybe.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-maybe.Tpo -c -o containers/libcfa_a-maybe.o `test -f 'containers/maybe.c' || echo '$(srcdir)/'`containers/maybe.c 1036 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-maybe.Tpo containers/$(DEPDIR)/libcfa_a-maybe.Po 1037 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/maybe.c' object='containers/libcfa_a-maybe.o' libtool=no @AMDEPBACKSLASH@ 1038 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1039 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-maybe.o `test -f 'containers/maybe.c' || echo '$(srcdir)/'`containers/maybe.c 1040 1041 containers/libcfa_a-maybe.obj: containers/maybe.c 1042 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-maybe.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_a-maybe.Tpo -c -o containers/libcfa_a-maybe.obj `if test -f 'containers/maybe.c'; then $(CYGPATH_W) 'containers/maybe.c'; else $(CYGPATH_W) '$(srcdir)/containers/maybe.c'; fi` 1043 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-maybe.Tpo containers/$(DEPDIR)/libcfa_a-maybe.Po 1044 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/maybe.c' object='containers/libcfa_a-maybe.obj' libtool=no @AMDEPBACKSLASH@ 1045 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1046 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-maybe.obj `if test -f 'containers/maybe.c'; then $(CYGPATH_W) 'containers/maybe.c'; else $(CYGPATH_W) '$(srcdir)/containers/maybe.c'; fi` 932 1047 933 1048 containers/libcfa_a-pair.o: containers/pair.c … … 945 1060 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi` 946 1061 1062 containers/libcfa_a-result.o: containers/result.c 1063 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-result.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-result.Tpo -c -o containers/libcfa_a-result.o `test -f 'containers/result.c' || echo '$(srcdir)/'`containers/result.c 1064 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-result.Tpo containers/$(DEPDIR)/libcfa_a-result.Po 1065 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/result.c' object='containers/libcfa_a-result.o' libtool=no @AMDEPBACKSLASH@ 1066 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1067 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-result.o `test -f 'containers/result.c' || echo '$(srcdir)/'`containers/result.c 1068 1069 containers/libcfa_a-result.obj: containers/result.c 1070 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-result.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_a-result.Tpo -c -o containers/libcfa_a-result.obj `if test -f 'containers/result.c'; then $(CYGPATH_W) 'containers/result.c'; else $(CYGPATH_W) '$(srcdir)/containers/result.c'; fi` 1071 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-result.Tpo containers/$(DEPDIR)/libcfa_a-result.Po 1072 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='containers/result.c' object='containers/libcfa_a-result.obj' libtool=no @AMDEPBACKSLASH@ 1073 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1074 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-result.obj `if test -f 'containers/result.c'; then $(CYGPATH_W) 'containers/result.c'; else $(CYGPATH_W) '$(srcdir)/containers/result.c'; fi` 1075 947 1076 containers/libcfa_a-vector.o: containers/vector.c 948 1077 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-vector.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-vector.Tpo -c -o containers/libcfa_a-vector.o `test -f 'containers/vector.c' || echo '$(srcdir)/'`containers/vector.c … … 1015 1144 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi` 1016 1145 1146 concurrency/libcfa_a-alarm.o: concurrency/alarm.c 1147 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-alarm.Tpo -c -o concurrency/libcfa_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c 1148 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-alarm.Tpo concurrency/$(DEPDIR)/libcfa_a-alarm.Po 1149 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/alarm.c' object='concurrency/libcfa_a-alarm.o' libtool=no @AMDEPBACKSLASH@ 1150 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1151 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c 1152 1153 concurrency/libcfa_a-alarm.obj: concurrency/alarm.c 1154 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-alarm.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-alarm.Tpo -c -o concurrency/libcfa_a-alarm.obj `if test -f 'concurrency/alarm.c'; then $(CYGPATH_W) 'concurrency/alarm.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/alarm.c'; fi` 1155 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-alarm.Tpo concurrency/$(DEPDIR)/libcfa_a-alarm.Po 1156 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/alarm.c' object='concurrency/libcfa_a-alarm.obj' libtool=no @AMDEPBACKSLASH@ 1157 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1158 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-alarm.obj `if test -f 'concurrency/alarm.c'; then $(CYGPATH_W) 'concurrency/alarm.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/alarm.c'; fi` 1159 1017 1160 concurrency/libcfa_a-invoke.obj: concurrency/invoke.c 1018 1161 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-invoke.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-invoke.Tpo -c -o concurrency/libcfa_a-invoke.obj `if test -f 'concurrency/invoke.c'; then $(CYGPATH_W) 'concurrency/invoke.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/invoke.c'; fi` … … 1021 1164 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1022 1165 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-invoke.obj `if test -f 'concurrency/invoke.c'; then $(CYGPATH_W) 'concurrency/invoke.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/invoke.c'; fi` 1166 1167 concurrency/libcfa_a-preemption.o: concurrency/preemption.c 1168 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-preemption.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-preemption.Tpo -c -o concurrency/libcfa_a-preemption.o `test -f 'concurrency/preemption.c' || echo '$(srcdir)/'`concurrency/preemption.c 1169 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-preemption.Tpo concurrency/$(DEPDIR)/libcfa_a-preemption.Po 1170 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/preemption.c' object='concurrency/libcfa_a-preemption.o' libtool=no @AMDEPBACKSLASH@ 1171 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1172 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-preemption.o `test -f 'concurrency/preemption.c' || echo '$(srcdir)/'`concurrency/preemption.c 1173 1174 concurrency/libcfa_a-preemption.obj: concurrency/preemption.c 1175 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-preemption.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-preemption.Tpo -c -o concurrency/libcfa_a-preemption.obj `if test -f 'concurrency/preemption.c'; then $(CYGPATH_W) 'concurrency/preemption.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/preemption.c'; fi` 1176 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-preemption.Tpo concurrency/$(DEPDIR)/libcfa_a-preemption.Po 1177 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/preemption.c' object='concurrency/libcfa_a-preemption.obj' libtool=no @AMDEPBACKSLASH@ 1178 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1179 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-preemption.obj `if test -f 'concurrency/preemption.c'; then $(CYGPATH_W) 'concurrency/preemption.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/preemption.c'; fi` 1023 1180 install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS) 1024 1181 @$(NORMAL_INSTALL) … … 1271 1428 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1272 1429 1430 libcfa_a-exception.o : exception.c 1431 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1432 1273 1433 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 1434 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1435 1436 libcfa_d_a-exception.o : exception.c 1274 1437 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1275 1438 -
src/libcfa/concurrency/coroutine
r9c951e3 rb1e63ac5 71 71 // Suspend implementation inlined for performance 72 72 static inline void suspend() { 73 coroutine_desc * src = this_coroutine(); // optimization73 coroutine_desc * src = this_coroutine(); // optimization 74 74 75 75 assertf( src->last != 0, … … 91 91 coroutine_desc * dst = get_coroutine(cor); 92 92 93 if( unlikely(!dst->stack.base) ) {93 if( unlikely(!dst->stack.base) ) { 94 94 create_stack(&dst->stack, dst->stack.size); 95 95 CtxStart(cor, CtxInvokeCoroutine); 96 96 } 97 97 98 // not resuming self ?98 // not resuming self ? 99 99 if ( src != dst ) { 100 100 assertf( dst->state != Halted , … … 103 103 src->name, src, dst->name, dst ); 104 104 105 // set last resumer105 // set last resumer 106 106 dst->last = src; 107 107 } // if 108 108 109 // always done for performance testing109 // always done for performance testing 110 110 CoroutineCtxSwitch( src, dst ); 111 111 } … … 114 114 coroutine_desc * src = this_coroutine(); // optimization 115 115 116 // not resuming self ?116 // not resuming self ? 117 117 if ( src != dst ) { 118 118 assertf( dst->state != Halted , … … 121 121 src->name, src, dst->name, dst ); 122 122 123 // set last resumer123 // set last resumer 124 124 dst->last = src; 125 125 } // if 126 126 127 // always done for performance testing127 // always done for performance testing 128 128 CoroutineCtxSwitch( src, dst ); 129 129 } -
src/libcfa/concurrency/kernel
r9c951e3 rb1e63ac5 28 28 //----------------------------------------------------------------------------- 29 29 // Locks 30 bool try_lock( spinlock * ); 30 31 void lock( spinlock * ); 31 32 void unlock( spinlock * ); … … 85 86 86 87 struct FinishAction finish; 88 89 struct alarm_node_t * preemption_alarm; 90 unsigned int preemption; 91 92 unsigned short disable_preempt_count; 93 94 bool pending_preemption; 87 95 }; 88 96 … … 94 102 95 103 // Local Variables: // 96 // mode: c//97 // tab-width: 4//104 // mode: CFA // 105 // tab-width: 6 // 98 106 // End: // -
src/libcfa/concurrency/kernel.c
r9c951e3 rb1e63ac5 36 36 //CFA Includes 37 37 #include "libhdr.h" 38 #include "preemption.h" 38 39 39 40 //Private includes … … 47 48 KERNEL_STORAGE(processorCtx_t, systemProcessorCtx); 48 49 KERNEL_STORAGE(cluster, systemCluster); 49 KERNEL_STORAGE( processor, systemProcessor);50 KERNEL_STORAGE(system_proc_t, systemProcessor); 50 51 KERNEL_STORAGE(thread_desc, mainThread); 51 52 KERNEL_STORAGE(machine_context_t, mainThread_context); 52 53 53 54 cluster * systemCluster; 54 processor* systemProcessor;55 system_proc_t * systemProcessor; 55 56 thread_desc * mainThread; 56 57 … … 118 119 // Processor coroutine 119 120 void ?{}(processorCtx_t * this, processor * proc) { 120 (&this->__cor){ };121 (&this->__cor){ "Processor" }; 121 122 this->proc = proc; 122 123 proc->runner = this; … … 139 140 (&this->terminated){}; 140 141 this->is_terminated = false; 142 this->preemption_alarm = NULL; 143 this->preemption = default_preemption(); 144 this->disable_preempt_count = 1; //Start with interrupts disabled 145 this->pending_preemption = false; 141 146 142 147 start( this ); … … 149 154 (&this->terminated){}; 150 155 this->is_terminated = false; 156 this->disable_preempt_count = 0; 157 this->pending_preemption = false; 151 158 152 159 this->runner = runner; 153 160 LIB_DEBUG_PRINT_SAFE("Kernel : constructing processor context %p\n", runner); 154 161 runner{ this }; 162 } 163 164 void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) { 165 (&this->alarms){}; 166 (&this->alarm_lock){}; 167 this->pending_alarm = false; 168 169 (&this->proc){ cltr, runner }; 155 170 } 156 171 … … 178 193 void main(processorCtx_t * runner) { 179 194 processor * this = runner->proc; 195 180 196 LIB_DEBUG_PRINT_SAFE("Kernel : core %p starting\n", this); 181 197 182 thread_desc * readyThread = NULL;183 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )184 198 { 185 readyThread = nextThread( this->cltr ); 186 187 if(readyThread) 199 // Setup preemption data 200 preemption_scope scope = { this }; 201 202 LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this); 203 204 thread_desc * readyThread = NULL; 205 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ ) 188 206 { 189 runThread(this, readyThread); 190 191 //Some actions need to be taken from the kernel 192 finishRunning(this); 193 194 spin_count = 0; 195 } 196 else 197 { 198 spin(this, &spin_count); 199 } 200 } 201 202 LIB_DEBUG_PRINT_SAFE("Kernel : core %p unlocking thread\n", this); 207 readyThread = nextThread( this->cltr ); 208 209 if(readyThread) 210 { 211 runThread(this, readyThread); 212 213 //Some actions need to be taken from the kernel 214 finishRunning(this); 215 216 spin_count = 0; 217 } 218 else 219 { 220 spin(this, &spin_count); 221 } 222 } 223 224 LIB_DEBUG_PRINT_SAFE("Kernel : core %p stopping\n", this); 225 } 226 203 227 signal( &this->terminated ); 204 228 LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this); … … 287 311 // appropriate stack. 288 312 proc_cor_storage.__cor.state = Active; 289 main( &proc_cor_storage );290 proc_cor_storage.__cor.state = Halted;313 main( &proc_cor_storage ); 314 proc_cor_storage.__cor.state = Halted; 291 315 292 316 // Main routine of the core returned, the core is now fully terminated … … 299 323 LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this); 300 324 301 // pthread_attr_t attributes;302 // pthread_attr_init( &attributes );303 304 325 pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this ); 305 306 // pthread_attr_destroy( &attributes );307 326 308 327 LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this); … … 314 333 if( !thrd ) return; 315 334 316 assertf( thrd->next == NULL, "Expected null got %p", thrd->next );335 verifyf( thrd->next == NULL, "Expected null got %p", thrd->next ); 317 336 318 lock( &systemProcessor-> cltr->lock );319 append( &systemProcessor-> cltr->ready_queue, thrd );320 unlock( &systemProcessor-> cltr->lock );337 lock( &systemProcessor->proc.cltr->lock ); 338 append( &systemProcessor->proc.cltr->ready_queue, thrd ); 339 unlock( &systemProcessor->proc.cltr->lock ); 321 340 } 322 341 … … 367 386 } 368 387 388 //============================================================================================= 389 // Kernel Setup logic 390 //============================================================================================= 369 391 //----------------------------------------------------------------------------- 370 392 // Kernel boot procedures … … 379 401 mainThread{ &info }; 380 402 403 LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n"); 404 405 // Enable preemption 406 kernel_start_preemption(); 407 381 408 // Initialize the system cluster 382 409 systemCluster = (cluster *)&systemCluster_storage; 383 410 systemCluster{}; 384 411 412 LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n"); 413 385 414 // Initialize the system processor and the system processor ctx 386 415 // (the coroutine that contains the processing control flow) 387 systemProcessor = ( processor*)&systemProcessor_storage;416 systemProcessor = (system_proc_t *)&systemProcessor_storage; 388 417 systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtx_storage }; 389 418 390 419 // Add the main thread to the ready queue 391 // once resume is called on systemProcessor-> ctxthe mainThread needs to be scheduled like any normal thread420 // once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread 392 421 ScheduleThread(mainThread); 393 422 394 423 //initialize the global state variables 395 this_processor = systemProcessor;424 this_processor = &systemProcessor->proc; 396 425 this_processor->current_thread = mainThread; 397 426 this_processor->current_coroutine = &mainThread->cor; … … 400 429 // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that 401 430 // mainThread is on the ready queue when this call is made. 402 resume( systemProcessor->runner);431 resume( systemProcessor->proc.runner ); 403 432 404 433 … … 414 443 // When its coroutine terminates, it return control to the mainThread 415 444 // which is currently here 416 systemProcessor-> is_terminated = true;445 systemProcessor->proc.is_terminated = true; 417 446 suspend(); 418 447 … … 421 450 // Destroy the system processor and its context in reverse order of construction 422 451 // These were manually constructed so we need manually destroy them 423 ^(systemProcessor-> runner){};452 ^(systemProcessor->proc.runner){}; 424 453 ^(systemProcessor){}; 425 454 … … 484 513 } 485 514 515 //============================================================================================= 516 // Kernel Utilities 517 //============================================================================================= 486 518 //----------------------------------------------------------------------------- 487 519 // Locks … … 491 523 void ^?{}( spinlock * this ) { 492 524 525 } 526 527 bool try_lock( spinlock * this ) { 528 return this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0; 493 529 } 494 530 … … 541 577 542 578 void append( __thread_queue_t * this, thread_desc * t ) { 543 assert(this->tail != NULL);579 verify(this->tail != NULL); 544 580 *this->tail = t; 545 581 this->tail = &t->next; … … 563 599 564 600 void push( __condition_stack_t * this, __condition_criterion_t * t ) { 565 assert( !t->next );601 verify( !t->next ); 566 602 t->next = this->top; 567 603 this->top = t; -
src/libcfa/concurrency/kernel_private.h
r9c951e3 rb1e63ac5 21 21 #include "thread" 22 22 23 #include "alarm.h" 24 25 #include "libhdr.h" 26 23 27 //----------------------------------------------------------------------------- 24 28 // Scheduler … … 35 39 //----------------------------------------------------------------------------- 36 40 // Processor 37 structprocessorCtx_t {41 coroutine processorCtx_t { 38 42 processor * proc; 39 coroutine_desc __cor;40 43 }; 41 42 DECL_COROUTINE(processorCtx_t);43 44 44 45 void main(processorCtx_t *); … … 47 48 void finishRunning(processor * this); 48 49 void spin(processor * this, unsigned int * spin_count); 50 51 struct system_proc_t { 52 processor proc; 53 54 alarm_list_t alarms; 55 spinlock alarm_lock; 56 57 bool pending_alarm; 58 }; 59 60 extern cluster * systemCluster; 61 extern system_proc_t * systemProcessor; 62 extern thread_local processor * this_processor; 63 64 static inline void disable_interrupts() { 65 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST ); 66 assert( prev != (unsigned short) -1 ); 67 } 68 69 static inline void enable_interrupts_noRF() { 70 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST ); 71 verify( prev != (unsigned short) 0 ); 72 } 73 74 static inline void enable_interrupts() { 75 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST ); 76 verify( prev != (unsigned short) 0 ); 77 if( prev == 1 && this_processor->pending_preemption ) { 78 ScheduleInternal( this_processor->current_thread ); 79 this_processor->pending_preemption = false; 80 } 81 } 49 82 50 83 //----------------------------------------------------------------------------- -
src/libcfa/concurrency/monitor
r9c951e3 rb1e63ac5 26 26 static inline void ?{}(monitor_desc * this) { 27 27 this->owner = NULL; 28 this->stack_owner = NULL;28 this->stack_owner = NULL; 29 29 this->recursion = 0; 30 30 } … … 33 33 monitor_desc ** m; 34 34 int count; 35 monitor_desc ** prev_mntrs;36 unsigned short prev_count;35 monitor_desc ** prev_mntrs; 36 unsigned short prev_count; 37 37 }; 38 38 … … 59 59 unsigned short count; //Number of criterions in the criteria 60 60 __condition_node_t * next; //Intrusive linked list Next field 61 uintptr_t user_info; //Custom user info accessible before signalling 61 62 }; 62 63 … … 85 86 } 86 87 87 void wait( condition * this ); 88 void signal( condition * this ); 88 void wait( condition * this, uintptr_t user_info = 0 ); 89 bool signal( condition * this ); 90 bool signal_block( condition * this ); 91 static inline bool is_empty( condition * this ) { return !this->blocked.head; } 92 uintptr_t front( condition * this ); 93 94 struct __acceptable_t { 95 void (*func)(void); 96 unsigned short count; 97 monitor_desc * monitors[1]; 98 }; 99 100 void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ); 101 89 102 #endif //MONITOR_H -
src/libcfa/concurrency/monitor.c
r9c951e3 rb1e63ac5 56 56 else if( this->owner == thrd) { 57 57 //We already have the monitor, just not how many times we took it 58 assert( this->recursion > 0 );58 verify( this->recursion > 0 ); 59 59 this->recursion += 1; 60 60 } … … 62 62 //Some one else has the monitor, wait in line for it 63 63 append( &this->entry_queue, thrd ); 64 LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd); 64 65 ScheduleInternal( &this->lock ); 65 66 … … 77 78 lock( &this->lock ); 78 79 79 thread_desc * thrd = this_thread();80 81 80 LIB_DEBUG_PRINT_SAFE("%p Leaving %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion); 82 assertf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i)", thrd, this->owner, this->recursion );81 verifyf( this_thread() == this->owner, "Expected owner to be %p, got %p (r: %i)", this_thread(), this->owner, this->recursion ); 83 82 84 83 //Leaving a recursion level, decrement the counter … … 97 96 unlock( &this->lock ); 98 97 98 LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner); 99 99 100 //We need to wake-up the thread 100 101 ScheduleThread( new_owner ); … … 134 135 } 135 136 136 void debug_break() __attribute__(( noinline )) 137 { 138 137 void ?{}(__condition_node_t * this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info ) { 138 this->waiting_thread = waiting_thread; 139 this->count = count; 140 this->next = NULL; 141 this->user_info = user_info; 142 } 143 144 void ?{}(__condition_criterion_t * this ) { 145 this->ready = false; 146 this->target = NULL; 147 this->owner = NULL; 148 this->next = NULL; 149 } 150 151 void ?{}(__condition_criterion_t * this, monitor_desc * target, __condition_node_t * owner ) { 152 this->ready = false; 153 this->target = target; 154 this->owner = owner; 155 this->next = NULL; 139 156 } 140 157 141 158 //----------------------------------------------------------------------------- 142 159 // Internal scheduling 143 void wait( condition * this ) {160 void wait( condition * this, uintptr_t user_info = 0 ) { 144 161 LIB_DEBUG_PRINT_SAFE("Waiting\n"); 145 162 … … 148 165 //Check that everything is as expected 149 166 assertf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors ); 150 assertf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count ); 167 verifyf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count ); 168 verifyf( this->monitor_count < 32u, "Excessive monitor count (%i)", this->monitor_count ); 151 169 152 170 unsigned short count = this->monitor_count; … … 156 174 LIB_DEBUG_PRINT_SAFE("count %i\n", count); 157 175 158 __condition_node_t waiter; 159 waiter.waiting_thread = this_thread(); 160 waiter.count = count; 161 waiter.next = NULL; 176 __condition_node_t waiter = { this_thread(), count, user_info }; 162 177 163 178 __condition_criterion_t criteria[count]; 164 179 for(int i = 0; i < count; i++) { 165 criteria[i].ready = false; 166 criteria[i].target = this->monitors[i]; 167 criteria[i].owner = &waiter; 168 criteria[i].next = NULL; 180 (&criteria[i]){ this->monitors[i], &waiter }; 169 181 LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] ); 170 182 } … … 184 196 } 185 197 186 debug_break();187 188 198 for( int i = 0; i < count; i++) { 189 199 thread_desc * new_owner = next_thread( this->monitors[i] ); 190 200 thread_count = insert_unique( threads, thread_count, new_owner ); 191 201 } 192 193 debug_break();194 202 195 203 LIB_DEBUG_PRINT_SAFE("Will unblock: "); … … 212 220 } 213 221 214 voidsignal( condition * this ) {215 if( !this->blocked.head) {222 bool signal( condition * this ) { 223 if( is_empty( this ) ) { 216 224 LIB_DEBUG_PRINT_SAFE("Nothing to signal\n"); 217 return ;225 return false; 218 226 } 219 227 220 228 //Check that everything is as expected 221 assert( this->monitors );222 assert( this->monitor_count != 0 );229 verify( this->monitors ); 230 verify( this->monitor_count != 0 ); 223 231 224 232 unsigned short count = this->monitor_count; 225 233 234 //Some more checking in debug 226 235 LIB_DEBUG_DO( 227 236 thread_desc * this_thrd = this_thread(); … … 237 246 ); 238 247 248 //Lock all the monitors 239 249 lock_all( this->monitors, NULL, count ); 240 250 LIB_DEBUG_PRINT_SAFE("Signalling"); 241 251 252 //Pop the head of the waiting queue 242 253 __condition_node_t * node = pop_head( &this->blocked ); 254 255 //Add the thread to the proper AS stack 243 256 for(int i = 0; i < count; i++) { 244 257 __condition_criterion_t * crit = &node->criteria[i]; … … 250 263 LIB_DEBUG_PRINT_SAFE("\n"); 251 264 265 //Release 252 266 unlock_all( this->monitors, count ); 267 268 return true; 269 } 270 271 bool signal_block( condition * this ) { 272 if( !this->blocked.head ) { 273 LIB_DEBUG_PRINT_SAFE("Nothing to signal\n"); 274 return false; 275 } 276 277 //Check that everything is as expected 278 verifyf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors ); 279 verifyf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count ); 280 281 unsigned short count = this->monitor_count; 282 unsigned int recursions[ count ]; //Save the current recursion levels to restore them later 283 spinlock * locks [ count ]; //We need to pass-in an array of locks to ScheduleInternal 284 285 lock_all( this->monitors, locks, count ); 286 287 //create creteria 288 __condition_node_t waiter = { this_thread(), count, 0 }; 289 290 __condition_criterion_t criteria[count]; 291 for(int i = 0; i < count; i++) { 292 (&criteria[i]){ this->monitors[i], &waiter }; 293 LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] ); 294 push( &criteria[i].target->signal_stack, &criteria[i] ); 295 } 296 297 waiter.criteria = criteria; 298 299 //save contexts 300 save_recursion( this->monitors, recursions, count ); 301 302 //Find the thread to run 303 thread_desc * signallee = pop_head( &this->blocked )->waiting_thread; 304 for(int i = 0; i < count; i++) { 305 set_owner( this->monitors[i], signallee ); 306 } 307 308 LIB_DEBUG_PRINT_SAFE( "Waiting on signal block\n" ); 309 310 //Everything is ready to go to sleep 311 ScheduleInternal( locks, count, &signallee, 1 ); 312 313 314 315 316 LIB_DEBUG_PRINT_SAFE( "Back from signal block\n" ); 317 318 //We are back, restore the owners and recursions 319 lock_all( locks, count ); 320 restore_recursion( this->monitors, recursions, count ); 321 unlock_all( locks, count ); 322 323 return true; 324 } 325 326 uintptr_t front( condition * this ) { 327 verifyf( !is_empty(this), 328 "Attempt to access user data on an empty condition.\n" 329 "Possible cause is not checking if the condition is empty before reading stored data." 330 ); 331 return this->blocked.head->user_info; 332 } 333 334 //----------------------------------------------------------------------------- 335 // Internal scheduling 336 void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ) { 337 // thread_desc * this = this_thread(); 338 339 // unsigned short count = this->current_monitor_count; 340 // unsigned int recursions[ count ]; //Save the current recursion levels to restore them later 341 // spinlock * locks [ count ]; //We need to pass-in an array of locks to ScheduleInternal 342 343 // lock_all( this->current_monitors, locks, count ); 344 345 346 347 348 349 // // // Everything is ready to go to sleep 350 // // ScheduleInternal( locks, count, threads, thread_count ); 351 352 353 // //WE WOKE UP 354 355 356 // //We are back, restore the owners and recursions 357 // lock_all( locks, count ); 358 // restore_recursion( this->monitors, recursions, count ); 359 // unlock_all( locks, count ); 253 360 } 254 361 … … 335 442 336 443 for( int i = 0; i < count; i++ ) { 444 337 445 LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target ); 338 446 if( &criteria[i] == target ) { … … 379 487 380 488 void append( __condition_blocked_queue_t * this, __condition_node_t * c ) { 381 assert(this->tail != NULL);489 verify(this->tail != NULL); 382 490 *this->tail = c; 383 491 this->tail = &c->next; -
src/libcfa/concurrency/thread
r9c951e3 rb1e63ac5 82 82 83 83 void yield(); 84 void yield( unsigned times ); 84 85 85 86 #endif //THREADS_H -
src/libcfa/concurrency/thread.c
r9c951e3 rb1e63ac5 87 87 } 88 88 89 void yield( unsigned times ) { 90 for( unsigned i = 0; i < times; i++ ) { 91 yield(); 92 } 93 } 94 89 95 void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) { 90 96 // set state of current coroutine to inactive -
src/libcfa/containers/vector
r9c951e3 rb1e63ac5 22 22 23 23 //------------------------------------------------------------------------------ 24 //Allocator 25 forall(otype T) 26 struct heap_allocator 27 { 28 T* storage; 29 size_t capacity; 30 }; 31 32 forall(otype T) 33 void ?{}(heap_allocator(T)* this); 34 35 forall(otype T) 36 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs); 37 38 forall(otype T) 39 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs); 40 41 forall(otype T) 42 void ^?{}(heap_allocator(T)* this); 43 44 forall(otype T) 45 void realloc_storage(heap_allocator(T)* this, size_t size); 46 47 forall(otype T) 48 static inline T* data(heap_allocator(T)* this) 49 { 50 return this->storage; 51 } 52 53 //------------------------------------------------------------------------------ 24 54 //Declaration 25 55 trait allocator_c(otype T, otype allocator_t) … … 29 59 }; 30 60 31 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))61 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t)) 32 62 struct vector; 33 63 … … 46 76 void ^?{}(vector(T, allocator_t)* this); 47 77 48 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))78 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t)) 49 79 struct vector 50 80 { … … 136 166 // } 137 167 138 //------------------------------------------------------------------------------139 //Allocator140 forall(otype T)141 struct heap_allocator142 {143 T* storage;144 size_t capacity;145 };146 147 forall(otype T)148 void ?{}(heap_allocator(T)* this);149 150 forall(otype T)151 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);152 153 forall(otype T)154 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);155 156 forall(otype T)157 void ^?{}(heap_allocator(T)* this);158 159 forall(otype T)160 void realloc_storage(heap_allocator(T)* this, size_t size);161 162 forall(otype T)163 static inline T* data(heap_allocator(T)* this)164 {165 return this->storage;166 }167 168 168 #endif // VECTOR_H 169 169 -
src/libcfa/gmp
r9c951e3 rb1e63ac5 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 14 23:47:36201713 // Update Count : 912 // Last Modified On : Sat May 27 09:55:51 2017 13 // Update Count : 14 14 14 // 15 15 … … 22 22 23 23 // constructor 24 void ?{}( Int * this ) { mpz_init( this->mpz ); }25 void ?{}( Int * this, Int init ) { mpz_init_set( this->mpz, init.mpz ); }26 void ?{}( Int * this, zero_t ) { mpz_init_set_si( this->mpz, 0 ); }27 void ?{}( Int * this, one_t ) { mpz_init_set_si( this->mpz, 1 ); }28 void ?{}( Int * this, signed long int init ) { mpz_init_set_si( this->mpz, init ); }29 void ?{}( Int * this, unsigned long int init ) { mpz_init_set_ui( this->mpz, init ); }30 void ?{}( Int * this, const char * val ) { if ( mpz_init_set_str( this->mpz, val, 0 ) ) abort(); }31 void ^?{}( Int * this ) { mpz_clear( this->mpz ); }24 static inline void ?{}( Int * this ) { mpz_init( this->mpz ); } 25 static inline void ?{}( Int * this, Int init ) { mpz_init_set( this->mpz, init.mpz ); } 26 static inline void ?{}( Int * this, zero_t ) { mpz_init_set_si( this->mpz, 0 ); } 27 static inline void ?{}( Int * this, one_t ) { mpz_init_set_si( this->mpz, 1 ); } 28 static inline void ?{}( Int * this, signed long int init ) { mpz_init_set_si( this->mpz, init ); } 29 static inline void ?{}( Int * this, unsigned long int init ) { mpz_init_set_ui( this->mpz, init ); } 30 static inline void ?{}( Int * this, const char * val ) { if ( mpz_init_set_str( this->mpz, val, 0 ) ) abort(); } 31 static inline void ^?{}( Int * this ) { mpz_clear( this->mpz ); } 32 32 33 33 // assignment 34 Int ?=?( Int * lhs, Int rhs ) { mpz_set( lhs->mpz, rhs.mpz ); return *lhs; }35 Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; }36 Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; }37 //Int ?=?( Int * lhs, const char * rhs ) { if ( mpq_set_str( lhs->mpz, rhs, 0 ) ) abort();return *lhs; }38 39 char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }40 s hort int ?=?( short int * lhs, Int rhs ) { short int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }41 int ?=?( int * lhs, Int rhs ) { int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }42 long int ?=?( long int * lhs, Int rhs ) { long int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }43 unsigned char ?=?( unsigned char * lhs, Int rhs ) { unsigned char val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }44 unsigned short int ?=?( unsigned short int * lhs, Int rhs ) { unsigned short int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }45 unsigned int ?=?( unsigned int * lhs, Int rhs ) { unsigned int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }46 unsigned long int ?=?( unsigned long int * lhs, Int rhs ) { unsigned long int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }34 static inline Int ?=?( Int * lhs, Int rhs ) { mpz_set( lhs->mpz, rhs.mpz ); return *lhs; } 35 static inline Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; } 36 static inline Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; } 37 static inline Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; } 38 39 static inline char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; } 40 static inline short int ?=?( short int * lhs, Int rhs ) { short int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; } 41 static inline int ?=?( int * lhs, Int rhs ) { int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; } 42 static inline long int ?=?( long int * lhs, Int rhs ) { long int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; } 43 static inline unsigned char ?=?( unsigned char * lhs, Int rhs ) { unsigned char val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; } 44 static inline unsigned short int ?=?( unsigned short int * lhs, Int rhs ) { unsigned short int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; } 45 static inline unsigned int ?=?( unsigned int * lhs, Int rhs ) { unsigned int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; } 46 static inline unsigned long int ?=?( unsigned long int * lhs, Int rhs ) { unsigned long int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; } 47 47 48 48 // conversions 49 long int narrow( Int val ) { return mpz_get_si( val.mpz ); }50 unsigned long int narrow( Int val ) { return mpz_get_ui( val.mpz ); }49 static inline long int narrow( Int val ) { return mpz_get_si( val.mpz ); } 50 static inline unsigned long int narrow( Int val ) { return mpz_get_ui( val.mpz ); } 51 51 52 52 // comparison 53 int ?==?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) == 0; }54 int ?==?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }55 int ?==?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }56 int ?==?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }57 int ?==?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }58 59 int ?!=?( Int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }60 int ?!=?( Int oper1, long int oper2 ) { return ! ( oper1 == oper2 ); }61 int ?!=?( long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }62 int ?!=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 == oper2 ); }63 int ?!=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }64 65 int ?<?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) < 0; }66 int ?<?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }67 int ?<?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }68 int ?<?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }69 int ?<?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }70 71 int ?<=?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) <= 0; }72 int ?<=?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }73 int ?<=?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }74 int ?<=?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }75 int ?<=?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }76 77 int ?>?( Int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }78 int ?>?( Int oper1, long int oper2 ) { return ! ( oper1 <= oper2 ); }79 int ?>?( long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }80 int ?>?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 <= oper2 ); }81 int ?>?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }82 83 int ?>=?( Int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }84 int ?>=?( Int oper1, long int oper2 ) { return ! ( oper1 < oper2 ); }85 int ?>=?( long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }86 int ?>=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 < oper2 ); }87 int ?>=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }53 static inline int ?==?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) == 0; } 54 static inline int ?==?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; } 55 static inline int ?==?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; } 56 static inline int ?==?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; } 57 static inline int ?==?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; } 58 59 static inline int ?!=?( Int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); } 60 static inline int ?!=?( Int oper1, long int oper2 ) { return ! ( oper1 == oper2 ); } 61 static inline int ?!=?( long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); } 62 static inline int ?!=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 == oper2 ); } 63 static inline int ?!=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); } 64 65 static inline int ?<?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) < 0; } 66 static inline int ?<?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; } 67 static inline int ?<?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; } 68 static inline int ?<?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; } 69 static inline int ?<?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; } 70 71 static inline int ?<=?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) <= 0; } 72 static inline int ?<=?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; } 73 static inline int ?<=?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; } 74 static inline int ?<=?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; } 75 static inline int ?<=?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; } 76 77 static inline int ?>?( Int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); } 78 static inline int ?>?( Int oper1, long int oper2 ) { return ! ( oper1 <= oper2 ); } 79 static inline int ?>?( long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); } 80 static inline int ?>?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 <= oper2 ); } 81 static inline int ?>?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); } 82 83 static inline int ?>=?( Int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); } 84 static inline int ?>=?( Int oper1, long int oper2 ) { return ! ( oper1 < oper2 ); } 85 static inline int ?>=?( long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); } 86 static inline int ?>=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 < oper2 ); } 87 static inline int ?>=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); } 88 88 89 89 // arithmetic 90 Int +?( Int oper ) { Int pos; mpz_set( pos.mpz, oper.mpz ); return pos; }91 Int -?( Int oper ) { Int neg; mpz_neg( neg.mpz, oper.mpz ); return neg; }92 Int ~?( Int oper ) { Int comp; mpz_com( comp.mpz, oper.mpz ); return comp; }93 94 Int ?&?( Int oper1, Int oper2 ) { Int conjunction; mpz_and( conjunction.mpz, oper1.mpz, oper2.mpz ); return conjunction; }95 Int ?&?( Int oper1, long int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }96 Int ?&?( long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }97 Int ?&?( Int oper1, unsigned long int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }98 Int ?&?( unsigned long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }99 Int ?&=?( Int * lhs, Int rhs ) { return *lhs = *lhs & rhs; }100 101 Int ?|?( Int oper1, Int oper2 ) { Int disjunction; mpz_ior( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }102 Int ?|?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }103 Int ?|?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }104 Int ?|?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }105 Int ?|?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }106 Int ?|=?( Int * lhs, Int rhs ) { return *lhs = *lhs | rhs; }107 108 Int ?^?( Int oper1, Int oper2 ) { Int disjunction; mpz_xor( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }109 Int ?^?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }110 Int ?^?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }111 Int ?^?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }112 Int ?^?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }113 Int ?^=?( Int * lhs, Int rhs ) { return *lhs = *lhs ^ rhs; }114 115 Int ?+?( Int addend1, Int addend2 ) { Int sum; mpz_add( sum.mpz, addend1.mpz, addend2.mpz ); return sum; }116 Int ?+?( Int addend1, long int addend2 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }117 Int ?+?( long int addend2, Int addend1 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }118 Int ?+?( Int addend1, unsigned long int addend2 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }119 Int ?+?( unsigned long int addend2, Int addend1 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }120 Int ?+=?( Int * lhs, Int rhs ) { return *lhs = *lhs + rhs; }121 Int ?+=?( Int * lhs, long int rhs ) { return *lhs = *lhs + rhs; }122 Int ?+=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs + rhs; }123 Int ++?( Int * lhs ) { return *lhs += 1; }124 Int ?++( Int * lhs ) { Int ret = *lhs; *lhs += 1; return ret; }125 126 Int ?-?( Int minuend, Int subtrahend ) { Int diff; mpz_sub( diff.mpz, minuend.mpz, subtrahend.mpz ); return diff; }127 Int ?-?( Int minuend, long int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); else mpz_add_ui( diff.mpz, minuend.mpz, -subtrahend ); return diff; }128 Int ?-?( long int minuend, Int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); else { mpz_add_ui( diff.mpz, subtrahend.mpz, -minuend ); mpz_neg( diff.mpz, diff.mpz ); } return diff; }129 Int ?-?( Int minuend, unsigned long int subtrahend ) { Int diff; mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); return diff; }130 Int ?-?( unsigned long int minuend, Int subtrahend ) { Int diff; mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); return diff; }131 Int ?-=?( Int * lhs, Int rhs ) { return *lhs = *lhs - rhs; }132 Int ?-=?( Int * lhs, long int rhs ) { return *lhs = *lhs - rhs; }133 Int ?-=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs - rhs; }134 Int --?( Int * lhs ) { return *lhs -= 1; }135 Int ?--( Int * lhs ) { Int ret = *lhs; *lhs -= 1; return ret; }136 137 Int ?*?( Int multiplicator, Int multiplicand ) { Int product; mpz_mul( product.mpz, multiplicator.mpz, multiplicand.mpz ); return product; }138 Int ?*?( Int multiplicator, long int multiplicand ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }139 Int ?*?( long int multiplicand, Int multiplicator ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }140 Int ?*?( Int multiplicator, unsigned long int multiplicand ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }141 Int ?*?( unsigned long int multiplicand, Int multiplicator ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }142 Int ?*=?( Int * lhs, Int rhs ) { return *lhs = *lhs * rhs; }143 Int ?*=?( Int * lhs, long int rhs ) { return *lhs = *lhs * rhs; }144 Int ?*=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs * rhs; }90 static inline Int +?( Int oper ) { Int pos; mpz_set( pos.mpz, oper.mpz ); return pos; } 91 static inline Int -?( Int oper ) { Int neg; mpz_neg( neg.mpz, oper.mpz ); return neg; } 92 static inline Int ~?( Int oper ) { Int comp; mpz_com( comp.mpz, oper.mpz ); return comp; } 93 94 static inline Int ?&?( Int oper1, Int oper2 ) { Int conjunction; mpz_and( conjunction.mpz, oper1.mpz, oper2.mpz ); return conjunction; } 95 static inline Int ?&?( Int oper1, long int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; } 96 static inline Int ?&?( long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; } 97 static inline Int ?&?( Int oper1, unsigned long int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; } 98 static inline Int ?&?( unsigned long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; } 99 static inline Int ?&=?( Int * lhs, Int rhs ) { return *lhs = *lhs & rhs; } 100 101 static inline Int ?|?( Int oper1, Int oper2 ) { Int disjunction; mpz_ior( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; } 102 static inline Int ?|?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; } 103 static inline Int ?|?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; } 104 static inline Int ?|?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; } 105 static inline Int ?|?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; } 106 static inline Int ?|=?( Int * lhs, Int rhs ) { return *lhs = *lhs | rhs; } 107 108 static inline Int ?^?( Int oper1, Int oper2 ) { Int disjunction; mpz_xor( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; } 109 static inline Int ?^?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; } 110 static inline Int ?^?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; } 111 static inline Int ?^?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; } 112 static inline Int ?^?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; } 113 static inline Int ?^=?( Int * lhs, Int rhs ) { return *lhs = *lhs ^ rhs; } 114 115 static inline Int ?+?( Int addend1, Int addend2 ) { Int sum; mpz_add( sum.mpz, addend1.mpz, addend2.mpz ); return sum; } 116 static inline Int ?+?( Int addend1, long int addend2 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; } 117 static inline Int ?+?( long int addend2, Int addend1 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; } 118 static inline Int ?+?( Int addend1, unsigned long int addend2 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; } 119 static inline Int ?+?( unsigned long int addend2, Int addend1 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; } 120 static inline Int ?+=?( Int * lhs, Int rhs ) { return *lhs = *lhs + rhs; } 121 static inline Int ?+=?( Int * lhs, long int rhs ) { return *lhs = *lhs + rhs; } 122 static inline Int ?+=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs + rhs; } 123 static inline Int ++?( Int * lhs ) { return *lhs += 1; } 124 static inline Int ?++( Int * lhs ) { Int ret = *lhs; *lhs += 1; return ret; } 125 126 static inline Int ?-?( Int minuend, Int subtrahend ) { Int diff; mpz_sub( diff.mpz, minuend.mpz, subtrahend.mpz ); return diff; } 127 static inline Int ?-?( Int minuend, long int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); else mpz_add_ui( diff.mpz, minuend.mpz, -subtrahend ); return diff; } 128 static inline Int ?-?( long int minuend, Int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); else { mpz_add_ui( diff.mpz, subtrahend.mpz, -minuend ); mpz_neg( diff.mpz, diff.mpz ); } return diff; } 129 static inline Int ?-?( Int minuend, unsigned long int subtrahend ) { Int diff; mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); return diff; } 130 static inline Int ?-?( unsigned long int minuend, Int subtrahend ) { Int diff; mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); return diff; } 131 static inline Int ?-=?( Int * lhs, Int rhs ) { return *lhs = *lhs - rhs; } 132 static inline Int ?-=?( Int * lhs, long int rhs ) { return *lhs = *lhs - rhs; } 133 static inline Int ?-=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs - rhs; } 134 static inline Int --?( Int * lhs ) { return *lhs -= 1; } 135 static inline Int ?--( Int * lhs ) { Int ret = *lhs; *lhs -= 1; return ret; } 136 137 static inline Int ?*?( Int multiplicator, Int multiplicand ) { Int product; mpz_mul( product.mpz, multiplicator.mpz, multiplicand.mpz ); return product; } 138 static inline Int ?*?( Int multiplicator, long int multiplicand ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; } 139 static inline Int ?*?( long int multiplicand, Int multiplicator ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; } 140 static inline Int ?*?( Int multiplicator, unsigned long int multiplicand ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; } 141 static inline Int ?*?( unsigned long int multiplicand, Int multiplicator ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; } 142 static inline Int ?*=?( Int * lhs, Int rhs ) { return *lhs = *lhs * rhs; } 143 static inline Int ?*=?( Int * lhs, long int rhs ) { return *lhs = *lhs * rhs; } 144 static inline Int ?*=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs * rhs; } 145 145 146 146 // some code for operators "/" and "%" taken from g++ gmpxx.h 147 Int ?/?( Int dividend, Int divisor ) { Int quotient; mpz_tdiv_q( quotient.mpz, dividend.mpz, divisor.mpz ); return quotient; }148 Int ?/?( Int dividend, unsigned long int divisor ) { Int quotient; mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor ); return quotient; }149 Int ?/?( unsigned long int dividend, Int divisor ) {147 static inline Int ?/?( Int dividend, Int divisor ) { Int quotient; mpz_tdiv_q( quotient.mpz, dividend.mpz, divisor.mpz ); return quotient; } 148 static inline Int ?/?( Int dividend, unsigned long int divisor ) { Int quotient; mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor ); return quotient; } 149 static inline Int ?/?( unsigned long int dividend, Int divisor ) { 150 150 Int quotient; 151 151 if ( mpz_sgn( divisor.mpz ) >= 0 ) { … … 164 164 return quotient; 165 165 } // ?/? 166 Int ?/?( Int dividend, long int divisor ) {166 static inline Int ?/?( Int dividend, long int divisor ) { 167 167 Int quotient; 168 168 if ( divisor >= 0 ) … … 174 174 return quotient; 175 175 } // ?/? 176 Int ?/?( long int dividend, Int divisor ) {176 static inline Int ?/?( long int dividend, Int divisor ) { 177 177 Int quotient; 178 178 if ( mpz_fits_slong_p( divisor.mpz ) ) … … 185 185 return quotient; 186 186 } // ?/? 187 Int ?/=?( Int * lhs, Int rhs ) { return *lhs = *lhs / rhs; }188 Int ?/=?( Int * lhs, long int rhs ) { return *lhs = *lhs / rhs; }189 Int ?/=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs / rhs; }190 191 [ Int, Int ] div( Int dividend, Int divisor ) { Int quotient, remainder; mpz_fdiv_qr( quotient.mpz, remainder.mpz, dividend.mpz, divisor.mpz ); return [ quotient, remainder ]; }192 [ Int, Int ] div( Int dividend, unsigned long int divisor ) { Int quotient, remainder; mpz_fdiv_qr_ui( quotient.mpz, remainder.mpz, dividend.mpz, divisor ); return [ quotient, remainder ]; }193 194 Int ?%?( Int dividend, Int divisor ) { Int remainder; mpz_tdiv_r( remainder.mpz, dividend.mpz, divisor.mpz ); return remainder; }195 Int ?%?( Int dividend, unsigned long int divisor ) { Int remainder; mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, divisor ); return remainder; }196 Int ?%?( unsigned long int dividend, Int divisor ) {187 static inline Int ?/=?( Int * lhs, Int rhs ) { return *lhs = *lhs / rhs; } 188 static inline Int ?/=?( Int * lhs, long int rhs ) { return *lhs = *lhs / rhs; } 189 static inline Int ?/=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs / rhs; } 190 191 static inline [ Int, Int ] div( Int dividend, Int divisor ) { Int quotient, remainder; mpz_fdiv_qr( quotient.mpz, remainder.mpz, dividend.mpz, divisor.mpz ); return [ quotient, remainder ]; } 192 static inline [ Int, Int ] div( Int dividend, unsigned long int divisor ) { Int quotient, remainder; mpz_fdiv_qr_ui( quotient.mpz, remainder.mpz, dividend.mpz, divisor ); return [ quotient, remainder ]; } 193 194 static inline Int ?%?( Int dividend, Int divisor ) { Int remainder; mpz_tdiv_r( remainder.mpz, dividend.mpz, divisor.mpz ); return remainder; } 195 static inline Int ?%?( Int dividend, unsigned long int divisor ) { Int remainder; mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, divisor ); return remainder; } 196 static inline Int ?%?( unsigned long int dividend, Int divisor ) { 197 197 Int remainder; 198 198 if ( mpz_sgn( divisor.mpz ) >= 0 ) { … … 210 210 return remainder; 211 211 } // ?%? 212 Int ?%?( Int dividend, long int divisor ) {212 static inline Int ?%?( Int dividend, long int divisor ) { 213 213 Int remainder; 214 214 mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, (divisor >= 0 ? divisor : -divisor)); 215 215 return remainder; 216 216 } // ?%? 217 Int ?%?( long int dividend, Int divisor ) {217 static inline Int ?%?( long int dividend, Int divisor ) { 218 218 Int remainder; 219 219 if ( mpz_fits_slong_p( divisor.mpz ) ) … … 226 226 return remainder; 227 227 } // ?%? 228 Int ?%=?( Int * lhs, Int rhs ) { return *lhs = *lhs % rhs; }229 Int ?%=?( Int * lhs, long int rhs ) { return *lhs = *lhs % rhs; }230 Int ?%=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs % rhs; }231 232 Int ?<<?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_mul_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }233 Int ?<<=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs << shift; }234 Int ?>>?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_fdiv_q_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }235 Int ?>>=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs >> shift; }228 static inline Int ?%=?( Int * lhs, Int rhs ) { return *lhs = *lhs % rhs; } 229 static inline Int ?%=?( Int * lhs, long int rhs ) { return *lhs = *lhs % rhs; } 230 static inline Int ?%=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs % rhs; } 231 232 static inline Int ?<<?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_mul_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; } 233 static inline Int ?<<=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs << shift; } 234 static inline Int ?>>?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_fdiv_q_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; } 235 static inline Int ?>>=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs >> shift; } 236 236 237 237 // number functions 238 Int abs( Int oper ) { Int positive; mpz_abs( positive.mpz, oper.mpz ); return positive; }239 Int fact( unsigned long int N ) { Int factorial; mpz_fac_ui( factorial.mpz, N ); return factorial; }240 Int gcd( Int oper1, Int oper2 ) { Int gcdret; mpz_gcd( gcdret.mpz, oper1.mpz, oper2.mpz ); return gcdret; }241 Int pow( Int base, unsigned long int exponent ) { Int power; mpz_pow_ui( power.mpz, base.mpz, exponent ); return power; }242 Int pow( unsigned long int base, unsigned long int exponent ) { Int power; mpz_ui_pow_ui( power.mpz, base, exponent ); return power; }243 void srandom( gmp_randstate_t state ) { gmp_randinit_default( state ); }244 Int random( gmp_randstate_t state, mp_bitcnt_t n ) { Int rand; mpz_urandomb( rand.mpz, state, n ); return rand; }245 Int random( gmp_randstate_t state, Int n ) { Int rand; mpz_urandomm( rand.mpz, state, n.mpz ); return rand; }246 Int random( gmp_randstate_t state, mp_size_t max_size ) { Int rand; mpz_random( rand.mpz, max_size ); return rand; }247 int sgn( Int oper ) { return mpz_sgn( oper.mpz ); }248 Int sqrt( Int oper ) { Int root; mpz_sqrt( root.mpz, oper.mpz ); return root; }238 static inline Int abs( Int oper ) { Int positive; mpz_abs( positive.mpz, oper.mpz ); return positive; } 239 static inline Int fact( unsigned long int N ) { Int factorial; mpz_fac_ui( factorial.mpz, N ); return factorial; } 240 static inline Int gcd( Int oper1, Int oper2 ) { Int gcdret; mpz_gcd( gcdret.mpz, oper1.mpz, oper2.mpz ); return gcdret; } 241 static inline Int pow( Int base, unsigned long int exponent ) { Int power; mpz_pow_ui( power.mpz, base.mpz, exponent ); return power; } 242 static inline Int pow( unsigned long int base, unsigned long int exponent ) { Int power; mpz_ui_pow_ui( power.mpz, base, exponent ); return power; } 243 static inline void srandom( gmp_randstate_t state ) { gmp_randinit_default( state ); } 244 static inline Int random( gmp_randstate_t state, mp_bitcnt_t n ) { Int rand; mpz_urandomb( rand.mpz, state, n ); return rand; } 245 static inline Int random( gmp_randstate_t state, Int n ) { Int rand; mpz_urandomm( rand.mpz, state, n.mpz ); return rand; } 246 static inline Int random( gmp_randstate_t state, mp_size_t max_size ) { Int rand; mpz_random( rand.mpz, max_size ); return rand; } 247 static inline int sgn( Int oper ) { return mpz_sgn( oper.mpz ); } 248 static inline Int sqrt( Int oper ) { Int root; mpz_sqrt( root.mpz, oper.mpz ); return root; } 249 249 250 250 // I/O 251 forall( dtype istype | istream( istype ) )251 static inline forall( dtype istype | istream( istype ) ) 252 252 istype * ?|?( istype * is, Int * mp ) { 253 253 gmp_scanf( "%Zd", mp ); … … 255 255 } // ?|? 256 256 257 forall( dtype ostype | ostream( ostype ) )257 static inline forall( dtype ostype | ostream( ostype ) ) 258 258 ostype * ?|?( ostype * os, Int mp ) { 259 259 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); -
src/libcfa/libhdr/libdebug.h
r9c951e3 rb1e63ac5 18 18 19 19 #ifdef __CFA_DEBUG__ 20 #define LIB_DEBUG_DO(x) x21 #define LIB_NO_DEBUG_DO(x) ((void)0)20 #define LIB_DEBUG_DO(x) x 21 #define LIB_NO_DEBUG_DO(x) ((void)0) 22 22 #else 23 #define LIB_DEBUG_DO(x) ((void)0)24 #define LIB_NO_DEBUG_DO(x) x23 #define LIB_DEBUG_DO(x) ((void)0) 24 #define LIB_NO_DEBUG_DO(x) x 25 25 #endif 26 27 #if !defined(NDEBUG) && (defined(__CFA_DEBUG__) || defined(__CFA_VERIFY__)) 28 #define verify(x) assert(x) 29 #define verifyf(x, ...) assertf(x, __VA_ARGS__) 30 #else 31 #define verify(x) 32 #define verifyf(x, ...) 33 #endif 34 26 35 27 36 #ifdef __cforall -
src/libcfa/math
r9c951e3 rb1e63ac5 10 10 // Created On : Mon Apr 18 23:37:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 24 12:45:02 201613 // Update Count : 5912 // Last Modified On : Wed May 24 17:40:39 2017 13 // Update Count : 60 14 14 // 15 15 … … 20 20 #include <math.h> // fpclassify, isfinite, isnormal, isnan, isinf 21 21 } // extern "C" 22 23 float fabs( float );24 // extern "C" { double fabs( double ); }25 long double fabs( long double );26 float cabs( float _Complex );27 // extern "C" { double cabs( double _Complex ); }28 long double cabs( long double _Complex );29 22 30 23 float ?%?( float, float ); -
src/libcfa/math.c
r9c951e3 rb1e63ac5 10 10 // Created On : Tue Apr 19 22:23:08 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 24 08:52:31 201613 // Update Count : 7 512 // Last Modified On : Tue May 23 22:52:13 2017 13 // Update Count : 76 14 14 // 15 15 … … 19 19 #include <complex.h> 20 20 } // extern "C" 21 22 float fabs( float x ) { return fabsf( x ); }23 long double fabs( long double x ) { return fabsl( x ); }24 float cabs( float _Complex x ) { return cabsf( x ); }25 long double cabs( long double _Complex x ) { return cabsl( x ); }26 21 27 22 float ?%?( float x, float y ) { return fmodf( x, y ); } -
src/libcfa/stdlib
r9c951e3 rb1e63ac5 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 9 08:42:44201713 // Update Count : 10712 // Last Modified On : Fri Jun 2 15:51:03 2017 13 // Update Count : 218 14 14 // 15 15 … … 28 28 //--------------------------------------- 29 29 30 extern "C" { void * malloc( size_t ); } // use default C routine for void * 31 forall( dtype T | sized(T) ) T * malloc( void ); 32 forall( dtype T | sized(T) ) T * malloc( char fill ); 33 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ); 34 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ); 35 extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void * 36 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ); 37 extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void * 38 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ); 39 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ); 40 41 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ); 42 forall( dtype T | sized(T) ) T * memalign( size_t alignment ); // deprecated 43 forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ); 44 45 extern "C" { 46 void * memset( void * ptr, int fill, size_t size ); 47 void free( void * ptr ); 48 } // extern "C" 49 50 forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p ); 51 forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr ); 52 forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) void delete( T * ptr, Params rest ); 30 // allocation, non-array types 31 static inline forall( dtype T | sized(T) ) T * malloc( void ) { 32 //printf( "X1\n" ); 33 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 34 } // malloc 35 36 extern "C" { void * calloc( size_t dim, size_t size ); } // default C routine 37 static inline forall( dtype T | sized(T) ) T * calloc( size_t dim ) { 38 //printf( "X2\n" ); 39 return (T *)(void *)calloc( dim, sizeof(T) ); // C cmalloc 40 } 41 42 extern "C" { void * realloc( void * ptr, size_t size ); } // default C routine for void * 43 static inline forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { 44 //printf( "X3\n" ); 45 return (T *)(void *)realloc( (void *)ptr, size ); 46 } 47 48 extern "C" { void * memalign( size_t align, size_t size ); } // use default C routine for void * 49 static inline forall( dtype T | sized(T) ) T * memalign( size_t align ) { 50 //printf( "X4\n" ); 51 return (T *)memalign( align, sizeof(T) ); 52 } // memalign 53 54 static inline forall( dtype T | sized(T) ) T * aligned_alloc( size_t align ) { 55 //printf( "X5\n" ); 56 return (T *)memalign( align, sizeof(T) ); 57 } // aligned_alloc 58 59 extern "C" { int posix_memalign( void ** ptr, size_t align, size_t size ); } // use default C routine for void * 60 static inline forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t align ) { 61 //printf( "X6\n" ); 62 return posix_memalign( (void **)ptr, align, sizeof(T) ); 63 } // posix_memalign 64 65 66 extern "C" { void * memset( void * dest, int c, size_t size ); } // use default C routine for void * 67 68 static inline forall( dtype T | sized(T) ) T * alloc( void ) { 69 //printf( "X7\n" ); 70 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 71 } // alloc 72 static inline forall( dtype T | sized(T) ) T * alloc( char fill ) { 73 //printf( "X8\n" ); 74 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 75 return memset( ptr, (int)fill, sizeof(T) ); // initial with fill value 76 } // alloc 77 78 static inline forall( dtype T | sized(T) ) T * alloc( size_t dim ) { 79 //printf( "X9\n" ); 80 return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 81 } // alloc 82 static inline forall( dtype T | sized(T) ) T * alloc( size_t dim, char fill ) { 83 //printf( "X10\n" ); 84 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 85 return memset( ptr, (int)fill, dim * sizeof(T) ); 86 } // alloc 87 88 static inline forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim ) { 89 //printf( "X11\n" ); 90 return (void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc 91 } // alloc 92 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ); 93 94 static inline forall( dtype T | sized(T) ) T * align_alloc( size_t align ) { 95 //printf( "X13\n" ); 96 return (T *)memalign( align, sizeof(T) ); 97 } // align_alloc 98 static inline forall( dtype T | sized(T) ) T * align_alloc( size_t align, char fill ) { 99 //printf( "X14\n" ); 100 T * ptr = (T *)memalign( align, sizeof(T) ); 101 return memset( ptr, (int)fill, sizeof(T) ); 102 } // align_alloc 103 104 static inline forall( dtype T | sized(T) ) T * align_alloc( size_t align, size_t dim ) { 105 //printf( "X15\n" ); 106 return (T *)memalign( align, dim * sizeof(T) ); 107 } // align_alloc 108 static inline forall( dtype T | sized(T) ) T * align_alloc( size_t align, size_t dim, char fill ) { 109 //printf( "X16\n" ); 110 T * ptr = (T *)memalign( align, dim * sizeof(T) ); 111 return memset( ptr, (int)fill, dim * sizeof(T) ); 112 } // align_alloc 113 114 115 // data, non-array types 116 static inline forall( dtype T | sized(T) ) T * memset( T * dest, char c ) { 117 //printf( "X17\n" ); 118 return memset( dest, c, sizeof(T) ); 119 } // memset 120 extern "C" { void * memcpy( void * dest, const void * src, size_t size ); } // use default C routine for void * 121 static inline forall( dtype T | sized(T) ) T * memcpy( T * dest, const T * src ) { 122 //printf( "X18\n" ); 123 return memcpy( dest, src, sizeof(T) ); 124 } // memcpy 125 126 // data, array types 127 static inline forall( dtype T | sized(T) ) T * memset( T dest[], size_t dim, char c ) { 128 //printf( "X19\n" ); 129 return (void *)memset( dest, c, dim * sizeof(T) ); // C memset 130 } // memset 131 static inline forall( dtype T | sized(T) ) T * memcpy( T dest[], const T src[], size_t dim ) { 132 //printf( "X20\n" ); 133 return (void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy 134 } // memcpy 135 136 // allocation/deallocation and constructor/destructor, non-array types 137 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * new( Params p ); 138 forall( dtype T | { void ^?{}( T * ); } ) void delete( T * ptr ); 139 forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } ) void delete( T * ptr, Params rest ); 140 141 // allocation/deallocation and constructor/destructor, array types 142 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * anew( size_t dim, Params p ); 143 forall( dtype T | sized(T) | { void ^?{}( T * ); } ) void adelete( size_t dim, T arr[] ); 144 forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest ); 53 145 54 146 //--------------------------------------- … … 83 175 84 176 forall( otype T | { int ?<?( T, T ); } ) 85 T * bsearch( T key, const T * arr, size_t dim ension);86 87 forall( otype T | { int ?<?( T, T ); } ) 88 unsigned int bsearch( T key, const T * arr, size_t dim ension);89 90 91 forall( otype T | { int ?<?( T, T ); } ) 92 void qsort( const T * arr, size_t dim ension);177 T * bsearch( T key, const T * arr, size_t dim ); 178 179 forall( otype T | { int ?<?( T, T ); } ) 180 unsigned int bsearch( T key, const T * arr, size_t dim ); 181 182 183 forall( otype T | { int ?<?( T, T ); } ) 184 void qsort( const T * arr, size_t dim ); 93 185 94 186 //--------------------------------------- … … 109 201 double abs( double _Complex ); 110 202 long double abs( long double _Complex ); 111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )203 forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } ) 112 204 T abs( T ); 113 205 … … 115 207 116 208 void rand48seed( long int s ); 117 char rand48( );118 int rand48( );119 unsigned int rand48( );120 long int rand48( );121 unsigned long int rand48( );122 float rand48( );123 double rand48( );124 float _Complex rand48( );125 double _Complex rand48( );126 long double _Complex rand48( );209 char rand48( void ); 210 int rand48( void ); 211 unsigned int rand48( void ); 212 long int rand48( void ); 213 unsigned long int rand48( void ); 214 float rand48( void ); 215 double rand48( void ); 216 float _Complex rand48( void ); 217 double _Complex rand48( void ); 218 long double _Complex rand48( void ); 127 219 128 220 //--------------------------------------- -
src/libcfa/stdlib.c
r9c951e3 rb1e63ac5 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue May 9 08:43:00201713 // Update Count : 19112 // Last Modified On : Thu Jun 1 21:52:57 2017 13 // Update Count : 280 14 14 // 15 15 … … 21 21 #define _XOPEN_SOURCE 600 // posix_memalign, *rand48 22 22 #include <stdlib.h> // malloc, free, calloc, realloc, memalign, posix_memalign, bsearch 23 #include <string.h> // mem set23 #include <string.h> // memcpy, memset 24 24 #include <malloc.h> // malloc_usable_size 25 25 #include <math.h> // fabsf, fabs, fabsl … … 27 27 } // extern "C" 28 28 29 forall( dtype T | sized(T) ) T * malloc( void ) { // type-safe 30 return (T *)(void *)malloc( (size_t)sizeof(T) ); 31 } // malloc 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) ); 35 return memset( ptr, (int)fill, sizeof(T) ); 36 } // malloc 37 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 48 return (T *)calloc( nmemb, sizeof(T) ); 49 } // calloc 50 51 52 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { // type-safe 53 return (T *)(void *)realloc( (void *)ptr, size ); 54 } // realloc 55 56 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value 57 char * nptr = (T *)(void *)realloc( (void *)ptr, size ); 58 size_t unused = malloc_usable_size( nptr ); 59 memset( nptr + size - unused, (int)fill, unused ); // initialize any new storage 60 return nptr; 61 } // realloc 62 63 64 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { // aligned allocation 65 return (T *)memalign( alignment, sizeof(T) ); 66 } // aligned_alloc 67 68 forall( dtype T | sized(T) ) T * memalign( size_t alignment ) { 69 return (T *)memalign( alignment, sizeof(T) ); 70 } // memalign 71 72 forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ) { 73 return posix_memalign( (void **)ptr, alignment, sizeof(T) ); 74 } // posix_memalign 75 76 77 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) // new 29 // resize, non-array types 30 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ) { 31 size_t olen = malloc_usable_size( ptr ); // current allocation 32 char * nptr = (void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc 33 size_t nlen = malloc_usable_size( nptr ); // new allocation 34 if ( nlen > olen ) { // larger ? 35 memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage 36 } // 37 return (T *)nptr; 38 } // alloc 39 40 // allocation/deallocation and constructor/destructor, non-array types 41 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) 78 42 T * new( Params p ) { 79 return ( (T *)malloc()){ p };43 return (malloc()){ p }; // run constructor 80 44 } // new 81 45 82 forall( dtype T | { void ^?{}( T *); } ) // delete46 forall( dtype T | { void ^?{}( T * ); } ) 83 47 void delete( T * ptr ) { 84 if ( ptr ) { 85 ^ptr{}; 48 if ( ptr ) { // ignore null 49 ^ptr{}; // run destructor 86 50 free( ptr ); 87 } 51 } // if 88 52 } // delete 89 53 90 forall( dtype T, ttype Params | { void ^?{}( T *); void delete(Params); } )54 forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } ) 91 55 void delete( T * ptr, Params rest ) { 92 if ( ptr ) { 93 ^ptr{}; 56 if ( ptr ) { // ignore null 57 ^ptr{}; // run destructor 94 58 free( ptr ); 95 } 59 } // if 96 60 delete( rest ); 97 61 } // delete 62 63 64 // allocation/deallocation and constructor/destructor, array types 65 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) 66 T * anew( size_t dim, Params p ) { 67 T *arr = alloc( dim ); 68 for ( unsigned int i = 0; i < dim; i += 1 ) { 69 (&arr[i]){ p }; // run constructor 70 } // for 71 return arr; 72 } // anew 73 74 forall( dtype T | sized(T) | { void ^?{}( T * ); } ) 75 void adelete( size_t dim, T arr[] ) { 76 if ( arr ) { // ignore null 77 for ( int i = dim - 1; i >= 0; i -= 1 ) { // reverse allocation order, must be unsigned 78 ^(&arr[i]){}; // run destructor 79 } // for 80 free( arr ); 81 } // if 82 } // adelete 83 84 forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } ) 85 void adelete( size_t dim, T arr[], Params rest ) { 86 if ( arr ) { // ignore null 87 for ( int i = dim - 1; i >= 0; i -= 1 ) { // reverse allocation order, must be unsigned 88 ^(&arr[i]){}; // run destructor 89 } // for 90 free( arr ); 91 } // if 92 adelete( rest ); 93 } // adelete 98 94 99 95 //--------------------------------------- … … 242 238 243 239 forall( otype T | { int ?<?( T, T ); } ) 244 T * bsearch( T key, const T * arr, size_t dim ension) {240 T * bsearch( T key, const T * arr, size_t dim ) { 245 241 int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; } 246 return (T *)bsearch( &key, arr, dim ension, sizeof(T), comp );242 return (T *)bsearch( &key, arr, dim, sizeof(T), comp ); 247 243 } // bsearch 248 244 249 245 forall( otype T | { int ?<?( T, T ); } ) 250 unsigned int bsearch( T key, const T * arr, size_t dim ension) {251 T *result = bsearch( key, arr, dim ension);252 return result ? result - arr : dim ension;// pointer subtraction includes sizeof(T)246 unsigned int bsearch( T key, const T * arr, size_t dim ) { 247 T *result = bsearch( key, arr, dim ); 248 return result ? result - arr : dim; // pointer subtraction includes sizeof(T) 253 249 } // bsearch 254 250 255 251 forall( otype T | { int ?<?( T, T ); } ) 256 void qsort( const T * arr, size_t dim ension) {252 void qsort( const T * arr, size_t dim ) { 257 253 int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; } 258 qsort( arr, dim ension, sizeof(T), comp );254 qsort( arr, dim, sizeof(T), comp ); 259 255 } // qsort 260 256 … … 279 275 280 276 void rand48seed( long int s ) { srand48( s ); } 281 char rand48( ) { return mrand48(); }282 int rand48( ) { return mrand48(); }283 unsigned int rand48( ) { return lrand48(); }284 long int rand48( ) { return mrand48(); }285 unsigned long int rand48( ) { return lrand48(); }286 float rand48( ) { return (float)drand48(); }// otherwise float uses lrand48287 double rand48( ) { return drand48(); }288 float _Complex rand48( ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }289 double _Complex rand48( ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }290 long double _Complex rand48( ) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }277 char rand48( void ) { return mrand48(); } 278 int rand48( void ) { return mrand48(); } 279 unsigned int rand48( void ) { return lrand48(); } 280 long int rand48( void ) { return mrand48(); } 281 unsigned long int rand48( void ) { return lrand48(); } 282 float rand48( void ) { return (float)drand48(); } // otherwise float uses lrand48 283 double rand48( void ) { return drand48(); } 284 float _Complex rand48( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); } 285 double _Complex rand48( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); } 286 long double _Complex rand48( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); } 291 287 292 288 //--------------------------------------- -
src/main.cc
r9c951e3 rb1e63ac5 10 10 // Author : Richard C. Bilson 11 11 // Created On : Fri May 15 23:12:02 2015 12 // Last Modified By : Andrew Beach13 // Last Modified On : Wed May 10 14:45:00 201714 // Update Count : 4 3712 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Jun 29 12:46:50 2017 14 // Update Count : 441 15 15 // 16 16 … … 25 25 using namespace std; 26 26 27 #include "Parser/lex.h" 28 #include "Parser/parser.h" 27 #include "Parser/parser.hh" 29 28 #include "Parser/TypedefTable.h" 30 29 #include "GenPoly/Lvalue.h" … … 64 63 bresolvep = false, 65 64 bboxp = false, 65 bcodegenp = false, 66 66 ctorinitp = false, 67 67 declstatsp = false, … … 145 145 } // sigSegvBusHandler 146 146 147 void sigAbortHandler( int sig_num ) {147 void sigAbortHandler( __attribute__((unused)) int sig_num ) { 148 148 backtrace( 6 ); // skip first 6 stack frames 149 149 signal( SIGABRT, SIG_DFL); // reset default signal handler … … 185 185 if ( ! nopreludep ) { // include gcc builtins 186 186 // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here. 187 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 188 assertf( builtins, "cannot open builtins.cf\n" ); 189 parse( builtins, LinkageSpec::Compiler ); 187 188 // Read to gcc builtins, if not generating the cfa library 189 FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" ); 190 assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" ); 191 parse( gcc_builtins, LinkageSpec::Compiler ); 190 192 191 193 // read the extra prelude in, if not generating the cfa library … … 199 201 assertf( prelude, "cannot open prelude.cf\n" ); 200 202 parse( prelude, LinkageSpec::Intrinsic ); 203 204 // Read to cfa builtins, if not generating the cfa library 205 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 206 assertf( builtins, "cannot open builtins.cf\n" ); 207 parse( builtins, LinkageSpec::Builtin ); 201 208 } // if 202 209 } // if … … 306 313 OPTPRINT( "box" ) 307 314 GenPoly::box( translationUnit ); 315 316 if ( bcodegenp ) { 317 dump( translationUnit ); 318 return 0; 319 } 308 320 309 321 if ( optind < argc ) { // any commands after the flags and input file ? => output file name … … 377 389 378 390 int c; 379 while ( (c = getopt_long( argc, argv, "abBc defglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {391 while ( (c = getopt_long( argc, argv, "abBcCdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) { 380 392 switch ( c ) { 381 393 case Ast: … … 394 406 ctorinitp = true; 395 407 break; 408 case 'C': // print before code generation 409 bcodegenp = true; 410 break; 396 411 case DeclStats: 397 412 case 'd': … … 466 481 break; 467 482 case '?': 468 assertf( false, "Unknown option: '%c'\n", (char)optopt ); 483 if ( optopt ) { // short option ? 484 assertf( false, "Unknown option: -%c\n", (char)optopt ); 485 } else { 486 assertf( false, "Unknown option: %s\n", argv[optind - 1] ); 487 } // if 469 488 default: 470 489 abort(); -
src/prelude/Makefile.am
r9c951e3 rb1e63ac5 20 20 # put into lib for now 21 21 cfalibdir = ${CFA_LIBDIR} 22 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c22 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c 23 23 noinst_DATA = ../libcfa/libcfa-prelude.c 24 25 $(DEPDIR) : 26 mkdir $(DEPDIR) 27 28 $(DEPDIR)/builtins.Po : $(DEPDIR) 29 touch ${@} 24 30 25 31 # create extra forward types/declarations to reduce inclusion of library files … … 28 34 29 35 # create forward declarations for gcc builtins 30 builtins.cf :builtins.c prototypes.sed36 gcc-builtins.cf : gcc-builtins.c prototypes.sed 31 37 ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@ 32 38 33 builtins.c : builtins.def prototypes.awk39 gcc-builtins.c : builtins.def prototypes.awk 34 40 ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@ 35 41 … … 38 44 prototypes.awk : 39 45 40 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 46 # create forward declarations for cfa builtins 47 builtins.cf : builtins.c 48 ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po 49 ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po 50 51 include $(DEPDIR)/builtins.Po 52 53 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 41 54 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@ # use src/cfa-cpp as not in lib until after install 42 55 43 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp56 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 44 57 ${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 58 46 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} 59 maintainer-clean-local : 60 rm -rf $(DEPDIR) 61 62 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} -
src/prelude/Makefile.in
r9c951e3 rb1e63ac5 211 211 # put into lib for now 212 212 cfalibdir = ${CFA_LIBDIR} 213 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c213 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c 214 214 noinst_DATA = ../libcfa/libcfa-prelude.c 215 MAINTAINERCLEANFILES = builtins.cbuiltins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}215 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} 216 216 all: all-am 217 217 … … 390 390 maintainer-clean: maintainer-clean-am 391 391 -rm -f Makefile 392 maintainer-clean-am: distclean-am maintainer-clean-generic 392 maintainer-clean-am: distclean-am maintainer-clean-generic \ 393 maintainer-clean-local 393 394 394 395 mostlyclean: mostlyclean-am … … 416 417 install-ps install-ps-am install-strip installcheck \ 417 418 installcheck-am installdirs maintainer-clean \ 418 maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ 419 pdf-am ps ps-am uninstall uninstall-am uninstall-cfalibDATA 420 419 maintainer-clean-generic maintainer-clean-local mostlyclean \ 420 mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ 421 uninstall-cfalibDATA 422 423 424 $(DEPDIR) : 425 mkdir $(DEPDIR) 426 427 $(DEPDIR)/builtins.Po : $(DEPDIR) 428 touch ${@} 421 429 422 430 # create extra forward types/declarations to reduce inclusion of library files … … 425 433 426 434 # create forward declarations for gcc builtins 427 builtins.cf :builtins.c prototypes.sed435 gcc-builtins.cf : gcc-builtins.c prototypes.sed 428 436 ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@ 429 437 430 builtins.c : builtins.def prototypes.awk438 gcc-builtins.c : builtins.def prototypes.awk 431 439 ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@ 432 440 … … 435 443 prototypes.awk : 436 444 437 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 445 # create forward declarations for cfa builtins 446 builtins.cf : builtins.c 447 ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po 448 ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po 449 450 include $(DEPDIR)/builtins.Po 451 452 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 438 453 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@ # use src/cfa-cpp as not in lib until after install 439 454 440 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp455 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 441 456 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 457 458 maintainer-clean-local : 459 rm -rf $(DEPDIR) 442 460 443 461 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
src/prelude/prelude.cf
r9c951e3 rb1e63ac5 309 309 // forall( dtype DT ) signed int ?!=?( const volatile void *, const volatile DT * ); 310 310 311 // forall( dtype DT ) signed int ?==?( const volatile DT *, forall( dtype DT2 )const DT2 *);312 // forall( dtype DT ) signed int ?==?( forall( dtype DT2 )const DT2 *, const volatile DT * );313 // forall( ftype FT ) signed int ?==?( FT *, forall( ftype FT2 )FT2 *);314 // forall( ftype FT ) signed int ?==?( forall( ftype FT2 )FT2 *, FT * );315 // forall( dtype DT ) signed int ?!=?( const volatile DT *, forall( dtype DT2 )const DT2 *);316 // forall( dtype DT ) signed int ?!=?( forall( dtype DT2 )const DT2 *, const volatile DT * );317 // forall( ftype FT ) signed int ?!=?( FT *, forall( ftype FT2 )FT2 *);318 // forall( ftype FT ) signed int ?!=?( forall( ftype FT2 )FT2 *, FT * );311 // forall( dtype DT ) signed int ?==?( const volatile DT *, zero_t ); 312 // forall( dtype DT ) signed int ?==?( zero_t, const volatile DT * ); 313 // forall( ftype FT ) signed int ?==?( FT *, zero_t ); 314 // forall( ftype FT ) signed int ?==?( zero_t, FT * ); 315 // forall( dtype DT ) signed int ?!=?( const volatile DT *, zero_t ); 316 // forall( dtype DT ) signed int ?!=?( zero_t, const volatile DT * ); 317 // forall( ftype FT ) signed int ?!=?( FT *, zero_t ); 318 // forall( ftype FT ) signed int ?!=?( zero_t, FT * ); 319 319 320 320 // ------------------------------------------------------------ … … 447 447 const volatile void * ?=?( const volatile void * volatile *, const volatile void * ); 448 448 449 // forall( dtype DT ) DT * ?=?( DT * *, forall( dtype DT2 ) const DT2 *);450 // forall( dtype DT ) DT * ?=?( DT * volatile *, forall( dtype DT2 ) const DT2 *);451 forall( dtype DT ) const DT * ?=?( const DT * *, forall( dtype DT2 ) const DT2 *);452 forall( dtype DT ) const DT * ?=?( const DT * volatile *, forall( dtype DT2 ) const DT2 *);453 // forall( dtype DT ) volatile DT * ?=?( volatile DT * *, forall( dtype DT2 ) const DT2 *);454 // forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, forall( dtype DT2 ) const DT2 *);455 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, forall( dtype DT2 ) const DT2 *);456 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, forall( dtype DT2 ) const DT2 *);457 458 forall( ftype FT ) FT * ?=?( FT * *, forall( ftype FT2 ) FT2 *);459 forall( ftype FT ) FT * ?=?( FT * volatile *, forall( ftype FT2 ) FT2 *);449 // //forall( dtype DT ) DT * ?=?( DT * *, zero_t ); 450 // //forall( dtype DT ) DT * ?=?( DT * volatile *, zero_t ); 451 // forall( dtype DT ) const DT * ?=?( const DT * *, zero_t ); 452 // forall( dtype DT ) const DT * ?=?( const DT * volatile *, zero_t ); 453 // //forall( dtype DT ) volatile DT * ?=?( volatile DT * *, zero_t ); 454 // //forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, ); 455 // forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, zero_t ); 456 // forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, zero_t ); 457 458 // forall( ftype FT ) FT * ?=?( FT * *, zero_t ); 459 // forall( ftype FT ) FT * ?=?( FT * volatile *, zero_t ); 460 460 461 461 forall( dtype T | sized(T) ) T * ?+=?( T * *, ptrdiff_t ); … … 799 799 void ?{}( const volatile void * *, const volatile void * ); 800 800 801 // forall( dtype DT ) void ?{}( DT * *, forall( dtype DT2 ) const DT2 *);802 // forall( dtype DT ) void ?{}( DT * volatile *, forall( dtype DT2 ) const DT2 *);803 forall( dtype DT ) void ?{}( const DT * *, forall( dtype DT2 ) const DT2 *);804 // forall( dtype DT ) void ?{}( volatile DT * *, forall( dtype DT2 ) const DT2 *);805 // forall( dtype DT ) void ?{}( volatile DT * volatile *, forall( dtype DT2 ) const DT2 *);806 forall( dtype DT ) void ?{}( const volatile DT * *, forall( dtype DT2 ) const DT2 *);807 808 forall( ftype FT ) void ?{}( FT * *, forall( ftype FT2 ) FT2 *);801 // //forall( dtype DT ) void ?{}( DT * *, zero_t ); 802 // //forall( dtype DT ) void ?{}( DT * volatile *, zero_t ); 803 // forall( dtype DT ) void ?{}( const DT * *, zero_t ); 804 // //forall( dtype DT ) void ?{}( volatile DT * *, zero_t ); 805 // //forall( dtype DT ) void ?{}( volatile DT * volatile *, zero_t ); 806 // forall( dtype DT ) void ?{}( const volatile DT * *, zero_t ); 807 808 // forall( ftype FT ) void ?{}( FT * *, zero_t ); 809 809 810 810 // default ctors -
src/tests/.expect/32/KRfunctions.txt
r9c951e3 rb1e63ac5 6 6 extern int printf(const char *__restrict __format, ...); 7 7 int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){ 8 int ___retval_f0__i_1;8 __attribute__ ((unused)) int ___retval_f0__i_1; 9 9 } 10 10 int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){ 11 int ___retval_f1__i_1;11 __attribute__ ((unused)) int ___retval_f1__i_1; 12 12 } 13 13 int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 14 int ___retval_f2__i_1;14 __attribute__ ((unused)) int ___retval_f2__i_1; 15 15 } 16 16 struct S { … … 40 40 } 41 41 int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){ 42 int ___retval_f3__i_1;42 __attribute__ ((unused)) int ___retval_f3__i_1; 43 43 struct S __s__2sS_2; 44 44 } 45 45 int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 46 int ___retval_f4__i_1;46 __attribute__ ((unused)) int ___retval_f4__i_1; 47 47 } 48 48 int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 49 int ___retval_f5__i_1;49 __attribute__ ((unused)) int ___retval_f5__i_1; 50 50 } 51 51 int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __anonymous_object0){ 52 int (*___retval_f6__PFi_i__1)(int __anonymous_object1);52 __attribute__ ((unused)) int (*___retval_f6__PFi_i__1)(int __anonymous_object1); 53 53 } 54 54 int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){ 55 int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);55 __attribute__ ((unused)) int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1); 56 56 } 57 57 int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 58 int *___retval_f8__Pi_1;58 __attribute__ ((unused)) int *___retval_f8__Pi_1; 59 59 } 60 60 int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){ 61 int *const ___retval_f9__CPi_1;61 __attribute__ ((unused)) int *const ___retval_f9__CPi_1; 62 62 } 63 63 int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){ 64 int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);64 __attribute__ ((unused)) int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1); 65 65 int *__x__FPi_ii__2(int __anonymous_object2, int __anonymous_object3); 66 66 ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */); … … 68 68 } 69 69 int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{ 70 int (*___retval_f11__PA0i_1)[];70 __attribute__ ((unused)) int (*___retval_f11__PA0i_1)[]; 71 71 } 72 72 int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{ 73 int (*___retval_f12__PA0A0i_1)[][((unsigned int )10)];73 __attribute__ ((unused)) int (*___retval_f12__PA0A0i_1)[][((unsigned int )10)]; 74 74 } 75 75 int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{ 76 int (*___retval_f13__PA0A0i_1)[][((unsigned int )10)];76 __attribute__ ((unused)) int (*___retval_f13__PA0A0i_1)[][((unsigned int )10)]; 77 77 } 78 78 int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{ 79 int (*___retval_f14__PA0A0i_1)[][((unsigned int )10)];79 __attribute__ ((unused)) int (*___retval_f14__PA0A0i_1)[][((unsigned int )10)]; 80 80 } 81 81 const int __fred__FCi___1(){ 82 const int ___retval_fred__Ci_1;82 __attribute__ ((unused)) const int ___retval_fred__Ci_1; 83 83 int *(*__x__PFPi_ii__2)(int __anonymous_object4, int __anonymous_object5); 84 84 int __a__i_2; … … 88 88 ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */); 89 89 const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){ 90 const int ___retval_f1__Ci_2;90 __attribute__ ((unused)) const int ___retval_f1__Ci_2; 91 91 } 92 92 const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){ 93 const int ___retval_f2__Ci_2;93 __attribute__ ((unused)) const int ___retval_f2__Ci_2; 94 94 } 95 95 } -
src/tests/.expect/32/attributes.txt
r9c951e3 rb1e63ac5 6 6 extern int printf(const char *__restrict __format, ...); 7 7 int __la__Fi___1(){ 8 int ___retval_la__i_1;8 __attribute__ ((unused)) int ___retval_la__i_1; 9 9 L: __attribute__ ((unused)) ((void)1); 10 10 } … … 226 226 __attribute__ ((unused,used)) int __f1__Fi___1(); 227 227 __attribute__ ((unused)) int __f1__Fi___1(){ 228 int ___retval_f1__i_1;228 __attribute__ ((unused)) int ___retval_f1__i_1; 229 229 } 230 230 __attribute__ ((unused,unused,unused,used)) int **const __f2__FCPPi___1(); 231 231 __attribute__ ((unused,unused,unused)) int **const __f2__FCPPi___1(){ 232 int **const ___retval_f2__CPPi_1;232 __attribute__ ((unused)) int **const ___retval_f2__CPPi_1; 233 233 } 234 234 __attribute__ ((unused,used,unused)) int (*__f3__FPA0i_i__1(int __anonymous_object1))[]; 235 235 __attribute__ ((unused,unused)) int (*__f3__FPA0i_i__1(int __p__i_1))[]{ 236 int (*___retval_f3__PA0i_1)[];236 __attribute__ ((unused)) int (*___retval_f3__PA0i_1)[]; 237 237 } 238 238 __attribute__ ((unused,used,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object2); 239 239 __attribute__ ((unused,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object3){ 240 int (*___retval_f4__PFi_i__1)(int __anonymous_object4);240 __attribute__ ((unused)) int (*___retval_f4__PFi_i__1)(int __anonymous_object4); 241 241 } 242 242 int __vtr__Fi___1(){ 243 int ___retval_vtr__i_1;243 __attribute__ ((unused)) int ___retval_vtr__i_1; 244 244 __attribute__ ((unused,unused,used)) int __t1__i_2; 245 245 __attribute__ ((unused,unused,unused,unused,unused)) int **__t2__PPi_2; … … 251 251 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1); 252 252 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1){ 253 int ___retval_ipd1__i_1;253 __attribute__ ((unused)) int ___retval_ipd1__i_1; 254 254 } 255 255 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1); 256 256 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){ 257 int ___retval_ipd2__i_1;257 __attribute__ ((unused)) int ___retval_ipd2__i_1; 258 258 } 259 259 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1); 260 260 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){ 261 int ___retval_ipd3__i_1;261 __attribute__ ((unused)) int ___retval_ipd3__i_1; 262 262 } 263 263 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)()); 264 264 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)()){ 265 int ___retval_ipd4__i_1;265 __attribute__ ((unused)) int ___retval_ipd4__i_1; 266 266 } 267 267 int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) int __Foo__i_1); … … 273 273 int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) int (*__anonymous_object7)(__attribute__ ((unused)) int (*__anonymous_object8)(__attribute__ ((unused,unused)) int __anonymous_object9))); 274 274 int __ad__Fi___1(){ 275 int ___retval_ad__i_1;275 __attribute__ ((unused)) int ___retval_ad__i_1; 276 276 __attribute__ ((used,unused)) int __ad1__i_2; 277 277 __attribute__ ((unused,unused,unused)) int *__ad2__Pi_2; -
src/tests/.expect/32/declarationSpecifier.txt
r9c951e3 rb1e63ac5 670 670 static inline volatile const short __f48__FCVs___1(); 671 671 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){ 672 int ___retval_main__i_1;672 __attribute__ ((unused)) int ___retval_main__i_1; 673 673 ((void)(___retval_main__i_1=((int )0)) /* ?{} */); 674 674 return ((int )___retval_main__i_1); … … 685 685 static inline int invoke_main(int argc, char **argv, char **envp); 686 686 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){ 687 int ___retval_main__i_1;687 __attribute__ ((unused)) int ___retval_main__i_1; 688 688 int _tmp_cp_ret0; 689 689 ((void)(___retval_main__i_1=((_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1)) , _tmp_cp_ret0)) /* ?{} */); -
src/tests/.expect/32/extension.txt
r9c951e3 rb1e63ac5 85 85 __extension__ int j; 86 86 __extension__ int __fred__Fi_i__1(int __p__i_1){ 87 int ___retval_fred__i_1;87 __attribute__ ((unused)) int ___retval_fred__i_1; 88 88 __extension__ struct S { 89 89 __extension__ int __a__i_2; … … 105 105 ((void)((*((int *)(&_tmp_cp_ret0)))) /* ^?{} */); 106 106 __extension__ int __mary__Fi_i__2(int __p__i_2){ 107 int ___retval_mary__i_2;107 __attribute__ ((unused)) int ___retval_mary__i_2; 108 108 } 109 109 ((void)__extension__ sizeof(3)); -
src/tests/.expect/32/gccExtensions.txt
r9c951e3 rb1e63ac5 7 7 extern int __x__i_1 asm ( "xx" ); 8 8 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){ 9 int ___retval_main__i_1;9 __attribute__ ((unused)) int ___retval_main__i_1; 10 10 asm ( "nop" : : : ); 11 11 asm ( "nop" : : : ); … … 26 26 const int __i3__Ci_2; 27 27 inline int __f1__Fi___2(){ 28 int ___retval_f1__i_2;28 __attribute__ ((unused)) int ___retval_f1__i_2; 29 29 } 30 30 inline int __f2__Fi___2(){ 31 int ___retval_f2__i_2;31 __attribute__ ((unused)) int ___retval_f2__i_2; 32 32 } 33 33 int __s1__i_2; … … 182 182 static inline int invoke_main(int argc, char **argv, char **envp); 183 183 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){ 184 int ___retval_main__i_1;184 __attribute__ ((unused)) int ___retval_main__i_1; 185 185 int _tmp_cp_ret0; 186 186 ((void)(___retval_main__i_1=((_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1)) , _tmp_cp_ret0)) /* ?{} */); -
src/tests/.expect/32/math.txt
r9c951e3 rb1e63ac5 1 fabs: 1 1 1 1.41421 1.41421356237309505 1.41421356237309505 2 fmod: 1 1 1 1 1 1 3 remainder: -1 -1 -1 4 remquo: 7 0.0999999 7 0.1 7 0.0999999999999999999 5 div: 7 0.0999999 7 0.1 7 0.0999999999999999999 6 fma: -2 -2 -2 7 fdim: 2 2 2 8 nan: nan nan nan 9 exp: 2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i 10 exp2: 2 2 2 11 expm1: 1.71828 1.71828182845905 1.71828182845904524 12 log: 0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 13 log2: 3 3 3 14 log10: 2 2 2 15 log1p: 0.693147 0.693147180559945 0.693147180559945309 16 ilogb: 0 0 0 17 logb: 3 3 3 18 sqrt: 1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 19 cbrt: 3 3 3 20 hypot: 1.41421 1.4142135623731 1.41421356237309505 21 pow: 1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 22 sin: 0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 23 cos: 0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i 24 tan: 1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 25 asin: 1.5708 1.5707963267949 1.57079632679489662 0.66624+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 26 acos: 0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 27 atan: 0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 28 atan2: 0.785398 0.785398163397448 0.78539816339744831 atan: 0.785398 0.785398163397448 0.78539816339744831 sinh: 1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i 29 cosh: 1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 30 tanh: 0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 31 acosh: 0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 32 asinh: 0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 33 atanh: inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i 34 erf: 0.842701 0.842700792949715 0.842700792949714869 35 erfc: 0.157299 0.157299207050285 0.157299207050285131 36 lgamma: 1.79176 1.79175946922805 1.791759469228055 37 lgamma: 1.79176 1 1.79175946922805 1 1.791759469228055 1 38 tgamma: 6 6 6 39 floor: 1 1 1 40 ceil: 2 2 2 41 trunc: 3 3 3 42 rint: 2 2 2 43 rint: 2 2 2 44 rint: 2 2 2 45 lrint: 2 2 2 46 llrint: 2 2 2 47 nearbyint: 4 4 4 48 round: 2 2 2 49 round: 2 2 2 50 round: 2 2 2 51 lround: 2 2 2 52 llround: 2 2 2 53 copysign: -1 -1 -1 54 frexp: 0.5 3 0.5 3 0.5 3 55 ldexp: 8 8 8 56 modf: 2 0.3 2 0.3 2 0.3 nextafter: 2 2 2 57 nexttoward: 2 2 2 58 scalbn: 16 16 16 59 scalbln: 16 16 16 1 fmod:1 1 1 1 1 1 2 remainder:-1 -1 -1 3 remquo:7 0.0999999 7 0.1 7 0.0999999999999999999 4 div:7 0.0999999 7 0.1 7 0.0999999999999999999 5 fma:-2 -2 -2 6 fdim:2 2 2 7 nan:nan nan nan 8 exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i 9 exp2:2 2 2 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 12 log2:3 3 3 13 log10:2 2 2 14 log1p:0.693147 0.693147180559945 0.693147180559945309 15 ilogb:0 0 0 16 logb:3 3 3 17 sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 18 cbrt:3 3 3 19 hypot:1.41421 1.4142135623731 1.41421356237309505 20 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 21 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 22 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i 23 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 24 asin:1.5708 1.5707963267949 1.57079632679489662 0.66624+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 25 acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 26 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 27 atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 sinh:1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i 28 cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 29 tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 30 acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 31 asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 32 atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i 33 erf:0.842701 0.842700792949715 0.842700792949714869 34 erfc:0.157299 0.157299207050285 0.157299207050285131 35 lgamma:1.79176 1.79175946922805 1.791759469228055 36 lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1 37 tgamma:6 6 6 38 floor:1 1 1 39 ceil:2 2 2 40 trunc:3 3 3 41 rint:2 2 2 42 rint:2 2 2 43 rint:2 2 2 44 lrint:2 2 2 45 llrint:2 2 2 46 nearbyint:4 4 4 47 round:2 2 2 48 round:2 2 2 49 round:2 2 2 50 lround:2 2 2 51 llround:2 2 2 52 copysign:-1 -1 -1 53 frexp:0.5 3 0.5 3 0.5 3 54 ldexp:8 8 8 55 modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2 56 nexttoward:2 2 2 57 scalbn:16 16 16 58 scalbln:16 16 16 -
src/tests/.expect/64/KRfunctions.txt
r9c951e3 rb1e63ac5 6 6 extern int printf(const char *__restrict __format, ...); 7 7 int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){ 8 int ___retval_f0__i_1;8 __attribute__ ((unused)) int ___retval_f0__i_1; 9 9 } 10 10 int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){ 11 int ___retval_f1__i_1;11 __attribute__ ((unused)) int ___retval_f1__i_1; 12 12 } 13 13 int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 14 int ___retval_f2__i_1;14 __attribute__ ((unused)) int ___retval_f2__i_1; 15 15 } 16 16 struct S { … … 40 40 } 41 41 int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){ 42 int ___retval_f3__i_1;42 __attribute__ ((unused)) int ___retval_f3__i_1; 43 43 struct S __s__2sS_2; 44 44 } 45 45 int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 46 int ___retval_f4__i_1;46 __attribute__ ((unused)) int ___retval_f4__i_1; 47 47 } 48 48 int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 49 int ___retval_f5__i_1;49 __attribute__ ((unused)) int ___retval_f5__i_1; 50 50 } 51 51 int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __anonymous_object0){ 52 int (*___retval_f6__PFi_i__1)(int __anonymous_object1);52 __attribute__ ((unused)) int (*___retval_f6__PFi_i__1)(int __anonymous_object1); 53 53 } 54 54 int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){ 55 int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);55 __attribute__ ((unused)) int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1); 56 56 } 57 57 int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){ 58 int *___retval_f8__Pi_1;58 __attribute__ ((unused)) int *___retval_f8__Pi_1; 59 59 } 60 60 int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){ 61 int *const ___retval_f9__CPi_1;61 __attribute__ ((unused)) int *const ___retval_f9__CPi_1; 62 62 } 63 63 int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){ 64 int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);64 __attribute__ ((unused)) int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1); 65 65 int *__x__FPi_ii__2(int __anonymous_object2, int __anonymous_object3); 66 66 ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */); … … 68 68 } 69 69 int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{ 70 int (*___retval_f11__PA0i_1)[];70 __attribute__ ((unused)) int (*___retval_f11__PA0i_1)[]; 71 71 } 72 72 int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{ 73 int (*___retval_f12__PA0A0i_1)[][((long unsigned int )10)];73 __attribute__ ((unused)) int (*___retval_f12__PA0A0i_1)[][((long unsigned int )10)]; 74 74 } 75 75 int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{ 76 int (*___retval_f13__PA0A0i_1)[][((long unsigned int )10)];76 __attribute__ ((unused)) int (*___retval_f13__PA0A0i_1)[][((long unsigned int )10)]; 77 77 } 78 78 int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{ 79 int (*___retval_f14__PA0A0i_1)[][((long unsigned int )10)];79 __attribute__ ((unused)) int (*___retval_f14__PA0A0i_1)[][((long unsigned int )10)]; 80 80 } 81 81 const int __fred__FCi___1(){ 82 const int ___retval_fred__Ci_1;82 __attribute__ ((unused)) const int ___retval_fred__Ci_1; 83 83 int *(*__x__PFPi_ii__2)(int __anonymous_object4, int __anonymous_object5); 84 84 int __a__i_2; … … 88 88 ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */); 89 89 const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){ 90 const int ___retval_f1__Ci_2;90 __attribute__ ((unused)) const int ___retval_f1__Ci_2; 91 91 } 92 92 const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){ 93 const int ___retval_f2__Ci_2;93 __attribute__ ((unused)) const int ___retval_f2__Ci_2; 94 94 } 95 95 } -
src/tests/.expect/64/attributes.txt
r9c951e3 rb1e63ac5 6 6 extern int printf(const char *__restrict __format, ...); 7 7 int __la__Fi___1(){ 8 int ___retval_la__i_1;8 __attribute__ ((unused)) int ___retval_la__i_1; 9 9 L: __attribute__ ((unused)) ((void)1); 10 10 } … … 226 226 __attribute__ ((unused,used)) int __f1__Fi___1(); 227 227 __attribute__ ((unused)) int __f1__Fi___1(){ 228 int ___retval_f1__i_1;228 __attribute__ ((unused)) int ___retval_f1__i_1; 229 229 } 230 230 __attribute__ ((unused,unused,unused,used)) int **const __f2__FCPPi___1(); 231 231 __attribute__ ((unused,unused,unused)) int **const __f2__FCPPi___1(){ 232 int **const ___retval_f2__CPPi_1;232 __attribute__ ((unused)) int **const ___retval_f2__CPPi_1; 233 233 } 234 234 __attribute__ ((unused,used,unused)) int (*__f3__FPA0i_i__1(int __anonymous_object1))[]; 235 235 __attribute__ ((unused,unused)) int (*__f3__FPA0i_i__1(int __p__i_1))[]{ 236 int (*___retval_f3__PA0i_1)[];236 __attribute__ ((unused)) int (*___retval_f3__PA0i_1)[]; 237 237 } 238 238 __attribute__ ((unused,used,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object2); 239 239 __attribute__ ((unused,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object3){ 240 int (*___retval_f4__PFi_i__1)(int __anonymous_object4);240 __attribute__ ((unused)) int (*___retval_f4__PFi_i__1)(int __anonymous_object4); 241 241 } 242 242 int __vtr__Fi___1(){ 243 int ___retval_vtr__i_1;243 __attribute__ ((unused)) int ___retval_vtr__i_1; 244 244 __attribute__ ((unused,unused,used)) int __t1__i_2; 245 245 __attribute__ ((unused,unused,unused,unused,unused)) int **__t2__PPi_2; … … 251 251 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1); 252 252 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1){ 253 int ___retval_ipd1__i_1;253 __attribute__ ((unused)) int ___retval_ipd1__i_1; 254 254 } 255 255 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1); 256 256 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){ 257 int ___retval_ipd2__i_1;257 __attribute__ ((unused)) int ___retval_ipd2__i_1; 258 258 } 259 259 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1); 260 260 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){ 261 int ___retval_ipd3__i_1;261 __attribute__ ((unused)) int ___retval_ipd3__i_1; 262 262 } 263 263 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)()); 264 264 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)()){ 265 int ___retval_ipd4__i_1;265 __attribute__ ((unused)) int ___retval_ipd4__i_1; 266 266 } 267 267 int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) int __Foo__i_1); … … 273 273 int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) int (*__anonymous_object7)(__attribute__ ((unused)) int (*__anonymous_object8)(__attribute__ ((unused,unused)) int __anonymous_object9))); 274 274 int __ad__Fi___1(){ 275 int ___retval_ad__i_1;275 __attribute__ ((unused)) int ___retval_ad__i_1; 276 276 __attribute__ ((used,unused)) int __ad1__i_2; 277 277 __attribute__ ((unused,unused,unused)) int *__ad2__Pi_2; -
src/tests/.expect/64/declarationSpecifier.txt
r9c951e3 rb1e63ac5 670 670 static inline volatile const short __f48__FCVs___1(); 671 671 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){ 672 int ___retval_main__i_1;672 __attribute__ ((unused)) int ___retval_main__i_1; 673 673 ((void)(___retval_main__i_1=((int )0)) /* ?{} */); 674 674 return ((int )___retval_main__i_1); … … 685 685 static inline int invoke_main(int argc, char **argv, char **envp); 686 686 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){ 687 int ___retval_main__i_1;687 __attribute__ ((unused)) int ___retval_main__i_1; 688 688 int _tmp_cp_ret0; 689 689 ((void)(___retval_main__i_1=((_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1)) , _tmp_cp_ret0)) /* ?{} */); -
src/tests/.expect/64/extension.txt
r9c951e3 rb1e63ac5 85 85 __extension__ int j; 86 86 __extension__ int __fred__Fi_i__1(int __p__i_1){ 87 int ___retval_fred__i_1;87 __attribute__ ((unused)) int ___retval_fred__i_1; 88 88 __extension__ struct S { 89 89 __extension__ int __a__i_2; … … 105 105 ((void)((*((int *)(&_tmp_cp_ret0)))) /* ^?{} */); 106 106 __extension__ int __mary__Fi_i__2(int __p__i_2){ 107 int ___retval_mary__i_2;107 __attribute__ ((unused)) int ___retval_mary__i_2; 108 108 } 109 109 ((void)__extension__ sizeof(3)); -
src/tests/.expect/64/gccExtensions.txt
r9c951e3 rb1e63ac5 7 7 extern int __x__i_1 asm ( "xx" ); 8 8 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){ 9 int ___retval_main__i_1;9 __attribute__ ((unused)) int ___retval_main__i_1; 10 10 asm ( "nop" : : : ); 11 11 asm ( "nop" : : : ); … … 26 26 const int __i3__Ci_2; 27 27 inline int __f1__Fi___2(){ 28 int ___retval_f1__i_2;28 __attribute__ ((unused)) int ___retval_f1__i_2; 29 29 } 30 30 inline int __f2__Fi___2(){ 31 int ___retval_f2__i_2;31 __attribute__ ((unused)) int ___retval_f2__i_2; 32 32 } 33 33 int __s1__i_2; … … 182 182 static inline int invoke_main(int argc, char **argv, char **envp); 183 183 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){ 184 int ___retval_main__i_1;184 __attribute__ ((unused)) int ___retval_main__i_1; 185 185 int _tmp_cp_ret0; 186 186 ((void)(___retval_main__i_1=((_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1)) , _tmp_cp_ret0)) /* ?{} */); -
src/tests/.expect/64/gmp.txt
r9c951e3 rb1e63ac5 4 4 conversions 5 5 y:97 6 y:12345678901234567890123456789 6 7 y:3 7 8 y:-3 … … 24 25 z:150000000000000000000 25 26 z:16666666666666666666 27 16666666666666666666, 2 16666666666666666666, 2 26 28 x:16666666666666666666 y:2 27 29 -
src/tests/.expect/64/math.txt
r9c951e3 rb1e63ac5 1 fabs: 1 1 1 1.41421 1.41421356237309505 1.41421356237309505 2 fmod: 1 1 1 1 1 1 3 remainder: -1 -1 -1 4 remquo: 7 0.0999999 7 0.1 7 0.0999999999999999999 5 div: 7 0.0999999 7 0.1 7 0.0999999999999999999 6 fma: -2 -2 -2 7 fdim: 2 2 2 8 nan: nan nan nan 9 exp: 2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i 10 exp2: 2 2 2 11 expm1: 1.71828 1.71828182845905 1.71828182845904524 12 log: 0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 13 log2: 3 3 3 14 log10: 2 2 2 15 log1p: 0.693147 0.693147180559945 0.693147180559945309 16 ilogb: 0 0 0 17 logb: 3 3 3 18 sqrt: 1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 19 cbrt: 3 3 3 20 hypot: 1.41421 1.4142135623731 1.41421356237309505 21 pow: 1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 22 sin: 0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 23 cos: 0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i 24 tan: 1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 25 asin: 1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 26 acos: 0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 27 atan: 0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 28 atan2: 0.785398 0.785398163397448 0.78539816339744831 atan: 0.785398 0.785398163397448 0.78539816339744831 sinh: 1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i 29 cosh: 1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 30 tanh: 0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 31 acosh: 0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 32 asinh: 0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 33 atanh: inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i 34 erf: 0.842701 0.842700792949715 0.842700792949714869 35 erfc: 0.157299 0.157299207050285 0.157299207050285131 36 lgamma: 1.79176 1.79175946922805 1.791759469228055 37 lgamma: 1.79176 1 1.79175946922805 1 1.791759469228055 1 38 tgamma: 6 6 6 39 floor: 1 1 1 40 ceil: 2 2 2 41 trunc: 3 3 3 42 rint: 2 2 2 43 rint: 2 2 2 44 rint: 2 2 2 45 lrint: 2 2 2 46 llrint: 2 2 2 47 nearbyint: 4 4 4 48 round: 2 2 2 49 round: 2 2 2 50 round: 2 2 2 51 lround: 2 2 2 52 llround: 2 2 2 53 copysign: -1 -1 -1 54 frexp: 0.5 3 0.5 3 0.5 3 55 ldexp: 8 8 8 56 modf: 2 0.3 2 0.3 2 0.3 nextafter: 2 2 2 57 nexttoward: 2 2 2 58 scalbn: 16 16 16 59 scalbln: 16 16 16 1 fmod:1 1 1 1 1 1 2 remainder:-1 -1 -1 3 remquo:7 0.0999999 7 0.1 7 0.0999999999999999999 4 div:7 0.0999999 7 0.1 7 0.0999999999999999999 5 fma:-2 -2 -2 6 fdim:2 2 2 7 nan:nan nan nan 8 exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i 9 exp2:2 2 2 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 12 log2:3 3 3 13 log10:2 2 2 14 log1p:0.693147 0.693147180559945 0.693147180559945309 15 ilogb:0 0 0 16 logb:3 3 3 17 sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 18 cbrt:3 3 3 19 hypot:1.41421 1.4142135623731 1.41421356237309505 20 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 21 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 22 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i 23 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 24 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 25 acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 26 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 27 atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 sinh:1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i 28 cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 29 tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 30 acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 31 asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 32 atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i 33 erf:0.842701 0.842700792949715 0.842700792949714869 34 erfc:0.157299 0.157299207050285 0.157299207050285131 35 lgamma:1.79176 1.79175946922805 1.791759469228055 36 lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1 37 tgamma:6 6 6 38 floor:1 1 1 39 ceil:2 2 2 40 trunc:3 3 3 41 rint:2 2 2 42 rint:2 2 2 43 rint:2 2 2 44 lrint:2 2 2 45 llrint:2 2 2 46 nearbyint:4 4 4 47 round:2 2 2 48 round:2 2 2 49 round:2 2 2 50 lround:2 2 2 51 llround:2 2 2 52 copysign:-1 -1 -1 53 frexp:0.5 3 0.5 3 0.5 3 54 ldexp:8 8 8 55 modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2 56 nexttoward:2 2 2 57 scalbn:16 16 16 58 scalbln:16 16 16 -
src/tests/.expect/io.txt
r9c951e3 rb1e63ac5 4 4 123 5 5 6 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10 7 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 8 x`1`x'2'x"3"x:4:x 5 x 6 x 9 7 10 x 11 8 12 x 13 9 14 x 15 10 16 x 17 x ( 1 ) x 2 , x 3 :x: 4 6 18 A 7 19 1 2 3 4 5 6 7 8 … … 18 30 abc, $xyz 19 31 20 v(27 v[27 v{27 $27 =27 £27 ¥27 ¡27 ¿27 «27 21 25, 25. 25: 25; 25! 25? 25% 25¢ 25» 25) 25] 25} 22 25'27 25`27 25"27 25 27 25 23 27 25 24 27 25 25 27 25 27 25 26 27 32 1, 2, 3, 4 33 1, $2, $3 ", $" 34 1 2 3 " " 35 1 2 3 36 12 3 37 123 38 1 23 39 1 2 3 40 1 2 3 4 " " 41 1, 2, 3, 4 ", " 42 1, 2, 3, 4 27 43 3, 4, a, 7.2 28 44 3, 4, a, 7.2 29 45 3 4 a 7.2 30 3 4 a 7.234a7.2 3 4 a 7.246 3 4 a 7.234a7.23 4 a 7.2 31 47 3-4-a-7.2^3^4-3-4-a-7.2 -
src/tests/.expect/scopeErrors.txt
r9c951e3 rb1e63ac5 3 3 with parameters 4 4 double 5 returning 6 _retval_butThisIsAnError: double 7 with body 5 returning 6 _retval_butThisIsAnError: Attribute with name: unused 7 double 8 with body 8 9 CompoundStmt -
src/tests/KRfunctions.c
r9c951e3 rb1e63ac5 1 // -*- Mode: C -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo … … 11 10 // Created On : Thu Feb 16 15:23:17 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Feb 16 15:25:52201714 // Update Count : 212 // Last Modified On : Wed May 24 22:05:00 2017 13 // Update Count : 3 15 14 // 16 15 -
src/tests/Makefile.am
r9c951e3 rb1e63ac5 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sun May 14 14:43:48201714 ## Update Count : 4 213 ## Last Modified On : Thu Jun 8 07:41:43 2017 14 ## Update Count : 44 15 15 ############################################################################### 16 16 … … 20 20 21 21 if BUILD_CONCURRENCY 22 concurrent =yes23 quick_test += coroutine thread monitor24 concurrent_test =coroutine thread monitor multi-monitor sched-int-disjoint sched-int-bargesched-int-wait sched-ext sched-ext-multi preempt22 concurrent = yes 23 quick_test += coroutine thread monitor 24 concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt 25 25 else 26 26 concurrent=no … … 36 36 37 37 .PHONY : list 38 EXTRA_PROGRAMS = fstream_test vector_test avl_test constant0-1DP constant0-1ND constant0-1NDDP# build but do not install38 EXTRA_PROGRAMS = fstream_test vector_test avl_test # build but do not install 39 39 40 40 fstream_test_SOURCES = fstream_test.c … … 57 57 @+python test.py --debug=${debug} --concurrent=${concurrent} ${concurrent_test} 58 58 59 .dummy : .dummy.c 59 .dummy : .dummy.c @CFA_BINDIR@/@CFA_NAME@ 60 60 ${CC} ${BUILD_FLAGS} -XCFA -n ${<} -o ${@} #don't use CFLAGS, this rule is not a real test 61 61 62 constant0-1DP : constant0-1.c63 ${CC} ${CFLAGS} -DDUPS ${<} -o ${@}64 62 65 constant0-1ND : constant0-1.c 66 ${CC} ${CFLAGS} -DNEWDECL${<} -o ${@}63 % : %.c @CFA_BINDIR@/@CFA_NAME@ 64 ${CC} ${CFLAGS} ${<} -o ${@} 67 65 68 constant0-1NDDP : constant0-1.c 69 ${CC} ${CFLAGS} -DNEWDECL -DDUPS ${<} -o ${@} 70 71 dtor-early-exit-ERR1: dtor-early-exit.c 66 dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@ 72 67 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 73 68 74 dtor-early-exit-ERR2: dtor-early-exit.c 69 dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@ 75 70 ${CC} ${CFLAGS} -DERR2 ${<} -o ${@} 76 71 77 declarationSpecifier: declarationSpecifier.c 72 declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@ 78 73 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 79 74 80 gccExtensions : gccExtensions.c 75 gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@ 81 76 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 82 77 83 extension : extension.c 78 extension : extension.c @CFA_BINDIR@/@CFA_NAME@ 84 79 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 85 80 86 attributes : attributes.c 81 attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@ 87 82 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 88 83 89 KRfunctions : KRfunctions.c 84 KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@ 90 85 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 91 86 92 gmp : gmp.c 87 gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@ 93 88 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 94 89 95 memberCtors-ERR1: memberCtors.c 90 memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@ 96 91 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 97 92 98 completeTypeError : completeTypeError.c 93 completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@ 99 94 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} -
src/tests/Makefile.in
r9c951e3 rb1e63ac5 39 39 @BUILD_CONCURRENCY_TRUE@am__append_1 = coroutine thread monitor 40 40 EXTRA_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \ 41 avl_test$(EXEEXT) constant0-1DP$(EXEEXT) \ 42 constant0-1ND$(EXEEXT) constant0-1NDDP$(EXEEXT) 41 avl_test$(EXEEXT) 43 42 subdir = src/tests 44 43 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in … … 56 55 avl_test_OBJECTS = $(am_avl_test_OBJECTS) 57 56 avl_test_LDADD = $(LDADD) 58 constant0_1DP_SOURCES = constant0-1DP.c59 constant0_1DP_OBJECTS = constant0-1DP.$(OBJEXT)60 constant0_1DP_LDADD = $(LDADD)61 constant0_1ND_SOURCES = constant0-1ND.c62 constant0_1ND_OBJECTS = constant0-1ND.$(OBJEXT)63 constant0_1ND_LDADD = $(LDADD)64 constant0_1NDDP_SOURCES = constant0-1NDDP.c65 constant0_1NDDP_OBJECTS = constant0-1NDDP.$(OBJEXT)66 constant0_1NDDP_LDADD = $(LDADD)67 57 am_fstream_test_OBJECTS = fstream_test.$(OBJEXT) 68 58 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS) … … 95 85 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) 96 86 am__v_GEN_0 = @echo " GEN " $@; 97 SOURCES = $(avl_test_SOURCES) constant0-1DP.c constant0-1ND.c \ 98 constant0-1NDDP.c $(fstream_test_SOURCES) \ 87 SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \ 99 88 $(vector_test_SOURCES) 100 DIST_SOURCES = $(avl_test_SOURCES) constant0-1DP.c constant0-1ND.c \ 101 constant0-1NDDP.c $(fstream_test_SOURCES) \ 89 DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \ 102 90 $(vector_test_SOURCES) 103 91 ETAGS = etags … … 230 218 @BUILD_CONCURRENCY_TRUE@concurrent = yes 231 219 @BUILD_CONCURRENCY_FALSE@concurrent_test = 232 @BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int- disjoint sched-int-bargesched-int-wait sched-ext sched-ext-multi preempt220 @BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt 233 221 234 222 # applies to both programs … … 297 285 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@ 298 286 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_test.Po@am__quote@ 299 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant0-1DP.Po@am__quote@300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant0-1ND.Po@am__quote@301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant0-1NDDP.Po@am__quote@302 287 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@ 303 288 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@ … … 676 661 @+python test.py --debug=${debug} --concurrent=${concurrent} ${concurrent_test} 677 662 678 .dummy : .dummy.c 663 .dummy : .dummy.c @CFA_BINDIR@/@CFA_NAME@ 679 664 ${CC} ${BUILD_FLAGS} -XCFA -n ${<} -o ${@} #don't use CFLAGS, this rule is not a real test 680 665 681 constant0-1DP : constant0-1.c 682 ${CC} ${CFLAGS} -DDUPS ${<} -o ${@} 683 684 constant0-1ND : constant0-1.c 685 ${CC} ${CFLAGS} -DNEWDECL ${<} -o ${@} 686 687 constant0-1NDDP : constant0-1.c 688 ${CC} ${CFLAGS} -DNEWDECL -DDUPS ${<} -o ${@} 689 690 dtor-early-exit-ERR1: dtor-early-exit.c 666 % : %.c @CFA_BINDIR@/@CFA_NAME@ 667 ${CC} ${CFLAGS} ${<} -o ${@} 668 669 dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@ 691 670 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 692 671 693 dtor-early-exit-ERR2: dtor-early-exit.c 672 dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@ 694 673 ${CC} ${CFLAGS} -DERR2 ${<} -o ${@} 695 674 696 declarationSpecifier: declarationSpecifier.c 675 declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@ 697 676 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 698 677 699 gccExtensions : gccExtensions.c 678 gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@ 700 679 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 701 680 702 extension : extension.c 681 extension : extension.c @CFA_BINDIR@/@CFA_NAME@ 703 682 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 704 683 705 attributes : attributes.c 684 attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@ 706 685 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 707 686 708 KRfunctions : KRfunctions.c 687 KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@ 709 688 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 710 689 711 gmp : gmp.c 690 gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@ 712 691 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 713 692 714 memberCtors-ERR1: memberCtors.c 693 memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@ 715 694 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 716 695 717 completeTypeError : completeTypeError.c 696 completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@ 718 697 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 719 698 -
src/tests/coroutine.c
r9c951e3 rb1e63ac5 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fibonacci.c -- 8 // 9 // Author : Thierry Delisle 10 // Created On : Thu Jun 8 07:29:37 2017 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 8 07:37:12 2017 13 // Update Count : 5 14 // 15 1 16 #include <fstream> 2 17 #include <coroutine> 3 18 4 19 coroutine Fibonacci { 5 int fn;// used for communication20 int fn; // used for communication 6 21 }; 7 22 8 void ?{}( Fibonacci* this) {9 this->fn = 0;23 void ?{}( Fibonacci * this ) { 24 this->fn = 0; 10 25 } 11 26 12 void main( Fibonacci* this) {13 int fn1, fn2;// retained between resumes14 this->fn = 0; 15 fn1 = this->fn;16 suspend();// return to last resume27 void main( Fibonacci * this ) { 28 int fn1, fn2; // retained between resumes 29 this->fn = 0; // case 0 30 fn1 = this->fn; 31 suspend(); // return to last resume 17 32 18 this->fn = 1; 19 fn2 = fn1;20 fn1 = this->fn;21 suspend();// return to last resume33 this->fn = 1; // case 1 34 fn2 = fn1; 35 fn1 = this->fn; 36 suspend(); // return to last resume 22 37 23 for ( ;; ) { 24 this->fn = fn1 + fn2;25 fn2 = fn1;26 fn1 = this->fn;27 suspend();// return to last resume28 } 38 for ( ;; ) { // general case 39 this->fn = fn1 + fn2; 40 fn2 = fn1; 41 fn1 = this->fn; 42 suspend(); // return to last resume 43 } // for 29 44 } 30 45 31 int next( Fibonacci* this) {32 resume(this);// transfer to last suspend33 return this->fn;46 int next( Fibonacci * this ) { 47 resume( this ); // transfer to last suspend 48 return this->fn; 34 49 } 35 50 36 51 int main() { 37 Fibonacci f1, f2; 38 for ( int i = 1; i <= 10; i += 1 ) { 39 sout | next(&f1) | ' ' | next(&f2) | endl; 40 } 52 Fibonacci f1, f2; 53 for ( int i = 1; i <= 10; i += 1 ) { 54 sout | next( &f1 ) | ' ' | next( &f2 ) | endl; 55 } // for 56 } 41 57 42 return 0; 43 } 58 // Local Variables: // 59 // tab-width: 4 // 60 // compile-command: "cfa fibonacci.c" // 61 // End: // -
src/tests/gmp.c
r9c951e3 rb1e63ac5 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 14 14:46:50201713 // Update Count : 5 3012 // Last Modified On : Wed May 24 22:05:38 2017 13 // Update Count : 540 14 14 // 15 15 16 16 #include <gmp> 17 17 18 int main( ) {18 int main( void ) { 19 19 sout | "constructors" | endl; 20 20 short int si = 3; … … 25 25 sout | "conversions" | endl; 26 26 y = 'a'; 27 sout | "y:" | y | endl; 28 y = "12345678901234567890123456789"; 27 29 sout | "y:" | y | endl; 28 30 y = si; … … 62 64 z = x / 3; 63 65 sout | "z:" | z | endl; 66 sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl; 64 67 [ x, y ] = div( x, 3 ); 65 68 sout | "x:" | x | "y:" | y | endl; 66 // sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;67 69 68 70 sout | endl; … … 72 74 fn = (Int){0}; fn1 = fn; // 1st case 73 75 sout | (int)0 | fn | endl; 74 fn = (Int){1}; fn2 = fn1; fn1 = fn;// 2nd case76 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 75 77 sout | 1 | fn | endl; 76 for ( int i = 2; i <= 200; i += 1 ) {78 for ( unsigned int i = 2; i <= 200; i += 1 ) { 77 79 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 78 80 sout | i | fn | endl; … … 83 85 sout | "Factorial Numbers" | endl; 84 86 Int fact; 85 fact = (Int){1};// 1st case87 fact = 1; // 1st case 86 88 sout | (int)0 | fact | endl; 87 for ( int i = 1; i <= 40; i += 1 ) {88 fact = fact * i;// general case89 for ( unsigned int i = 1; i <= 40; i += 1 ) { 90 fact *= i; // general case 89 91 sout | i | fact | endl; 90 92 } // for … … 92 94 93 95 // Local Variables: // 94 // mode: c //95 96 // tab-width: 4 // 97 // compile-command: "cfa gmp.c -l gmp" // 96 98 // End: // -
src/tests/identity.c
r9c951e3 rb1e63ac5 7 7 // identity.c -- 8 8 // 9 // Author : Richard C. Bilson9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 8 22:15:08 201613 // Update Count : 1 312 // Last Modified On : Thu Jun 8 08:21:32 2017 13 // Update Count : 18 14 14 // 15 15 … … 32 32 sout | "double\t\t\t" | identity( 4.1 ) | endl; 33 33 sout | "long double\t\t" | identity( 4.1l ) | endl; 34 sout | "float _Complex\t\t" | identity( -4.1F-2.0iF ) | endl; 35 sout | "double _Complex\t\t" | identity( -4.1D-2.0iD ) | endl; 36 sout | "long double _Complex\t" | identity( -4.1L-2.0iL ) | endl; 34 37 } 35 38 -
src/tests/io.c
r9c951e3 rb1e63ac5 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 21 22:36:06201713 // Update Count : 4812 // Last Modified On : Thu Jun 8 09:52:10 2017 13 // Update Count : 51 14 14 // 15 15 … … 17 17 18 18 int main() { 19 char c; // basic types19 char c; // basic types 20 20 short int si; 21 21 unsigned short int usi; … … 32 32 double _Complex dc; 33 33 long double _Complex ldc; 34 char s1[10], s2[10]; 34 enum { size = 10 }; 35 char s1[size], s2[size]; 35 36 36 37 int x = 3, y = 5, z = 7; … … 41 42 sout | endl; 42 43 43 ifstream in; // create / open file 44 sout 45 // opening delimiters 46 | "x (" | 1 47 | "x [" | 2 48 | "x {" | 3 49 | "x =" | 4 50 | "x $" | 5 51 | "x £" | 6 52 | "x ¥" | 7 53 | "x ¡" | 8 54 | "x ¿" | 9 55 | "x «" | 10 56 | endl; 57 sout 58 // closing delimiters 59 | 1 | ", x" 60 | 2 | ". x" 61 | 3 | "; x" 62 | 4 | "! x" 63 | 5 | "? x" 64 | 6 | "% x" 65 | 7 | "¢ x" 66 | 8 | "» x" 67 | 9 | ") x" 68 | 10 | "] x" 69 | 11 | "} x" 70 | endl; 71 sout 72 // opening-closing delimiters 73 | "x`" | 1 | "`x'" | 2 74 | "'x\"" | 3 | "\"x:" | 4 75 | ":x " | 5 | " x\t" | 6 76 | "\tx\f" | 7 | "\fx\v" | 8 77 | "\vx\n" | 9 | "\nx\r" | 10 78 | "\rx" | 79 endl; 80 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 81 82 ifstream in; // create / open file 44 83 open( &in, "io.data", "r" ); 45 84 46 &in | &c // character47 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli // integral48 | &f | &d | &ld // floating point49 | &fc | &dc | &ldc // floating-point complex50 | cstr( s1 ) | cstr( s2, 10 );// C string, length unchecked and checked85 &in | &c // character 86 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli // integral 87 | &f | &d | &ld // floating point 88 | &fc | &dc | &ldc // floating-point complex 89 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 51 90 52 sout | c | ' ' | endl // character53 | si | usi | i | ui | li | uli | lli | ulli | endl// integral54 | f | d | ld | endl// floating point55 | fc | dc | ldc | endl;// complex91 sout | c | ' ' | endl // character 92 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 93 | f | d | ld | endl // floating point 94 | fc | dc | ldc | endl; // complex 56 95 sout | endl; 57 sout | f | "" | d | "" | ld | endl // floating point without separator58 | sepDisable | fc | dc | ldc | sepEnable | endl// complex without separator59 | sepOn | s1 | sepOff | s2 | endl// local separator removal60 | s1 | "" | s2 | endl;// C string without separator96 sout | f | "" | d | "" | ld | endl // floating point without separator 97 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator 98 | sepOn | s1 | sepOff | s2 | endl // local separator removal 99 | s1 | "" | s2 | endl; // C string without separator 61 100 sout | endl; 62 101 63 sepSet( sout, ", $" ); // change separator, maximum of 15 characters102 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 64 103 sout | f | d | ld | endl 65 | fc | dc | ldc | endl66 | s1 | s2 | endl;104 | fc | dc | ldc | endl 105 | s1 | s2 | endl; 67 106 sout | endl; 107 108 [int, int] t1 = [1, 2], t2 = [3, 4]; 109 sout | t1 | t2 | endl; // print tuple 110 68 111 sepSet( sout, " " ); 112 sepSet( sout, ", $" ); // set separator from " " to ", $" 113 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 114 sepSet( sout, " " ); // reset separator to " " 115 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 69 116 70 sout 71 // opening delimiters 72 | "v(" | 27 73 | "v[" | 27 74 | "v{" | 27 75 | "$" | 27 76 | "=" | 27 77 | "£" | 27 78 | "¥" | 27 79 | "¡" | 27 80 | "¿" | 27 81 | "«" | 27 82 | endl 83 // closing delimiters 84 | 25 | "," 85 | 25 | "." 86 | 25 | ":" 87 | 25 | ";" 88 | 25 | "!" 89 | 25 | "?" 90 | 25 | "%" 91 | 25 | "¢" 92 | 25 | "»" 93 | 25 | ")" 94 | 25 | "]" 95 | 25 | "}" 96 | endl 97 // opening-closing delimiters 98 | 25 | "'" | 27 99 | 25 | "`" | 27 100 | 25 | "\"" | 27 101 | 25 | " " | 27 102 | 25 | "\f" | 27 103 | 25 | "\n" | 27 104 | 25 | "\r" | 27 105 | 25 | "\t" | 27 106 | 25 | "\v" | 27 107 | endl; 117 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start of line 118 sout | 1 | sepOff | 2 | 3 | endl; // locally turn off implicit separator 108 119 109 [int, int, const char *, double] t = { 3, 4, "a", 7.2 }; 120 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separation 121 sout | 1 | sepOn | 2 | 3 | endl; // locally turn on implicit separator 122 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separation 123 124 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 125 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 126 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 127 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 128 129 sout | t1 | t2 | endl; // print tuple 130 131 [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 }; 110 132 sout | [ 3, 4, "a", 7.2 ] | endl; 111 sout | t | endl;133 sout | t3 | endl; 112 134 sepSetTuple( sout, " " ); 113 sout | t | endl;114 sout | sepOn | t | sepDisable | t | sepEnable | t| endl;135 sout | t3 | endl; 136 sout | sepOn | t3 | sepDisable | t3 | sepEnable | t3 | endl; 115 137 sepSet( sout, "^" ); 116 138 sepSetTuple( sout, "-" ); 117 sout | t | 3 | 4 | t| endl;139 sout | t3 | 3 | 4 | t3 | endl; 118 140 } 119 141 -
src/tests/libcfa_vector.c
r9c951e3 rb1e63ac5 27 27 28 28 int main() { 29 vector( int , heap_allocator(int)) iv;29 vector( int ) iv; 30 30 31 31 assert( empty( &iv ) ); -
src/tests/math.c
r9c951e3 rb1e63ac5 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 24 13:24:20 201613 // Update Count : 7 012 // Last Modified On : Wed May 24 13:04:33 2017 13 // Update Count : 71 14 14 // 15 15 … … 22 22 long double l; 23 23 24 sout | "fabs:" | fabs( -1.0F ) | fabs( -1.0D ) | fabs( -1.0L ) | cabs( -1.0F+1.0FI ) | cabs( -1.0D+1.0DI ) | cabs( -1.0DL+1.0LI ) | endl;25 24 sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl; 26 25 sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl; -
src/tests/numericConstants.c
r9c951e3 rb1e63ac5 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // numericConstants.c -- 8 // 9 // Author : Peter A. Buhr 10 // Created On : Wed May 24 22:10:36 2017 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:11:36 2017 13 // Update Count : 2 14 // 15 1 16 int main() { 2 17 1; // decimal … … 48 63 0x_ff.ffp0; // hex real 49 64 0x_1.ffff_ffff_p_128_l; 50 } 65 } // main 66 67 // Local Variables: // 68 // tab-width: 4 // 69 // compile-command: "cfa minmax.c" // 70 // End: // -
src/tests/rational.c
r9c951e3 rb1e63ac5 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 15 21:32:22201713 // Update Count : 6 412 // Last Modified On : Wed May 17 15:46:35 2017 13 // Update Count : 65 14 14 // 15 15 -
src/tests/sched-int-disjoint.c
r9c951e3 rb1e63ac5 4 4 #include <thread> 5 5 6 #ifndef N 6 7 #define N 100_000 8 #endif 7 9 8 10 enum state_t { WAIT, SIGNAL, BARGE }; … … 78 80 signal( &cond, a, &data ); 79 81 80 int pauses = (unsigned)rand48() % 10; 81 for(int i = 0; i < pauses; i++) { 82 yield(); 83 } 82 yield( (unsigned)rand48() % 10 ); 84 83 85 84 //This is technically a mutual exclusion violation but the mutex monitor protects us -
src/tests/sched-int-wait.c
r9c951e3 rb1e63ac5 5 5 #include <thread> 6 6 7 static const int N = 10_000; 7 #ifndef N 8 #define N 10_000 9 #endif 8 10 9 11 monitor global_t {}; -
src/tests/test.py
r9c951e3 rb1e63ac5 197 197 # fetch return code and error from the diff command 198 198 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 199 200 else: 201 with open (out_file, "r") as myfile: 202 error = myfile.read() 203 204 199 205 # clean the executable 200 206 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run) … … 253 259 # for each test to run 254 260 try : 255 results = pool.map_async(partial(run_test_worker, generate=generate, dry_run=dry_run, debug=debug), tests ).get(3600)261 results = pool.map_async(partial(run_test_worker, generate=generate, dry_run=dry_run, debug=debug), tests, chunksize = 1 ).get(7200) 256 262 except KeyboardInterrupt: 257 263 pool.terminate() -
src/tests/tuplePolymorphism.c
r9c951e3 rb1e63ac5 9 9 // Author : Rob Schluntz 10 10 // Created On : Tue Nov 16 10:38:00 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : T ue Nov 16 10:39:18 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 18 18:05:12 2017 13 // Update Count : 4 14 14 // 15 15 16 16 // packed is needed so that structs are not passed with the same alignment as function arguments 17 17 __attribute__((packed)) struct A { 18 double x;19 char y;20 double z;18 double x; 19 char y; 20 double z; 21 21 }; 22 22 23 23 __attribute__((packed)) struct B { 24 long long x;25 char y;26 long long z;24 long long x; 25 char y; 26 long long z; 27 27 }; 28 28 … … 39 39 40 40 int main() { 41 int x1 = 123, x3 = 456;42 double x2 = 999.123;41 int x1 = 123, x3 = 456; 42 double x2 = 999.123; 43 43 44 int i1 = 111, i3 = 222;45 double i2 = 333;44 int i1 = 111, i3 = 222; 45 double i2 = 333; 46 46 47 int d1 = 555, d3 = 444;48 double d2 = 666;47 int d1 = 555, d3 = 444; 48 double d2 = 666; 49 49 50 50 51 [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);52 [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);53 printf("%d %g %d\n", i1, i2, i3);54 printf("%d %g %d\n", d1, d2, d3);51 [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]); 52 [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]); 53 printf("%d %g %d\n", i1, i2, i3); 54 printf("%d %g %d\n", d1, d2, d3); 55 55 56 [double, double, double] zzz;57 zzz = [x1, x2, x3];58 printf("%g %g %g\n", zzz);59 [x1, x2, x3] = zzz+zzz;60 printf("%d %g %d\n", x1, x2, x3);56 [double, double, double] zzz; 57 zzz = [x1, x2, x3]; 58 printf("%g %g %g\n", zzz); 59 [x1, x2, x3] = zzz+zzz; 60 printf("%d %g %d\n", x1, x2, x3); 61 61 62 // ensure non-matching assertions are specialized correctly63 g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });62 // ensure non-matching assertions are specialized correctly 63 g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL }); 64 64 } 65 65 … … 73 73 // tab-width: 4 // 74 74 // End: // 75
Note:
See TracChangeset
for help on using the changeset viewer.