Changeset b1e63ac5 for src


Ignore:
Timestamp:
Jul 4, 2017, 9:40:16 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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.
Message:

Merge branch 'master' into references

Location:
src
Files:
47 added
6 deleted
139 edited
7 moved

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May 10 14:45:00 2017
    13 // Update Count     : 484
     12// Last Modified On : Thu Jun  8 16:00:00 2017
     13// Update Count     : 485
    1414//
    1515
     
    6565                } // if
    6666        } // 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         }
    7567
    7668        CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std::list< Label > & l ) {
     
    111103        }
    112104
    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 ) {}
    124106
    125107        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
     
    212194                        output << " {" << endl;
    213195
    214                         cur_indent += CodeGenerator::tabsize;
     196                        ++indent;
    215197                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) {
    216198                                output << lineDirective( *i ) << indent;
     
    219201                        } // for
    220202
    221                         cur_indent -= CodeGenerator::tabsize;
     203                        --indent;
    222204
    223205                        output << indent << "}";
     
    249231                        output << " {" << endl;
    250232
    251                         cur_indent += CodeGenerator::tabsize;
     233                        ++indent;
    252234                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
    253235                                ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
     
    261243                        } // for
    262244
    263                         cur_indent -= CodeGenerator::tabsize;
     245                        --indent;
    264246
    265247                        output << indent << "}";
     
    267249        }
    268250
    269         void CodeGenerator::visit( TraitDecl * traitDecl ) {}
     251        void CodeGenerator::visit( __attribute__((unused)) TraitDecl * traitDecl ) {}
    270252
    271253        void CodeGenerator::visit( TypedefDecl * typeDecl ) {
     
    298280        }
    299281
    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();
    302284                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 member
     285                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
    306288                                output << ".";
    307                                 (*iter)->accept( *this );
     289                                des->accept( *this );
    308290                        } else {
    309                                 // if not a simple name, it has to be a constant expression, i.e. an array designator
     291                                // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt
    310292                                output << "[";
    311                                 (*iter)->accept( *this );
     293                                des->accept( *this );
    312294                                output << "]";
    313295                        } // if
     
    317299
    318300        void CodeGenerator::visit( SingleInit * init ) {
    319                 printDesignators( init->get_designators() );
    320301                init->get_value()->accept( *this );
    321302        }
    322303
    323304        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
    325310                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                }
    332319                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 ){
    336324                assertf( ! genC, "ConstructorInit nodes should not reach code generation." );
    337325                // xxx - generate something reasonable for constructor/destructor pairs
     
    731719
    732720        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                }
    735726        }
    736727
     
    756747                std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
    757748                output << lineDirective( stmtExpr) << "({" << std::endl;
    758                 cur_indent += CodeGenerator::tabsize;
     749                ++indent;
    759750                unsigned int numStmts = stmts.size();
    760751                unsigned int i = 0;
     
    779770                        ++i;
    780771                }
    781                 cur_indent -= CodeGenerator::tabsize;
     772                --indent;
    782773                output << indent << "})";
    783774        }
     
    788779                output << "{" << endl;
    789780
    790                 cur_indent += CodeGenerator::tabsize;
     781                ++indent;
    791782
    792783                for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++ ) {
     
    799790                        } // if
    800791                } // for
    801                 cur_indent -= CodeGenerator::tabsize;
     792                --indent;
    802793
    803794                output << indent << "}";
     
    867858
    868859                output << "{" << std::endl;
    869                 cur_indent += CodeGenerator::tabsize;
     860                ++indent;
    870861                acceptAll( switchStmt->get_statements(), *this );
    871                 cur_indent -= CodeGenerator::tabsize;
     862                --indent;
    872863                output << indent << "}";
    873864        }
     
    886877                std::list<Statement *> sts = caseStmt->get_statements();
    887878
    888                 cur_indent += CodeGenerator::tabsize;
     879                ++indent;
    889880                for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
    890881                        output << indent << printLabels( (*i)->get_labels() )  ;
     
    892883                        output << endl;
    893884                } // for
    894                 cur_indent -= CodeGenerator::tabsize;
     885                --indent;
    895886        }
    896887
     
    923914        }
    924915
     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
    925932        void CodeGenerator::visit( WhileStmt * whileStmt ) {
    926933                if ( whileStmt->get_isDoWhile() ) {
     
    967974        }
    968975
    969         void CodeGenerator::visit( NullStmt * nullStmt ) {
     976        void CodeGenerator::visit( __attribute__((unused)) NullStmt * nullStmt ) {
    970977                //output << indent << CodeGenerator::printLabels( nullStmt->get_labels() );
    971978                output << "/* null statement */ ;";
  • src/CodeGen/CodeGenerator.h

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May 10 10:57:00 2017
    13 // Update Count     : 51
     12// Last Modified On : Thu Jun  8 15:48:00 2017
     13// Update Count     : 52
    1414//
    1515
     
    2525#include "SymTab/Indexer.h"
    2626
     27#include "Common/Indenter.h"
    2728#include "Common/utility.h"
    2829
     
    4748
    4849                //*** Initializer
     50                virtual void visit( Designation * );
    4951                virtual void visit( SingleInit * );
    5052                virtual void visit( ListInit * );
     
    9193                virtual void visit( BranchStmt * );
    9294                virtual void visit( ReturnStmt * );
     95                virtual void visit( ThrowStmt * );
    9396                virtual void visit( WhileStmt * );
    9497                virtual void visit( ForStmt * );
     
    99102
    100103                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                 };
    107104
    108105                struct LabelPrinter {
     
    128125          private:
    129126                Indenter indent;
    130                 int cur_indent;
    131127                bool insideFunction;
    132128                std::ostream &output;
     
    136132                bool lineMarks = false;
    137133
    138                 void printDesignators( std::list< Expression * > & );
    139134                void handleStorageClass( DeclarationWithType *decl );
    140135                void handleAggregate( AggregateDecl *aggDecl, const std::string & kind );
  • src/CodeGen/FixNames.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:50:30 2017
    13 // Update Count     : 16
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:26:00 2017
     13// Update Count     : 20
    1414//
    1515
     
    9393        void FixNames::fixDWT( DeclarationWithType *dwt ) {
    9494                if ( dwt->get_name() != "" ) {
    95                         if ( LinkageSpec::isDecoratable( dwt->get_linkage() ) ) {
     95                        if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
    9696                                dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) );
    9797                                dwt->set_scopeLevel( scopeLevel );
     
    114114                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    115115                        }
    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 ) ) ) );
    117117                        CodeGen::FixMain::registerMain( functionDecl );
    118118                }
  • src/CodeTools/TrackLoc.cc

    r9c951e3 rb1e63ac5  
    1616#include "TrackLoc.h"
    1717
     18#include <cstdlib>
     19
    1820#include <iostream>
    1921#include <sstream>
     22#include <stack>
    2023#include <string>
    21 #include <cstdlib>
     24#include <typeindex>
    2225
    2326#include "Common/utility.h"
     27#include "Common/PassVisitor.h"
    2428#include "Common/VectorMap.h"
    2529#include "GenPoly/GenPoly.h"
     
    2731#include "SynTree/Declaration.h"
    2832#include "SynTree/Initializer.h"
    29 #include "SynTree/Visitor.h"
    3033
    3134namespace CodeTools {
    3235
    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        }
    3639
    37         class LocationPrinter : public Visitor {
    38                 unsigned int printLevel;
    39                 unsigned int currentLevel;
     40        class LocationPrinter {
     41                size_t printLevel;
    4042
    41                 CodeLocation *parent;
    4243                CodeLocation *lastNode;
    4344
    44     public:
    45         LocationPrinter(unsigned int printLevel) :
    46             Visitor(), printLevel(printLevel), currentLevel(0),
    47                         parent(nullptr), lastNode(nullptr)
    48         {}
     45                std::stack< CodeLocation * > parents;
     46        public:
     47                LocationPrinter(size_t printLevel) :
     48                        printLevel(printLevel), lastNode(nullptr)
     49                {}
    4950
    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) {
    5253                                std::cout << "    ";
    5354                        }
    54             if (2 <= printLevel) {
     55                        if (2 <= printLevel) {
    5556                                std::cout << name << '@';
    5657                        }
    5758                        std::cout << node->location << std::endl;
    58         }
     59                }
    5960
    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;
    7172                                        exit(EXIT_FAILURE);
    7273                                }
    7374                        }
     75
    7476                        if (0 < printLevel) {
    75                                 print(name, node);
     77                                print( name, node );
    7678                        }
    7779                        lastNode = &node->location;
    7880                }
    7981
    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 );
    8985                }
    9086
    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                }
    17690
    17791        }; // LocationPrinter
    17892
    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);
    18295                acceptAll( translationUnit, printer );
    18396        }
  • src/CodeTools/TrackLoc.h

    r9c951e3 rb1e63ac5  
    2424        // printLevel: how much printing while filling in the node locations.
    2525        // 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 );
    2827
    2928}  // namespace CodeTools
  • src/Common/Assert.cc

    r9c951e3 rb1e63ac5  
    2121extern const char * __progname;                                                 // global name of running executable (argv[0])
    2222
    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\""
    2424
    2525// called by macro assert in assert.h
    2626void __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 );
    2828        abort();
    2929}
     
    3131// called by macro assertf
    3232void __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 );
    3434        va_list args;
    3535        va_start( args, fmt );
  • src/Common/utility.h

    r9c951e3 rb1e63ac5  
    246246};
    247247
     248template< typename T >
     249struct 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
     257template< typename T >
     258struct 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
    248268// -----------------------------------------------------------------------------
    249269// Helper struct and function to support
     
    285305// for ( val : group_iterate( container1, container2, ... ) ) {}
    286306// 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
    288308
    289309template< typename T1, typename T2 >
     
    334354        {}
    335355
     356        CodeLocation( const CodeLocation& rhs ) = default;
     357
    336358        bool isSet () const {
    337359                return -1 != linenumber;
  • src/Concurrency/Keywords.cc

    r9c951e3 rb1e63ac5  
    6565                FunctionDecl * forwardDeclare( StructDecl * );
    6666                ObjectDecl * addField( StructDecl * );
    67                 void addRoutines( StructDecl *, ObjectDecl *, FunctionDecl * );
     67                void addRoutines( ObjectDecl *, FunctionDecl * );
    6868
    6969                virtual bool is_target( StructDecl * decl ) = 0;
     
    247247        void ConcurrentSueKeyword::visit(StructDecl * decl) {
    248248                Visitor::visit(decl);
    249                 if( decl->get_name() == type_name ) {
     249                if( decl->get_name() == type_name && decl->has_body() ) {
    250250                        assert( !type_decl );
    251251                        type_decl = decl;
     
    264264                FunctionDecl * func = forwardDeclare( decl );
    265265                ObjectDecl * field = addField( decl );
    266                 addRoutines( decl, field, func );
     266                addRoutines( field, func );
    267267        }
    268268
     
    359359        }
    360360
    361         void ConcurrentSueKeyword::addRoutines( StructDecl * decl, ObjectDecl * field, FunctionDecl * func ) {
     361        void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
    362362                CompoundStmt * statement = new CompoundStmt( noLabels );
    363363                statement->push_back(
  • src/ControlStruct/ForExprMutator.cc

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ForExprMutator.cc -- 
     7// ForExprMutator.cc --
    88//
    99// Author           : Rodolfo G. Esteves
     
    1919
    2020namespace 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();
    2624                if ( init.size() == 0 ) {
    2725                        return forStmt;
     
    3937                forStmt->set_initialization( std::list<Statement *>() );
    4038                return block;
    41 
    42                 return forStmt;
    4339        }
    4440} // namespace ControlStruct
  • src/ControlStruct/ForExprMutator.h

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ForExprMutator.h -- 
     7// ForExprMutator.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2121
    2222namespace ControlStruct {
    23         class ForExprMutator : public Mutator {
     23        class ForExprMutator {
    2424          public:
    25                 virtual Statement *mutate( ForStmt * );
     25                Statement *postmutate( ForStmt * );
    2626        };
    2727} // namespace ControlStruct
  • src/ControlStruct/Mutate.cc

    r9c951e3 rb1e63ac5  
    2626
    2727#include "Common/utility.h"
     28#include "Common/PassVisitor.h"
    2829
    2930#include "SynTree/Visitor.h"
     
    3435        void mutate( std::list< Declaration * > translationUnit ) {
    3536                // hoist initialization out of for statements
    36                 ForExprMutator formut;
     37                PassVisitor<ForExprMutator> formut;
    3738
    3839                // normalizes label definitions and generates multi-level exit labels
  • src/ControlStruct/module.mk

    r9c951e3 rb1e63ac5  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Aug  4 11:38:06 2016
    14 ## Update Count     : 3
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jun 28 16:15:00 2017
     14## Update Count     : 4
    1515###############################################################################
    1616
    1717SRC +=  ControlStruct/LabelGenerator.cc \
    1818        ControlStruct/LabelFixer.cc \
    19         ControlStruct/MLEMutator.cc \
     19        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc
    22 
     21        ControlStruct/ForExprMutator.cc \
     22        ControlStruct/ExceptTranslate.cc
  • src/GenPoly/Box.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 13 09:26:38 2017
    13 // Update Count     : 341
     12// Last Modified On : Wed Jun 21 15:49:59 2017
     13// Update Count     : 346
    1414//
    1515
     
    6262namespace GenPoly {
    6363        namespace {
    64                 const std::list<Label> noLabels;
    65 
    6664                FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars );
    6765
     
    103101                        void passTypeVars( ApplicationExpr *appExpr, Type *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
    104102                        /// 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 );
    106104                        /// Replaces all the type parameters of a generic type with their concrete equivalents under the current environment
    107105                        void replaceParametersWithConcrete( ApplicationExpr *appExpr, std::list< Expression* >& params );
     
    110108                        Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true );
    111109                        /// 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 );
    113111                        Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
    114112                        void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars );
     
    136134                  public:
    137135                        template< typename DeclClass >
    138                         DeclClass *handleDecl( DeclClass *decl, Type *type );
     136                        DeclClass *handleDecl( DeclClass *decl );
    139137                        template< typename AggDecl >
    140138                        AggDecl * handleAggDecl( AggDecl * aggDecl );
     
    343341        Statement *makeAlignTo( Expression *lhs, Expression *rhs ) {
    344342                // 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 ) ) ) );
    346344                // if not aligned, increment to alignment
    347345                Expression *ifExpr = makeOp( "?+=?", lhs->clone(), makeOp( "?-?", rhs->clone(), ifCond->clone() ) );
     
    386384
    387385                // 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 ) ) ) );
    390388                unsigned long n_members = 0;
    391389                bool firstMember = true;
     
    443441
    444442                // 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 ) ) ) );
    447445                for ( std::list< Declaration* >::const_iterator member = unionDecl->get_members().begin(); member != unionDecl->get_members().end(); ++member ) {
    448446                        DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member );
     
    506504                DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) {
    507505                        if ( functionDecl->get_statements() ) {         // empty routine body ?
     506                                // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;
    508507                                doBeginScope();
    509508                                scopeTyVars.beginScope();
     
    550549                                retval = oldRetval;
    551550                                doEndScope();
     551                                // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;
    552552                        } // if
    553553                        return functionDecl;
     
    665665                }
    666666
    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 ) {
    668668                        // Create temporary to hold return value of polymorphic function and produce that temporary as a result
    669669                        // using a comma expression.
     
    728728                }
    729729
    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 ) {
    731731                        assert( env );
    732732                        Type *concrete = replaceWithConcrete( appExpr, dynType );
    733733                        // add out-parameter for return value
    734                         return addRetParam( appExpr, function, concrete, arg );
     734                        return addRetParam( appExpr, concrete, arg );
    735735                }
    736736
     
    739739//                      if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
    740740                        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 );
    742742                        } // if
    743743                        std::string mangleName = mangleAdapterName( function, tyVars );
     
    11181118
    11191119                Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
    1120                         // std::cerr << "mutate appExpr: ";
     1120                        // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
    11211121                        // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
    11221122                        //      std::cerr << i->first << " ";
     
    11431143                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
    11441144
     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
    11451153                        // 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
    11461154                        // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int))
    11471155                        // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome.
    11481156                        if ( dynRetType ) {
     1157                                // std::cerr << "dynRetType: " << dynRetType << std::endl;
    11491158                                Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result();
    1150                                 ret = addDynRetParam( appExpr, function, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType
     1159                                ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType
    11511160                        } else if ( needsAdapter( function, scopeTyVars ) && ! needsAdapter( function, exprTyVars) ) { // xxx - exprTyVars is used above...?
    11521161                                // 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.
     
    12821291
    12831292                template< typename DeclClass >
    1284                 DeclClass * Pass2::handleDecl( DeclClass *decl, Type *type ) {
     1293                DeclClass * Pass2::handleDecl( DeclClass *decl ) {
    12851294                        DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) );
    12861295
     
    12961305
    12971306                DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) {
    1298                         functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl, functionDecl->get_functionType() ) );
     1307                        functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
    12991308                        FunctionType * ftype = functionDecl->get_functionType();
    13001309                        if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
     
    13211330
    13221331                ObjectDecl * Pass2::mutate( ObjectDecl *objectDecl ) {
    1323                         return handleDecl( objectDecl, objectDecl->get_type() );
     1332                        return handleDecl( objectDecl );
    13241333                }
    13251334
     
    13441353                        addToTyVarMap( typeDecl, scopeTyVars );
    13451354                        if ( typeDecl->get_base() ) {
    1346                                 return handleDecl( typeDecl, typeDecl->get_base() );
     1355                                return handleDecl( typeDecl );
    13471356                        } else {
    13481357                                return Parent::mutate( typeDecl );
     
    13511360
    13521361                TypedefDecl * Pass2::mutate( TypedefDecl *typedefDecl ) {
    1353                         return handleDecl( typedefDecl, typedefDecl->get_base() );
     1362                        return handleDecl( typedefDecl );
    13541363                }
    13551364
     
    15661575                /// Returns an index expression into the offset array for a type
    15671576                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 ) );
    15711578                        UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) );
    15721579                        fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) );
     
    17811788                                // all union members are at offset zero
    17821789                                delete offsetofExpr;
    1783                                 return new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0" ) );
     1790                                return new ConstantExpr( Constant::from_ulong( 0 ) );
    17841791                        } else return offsetofExpr;
    17851792                }
     
    18061813                                        std::list< Initializer* > inits;
    18071814                                        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 ) ) );
    18111817                                                } 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() );
    18131819                                                }
    1814                                                 inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );
    18151820                                        }
    18161821
  • src/GenPoly/CopyParams.cc

    r9c951e3 rb1e63ac5  
    4545
    4646        CopyParams::CopyParams() : namer( "_cp" ) {}
    47 
    48         static const std::list< Label > noLabels;
    4947
    5048        void CopyParams::visit( FunctionDecl *funcDecl ) {
  • src/GenPoly/DeclMutator.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Aaron B. Moss
    1010// Created On       : Fri Nov 27 14:44:00 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:16:43 2016
    13 // Update Count     : 3
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun 22 13:49:00 2017
     13// Update Count     : 4
    1414//
    1515
     
    2020
    2121namespace GenPoly {
    22         namespace {
    23                 const std::list<Label> noLabels;
    24         }
    25 
    2622        DeclMutator::DeclMutator() : Mutator(), declsToAdd(1), declsToAddAfter(1) {}
    2723
    2824        DeclMutator::~DeclMutator() {}
    29        
     25
    3026        void DeclMutator::mutateDeclarationList( std::list< Declaration* > &decls ) {
    3127                for ( std::list< Declaration* >::iterator decl = decls.begin(); ; ++decl ) {
     
    3430
    3531                        if ( decl == decls.end() ) break;
    36                        
     32
    3733                        // run mutator on declaration
    3834                        *decl = maybeMutate( *decl, *this );
     
    5551                newBack->splice( newBack->end(), *back );
    5652                declsToAdd.pop_back();
    57                
     53
    5854                back = declsToAddAfter.rbegin();
    5955                newBack = back + 1;
     
    6662                CompoundStmt *compoundStmt = dynamic_cast< CompoundStmt* >(stmt);
    6763                if ( compoundStmt ) return mutate( compoundStmt );
    68                
     64
    6965                doBeginScope();
    70                
     66
    7167                // run mutator on statement
    7268                stmt = maybeMutate( stmt, *this );
     
    10298                doBeginScope();
    10399
    104                
     100
    105101                for ( std::list< Statement* >::iterator stmt = stmts.begin(); ; ++stmt ) {
    106102                        // add any new declarations after the previous statement
     
    112108
    113109                        if ( stmt == stmts.end() ) break;
    114                        
     110
    115111                        // run mutator on statement
    116112                        *stmt = maybeMutate( *stmt, *this );
     
    123119                        declsToAdd.back().clear();
    124120                }
    125                
     121
    126122                doEndScope();
    127123        }
     
    139135                return compoundStmt;
    140136        }
    141        
     137
    142138        Statement* DeclMutator::mutate(IfStmt *ifStmt) {
    143139                ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) );
     
    146142                return ifStmt;
    147143        }
    148        
     144
    149145        Statement* DeclMutator::mutate(WhileStmt *whileStmt) {
    150146                whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) );
     
    152148                return whileStmt;
    153149        }
    154        
     150
    155151        Statement* DeclMutator::mutate(ForStmt *forStmt) {
    156152                mutateAll( forStmt->get_initialization(), *this );
     
    160156                return forStmt;
    161157        }
    162        
     158
    163159        Statement* DeclMutator::mutate(SwitchStmt *switchStmt) {
    164160                switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
     
    166162                return switchStmt;
    167163        }
    168        
     164
    169165        Statement* DeclMutator::mutate(CaseStmt *caseStmt) {
    170166                caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) );
     
    172168                return caseStmt;
    173169        }
    174        
     170
    175171        Statement* DeclMutator::mutate(TryStmt *tryStmt) {
    176172                tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
     
    179175                return tryStmt;
    180176        }
    181        
     177
    182178        Statement* DeclMutator::mutate(CatchStmt *catchStmt) {
    183179                catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
     180                catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) );
    184181                catchStmt->set_body( mutateStatement( catchStmt->get_body() ) );
    185182                return catchStmt;
  • src/GenPoly/InstantiateGeneric.cc

    r9c951e3 rb1e63ac5  
    2222#include "InstantiateGeneric.h"
    2323
    24 #include "DeclMutator.h"
    2524#include "GenPoly.h"
    2625#include "ScopedSet.h"
    2726#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"
    2932
    3033#include "ResolvExpr/typeops.h"
     
    3437#include "SynTree/Type.h"
    3538
    36 #include "Common/ScopedMap.h"
    37 #include "Common/UniqueName.h"
    38 #include "Common/utility.h"
     39
     40#include "InitTweak/InitTweak.h"
     41
    3942
    4043namespace GenPoly {
     
    153156        }
    154157
    155         // collect the environments of each TypeInstType so that type variables can be replaced
    156         // 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 
    172158        /// 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 {
    174160                /// Map of (generic type, parameter list) pairs to concrete type instantiations
    175161                InstantiationMap< AggregateDecl, AggregateDecl > instantiations;
     
    178164                /// Namer for concrete types
    179165                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();
    191180        private:
    192181                /// Wrap instantiation lookup for structs
     
    207196
    208197        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 );
    213200        }
    214201
     
    306293        Type *GenericInstantiator::replaceWithConcrete( Type *type, bool doClone ) {
    307294                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
    308                         if ( envMap.count( typeInst ) ) {
    309                                 TypeSubstitution * env = envMap.at( typeInst );
     295                        if ( env && ! inFunctionType ) {
    310296                                Type *concrete = env->lookup( typeInst->get_name() );
    311297                                if ( concrete ) {
     
    331317
    332318
    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 ) {
    339320                // exit early if no need for further mutation
    340321                if ( inst->get_parameters().empty() ) return inst;
     
    367348                                concDecl->set_body( inst->get_baseStruct()->has_body() );
    368349                                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 members
     350                                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
    372353                        }
    373354                        StructInstType *newInst = new StructInstType( inst->get_qualifiers(), concDecl->get_name() );
     
    388369        }
    389370
    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 ) {
    396372                // exit early if no need for further mutation
    397373                if ( inst->get_parameters().empty() ) return inst;
     
    422398                                concDecl->set_body( inst->get_baseUnion()->has_body() );
    423399                                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 members
     400                                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
    427403                        }
    428404                        UnionInstType *newInst = new UnionInstType( inst->get_qualifiers(), concDecl->get_name() );
     
    442418        }
    443419
    444         void GenericInstantiator::doBeginScope() {
    445                 DeclMutator::doBeginScope();
     420        void GenericInstantiator::beginScope() {
    446421                instantiations.beginScope();
    447422                dtypeStatics.beginScope();
    448423        }
    449424
    450         void GenericInstantiator::doEndScope() {
    451                 DeclMutator::doEndScope();
     425        void GenericInstantiator::endScope() {
    452426                instantiations.endScope();
    453427                dtypeStatics.endScope();
  • src/GenPoly/Lvalue.cc

    r9c951e3 rb1e63ac5  
    3636namespace GenPoly {
    3737        namespace {
    38                 const std::list<Label> noLabels;
    39 
    4038                /// Replace uses of lvalue returns with appropriate pointers
    4139                class Pass1 : public Mutator {
  • src/GenPoly/PolyMutator.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:26:22 2016
    13 // Update Count     : 16
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun 22 13:47:00 2017
     13// Update Count     : 17
    1414//
    1515
     
    123123
    124124        Statement * PolyMutator::mutate(TryStmt *tryStmt) {
    125                 tryStmt->set_block(  maybeMutate( tryStmt->get_block(), *this ) );
     125                tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
    126126                mutateAll( tryStmt->get_catchers(), *this );
     127                tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) );
    127128                return tryStmt;
    128129        }
    129130
    130131        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 ) );
    133135                return cathStmt;
    134136        }
  • src/GenPoly/Specialize.cc

    r9c951e3 rb1e63ac5  
    9393        }
    9494
    95         bool needsTupleSpecialization( Type *formalType, Type *actualType, TypeSubstitution *env ) {
     95        bool needsTupleSpecialization( Type *formalType, Type *actualType ) {
    9696                // Needs tuple specialization if the structure of the formal type and actual type do not match.
    9797                // This is the case if the formal type has ttype polymorphism, or if the structure  of tuple types
     
    9999                if ( FunctionType * fftype = getFunctionType( formalType ) ) {
    100100                        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;
    101103                        FunctionType * aftype = getFunctionType( actualType );
    102104                        assertf( aftype, "formal type is a function type, but actual type is not." );
     
    112114
    113115        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 );
    115117        }
    116118
  • src/InitTweak/FixGlobalInit.cc

    r9c951e3 rb1e63ac5  
    2626
    2727namespace InitTweak {
    28         namespace {
    29                 const std::list<Label> noLabels;
    30         }
    31 
    3228        class GlobalFixer : public Visitor {
    3329          public:
     
    129125
    130126        // 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 ) {}
    137133
    138134} // namespace InitTweak
  • src/InitTweak/FixInit.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:13:47 2017
    13 // Update Count     : 71
     12// Last Modified On : Wed Jun 21 17:35:05 2017
     13// Update Count     : 74
    1414//
    1515
     
    2020#include <unordered_map>
    2121#include <unordered_set>
     22
    2223#include "InitTweak.h"
    2324#include "GenInit.h"
    2425#include "FixInit.h"
    2526#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"
    2631#include "ResolvExpr/Resolver.h"
    2732#include "ResolvExpr/typeops.h"
     33#include "SymTab/Autogen.h"
     34#include "SymTab/Indexer.h"
     35#include "SynTree/AddStmtVisitor.h"
     36#include "SynTree/Attribute.h"
    2837#include "SynTree/Declaration.h"
    29 #include "SynTree/Type.h"
    3038#include "SynTree/Expression.h"
    31 #include "SynTree/Attribute.h"
    32 #include "SynTree/Statement.h"
    3339#include "SynTree/Initializer.h"
    3440#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"
    4143#include "Tuples/Tuples.h"
    4244
     
    5456                typedef std::unordered_map< int, int > UnqCount;
    5557
    56                 class InsertImplicitCalls final : public GenPoly::PolyMutator {
     58                class InsertImplicitCalls : public WithTypeSubstitution {
    5759                public:
    5860                        /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which
     
    6163
    6264                        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 );
    6768
    6869                        // collects environments for relevant nodes
     
    103104                        typedef AddStmtVisitor Parent;
    104105                        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;
    106108                        virtual void visit( CompoundStmt *compoundStmt ) override;
    107109                        virtual void visit( DeclStmt *stmt ) override;
    108110
    109111                        // don't go into other functions
    110                         virtual void visit( FunctionDecl *decl ) override {}
     112                        virtual void visit( __attribute__((unused)) FunctionDecl *decl ) override {}
    111113
    112114                  protected:
     
    115117
    116118                // 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 ) {}
    120122                        const ObjectSet & objs;
    121123                };
    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) {
    123128                        out << "{ ";
    124129                        for ( ObjectDecl * obj : set.objs ) {
     
    190195                };
    191196
    192                 class FixInit final : public GenPoly::PolyMutator {
     197                class FixInit : public WithStmtsToAdd {
    193198                  public:
    194199                        /// expand each object declaration to use its constructor after it is declared.
    195200                        static void fixInitializers( std::list< Declaration * > &translationUnit );
    196201
    197                         typedef GenPoly::PolyMutator Parent;
    198                         using Parent::mutate;
    199                         virtual DeclarationWithType * mutate( ObjectDecl *objDecl ) override;
     202                        DeclarationWithType * postmutate( ObjectDecl *objDecl );
    200203
    201204                        std::list< Declaration * > staticDtorDecls;
     
    300303        namespace {
    301304                void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ) {
    302                         InsertImplicitCalls inserter( envMap );
     305                        PassVisitor<InsertImplicitCalls> inserter( envMap );
    303306                        mutateAll( translationUnit, inserter );
    304307                }
     
    310313
    311314                void FixInit::fixInitializers( std::list< Declaration * > & translationUnit ) {
    312                         FixInit fixer;
     315                        PassVisitor<FixInit> fixer;
    313316
    314317                        // can't use mutateAll, because need to insert declarations at top-level
     
    318321                                try {
    319322                                        *i = maybeMutate( *i, fixer );
    320                                         translationUnit.splice( i, fixer.staticDtorDecls );
     323                                        translationUnit.splice( i, fixer.pass.staticDtorDecls );
    321324                                } catch( SemanticError &e ) {
    322325                                        e.set_location( (*i)->location );
     
    350353                }
    351354
    352                 Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) {
    353                         appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) );
     355                Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) {
    354356                        assert( appExpr );
    355357
     
    393395                }
    394396
    395                 Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) {
     397                void InsertImplicitCalls::premutate( StmtExpr * stmtExpr ) {
    396398                        assert( env );
    397399                        envMap[stmtExpr] = env;
    398                         return Parent::mutate( stmtExpr );
    399400                }
    400401
     
    696697                }
    697698
    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)
    702701                        if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) {
    703702                                // a decision should have been made by the resolver, so ctor and init are not both non-NULL
     
    729728                                                // static bool __objName_uninitialized = true
    730729                                                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 ) ) );
    732731                                                ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
    733732                                                isUninitializedVar->fixUniqueId();
     
    736735                                                UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) );
    737736                                                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 ) ) );
    739738
    740739                                                // generate body of if
     
    750749
    751750                                                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 );
    754753                                                ctorInit->set_dtor( nullptr );
    755754                                                if ( dtor ) {
     
    804803                                                } else {
    805804                                                        stmtsToAddAfter.push_back( ctor );
    806                                                         objDecl->set_init( NULL );
    807                                                         ctorInit->set_ctor( NULL );
     805                                                        objDecl->set_init( nullptr );
     806                                                        ctorInit->set_ctor( nullptr );
    808807                                                }
    809808                                        } // if
    810809                                } else if ( Initializer * init = ctorInit->get_init() ) {
    811810                                        objDecl->set_init( init );
    812                                         ctorInit->set_init( NULL );
     811                                        ctorInit->set_init( nullptr );
    813812                                } else {
    814813                                        // no constructor and no initializer, which is okay
    815                                         objDecl->set_init( NULL );
     814                                        objDecl->set_init( nullptr );
    816815                                } // if
    817816                                delete ctorInit;
     
    821820
    822821                void ObjDeclCollector::visit( CompoundStmt * compoundStmt ) {
    823                         std::set< ObjectDecl * > prevVars = curVars;
     822                        ObjectSet prevVars = curVars;
    824823                        Parent::visit( compoundStmt );
    825824                        curVars = prevVars;
     
    829828                        // keep track of all variables currently in scope
    830829                        if ( ObjectDecl * objDecl = dynamic_cast< ObjectDecl * > ( stmt->get_decl() ) ) {
    831                                 curVars.insert( objDecl );
     830                                curVars.push_back( objDecl );
    832831                        } // if
    833832                        Parent::visit( stmt );
     
    896895                        Parent::visit( compoundStmt );
    897896
    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
    899899                        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                        }
    901903                        reverseDeclOrder.pop_front();
    902904                }
    903905
    904                 void InsertDtors::visit( ReturnStmt * returnStmt ) {
     906                void InsertDtors::visit( __attribute((unused)) ReturnStmt * returnStmt ) {
    905907                        // return exits all scopes, so dump destructors for all scopes
    906908                        for ( OrderedDecls & od : reverseDeclOrder ) {
     
    941943                        )
    942944                        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
    943948                                // go through decl ordered list of objectdecl. for each element that occurs in diff, output destructor
    944949                                OrderedDecls ordered;
    945950                                for ( OrderedDecls & rdo : reverseDeclOrder ) {
    946951                                        // 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 ); } );
    948953                                } // for
    949954                                insertDtors( ordered.begin(), ordered.end(), back_inserter( stmtsToAdd ) );
  • src/InitTweak/GenInit.cc

    r9c951e3 rb1e63ac5  
    1616#include <stack>
    1717#include <list>
     18
     19#include "InitTweak.h"
    1820#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
    2030#include "SynTree/Declaration.h"
    21 #include "SynTree/Type.h"
    2231#include "SynTree/Expression.h"
    23 #include "SynTree/Statement.h"
    2432#include "SynTree/Initializer.h"
    2533#include "SynTree/Mutator.h"
     34#include "SynTree/Statement.h"
     35#include "SynTree/Type.h"
     36
    2637#include "SymTab/Autogen.h"
    2738#include "SymTab/Mangler.h"
    28 #include "GenPoly/PolyMutator.h"
    29 #include "GenPoly/DeclMutator.h"
    30 #include "GenPoly/ScopedSet.h"
    31 #include "ResolvExpr/typeops.h"
    3239
    3340namespace InitTweak {
     
    3744        }
    3845
    39         class ReturnFixer final : public GenPoly::PolyMutator {
    40           public:
     46        struct ReturnFixer : public WithStmtsToAdd, public WithGuards {
    4147                /// consistently allocates a temporary variable for the return value
    4248                /// of a function so that anything which the resolver decides can be constructed
     
    4450                static void makeReturnTemp( std::list< Declaration * > &translationUnit );
    4551
    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 );
    5254
    5355          protected:
     
    5658        };
    5759
    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  {
    6261                /// create constructor and destructor statements for object declarations.
    6362                /// the actual call statements will be added in after the resolver has run
     
    6665                static void generateCtorDtor( std::list< Declaration * > &translationUnit );
    6766
    68                 virtual DeclarationWithType * mutate( ObjectDecl * ) override;
    69                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
     67                void previsit( ObjectDecl * );
     68                void previsit( FunctionDecl *functionDecl );
     69
    7070                // should not traverse into any of these declarations to find objects
    7171                // that need to be constructed or destructed
    72                 virtual Declaration* mutate( StructDecl *aggregateDecl ) override;
    73                 virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
    74                 virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
    75                 virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
    76                 virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
    77                 virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
    78 
    79                 virtual Type * mutate( FunctionType *funcType ) override { return funcType; }
    80 
    81                 virtual 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 );
    8282
    8383          private:
     
    131131
    132132        void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) {
    133                 ReturnFixer fixer;
     133                PassVisitor<ReturnFixer> fixer;
    134134                mutateAll( translationUnit, fixer );
    135135        }
    136136
    137         ReturnFixer::ReturnFixer() {}
    138 
    139         Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) {
     137        void ReturnFixer::premutate( ReturnStmt *returnStmt ) {
    140138                std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
    141139                assert( returnVals.size() == 0 || returnVals.size() == 1 );
     
    148146                        construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front() ) ) );
    149147                        construct->get_args().push_back( returnStmt->get_expr() );
    150                         stmtsToAdd.push_back(new ExprStmt(noLabels, construct));
     148                        stmtsToAddBefore.push_back(new ExprStmt(noLabels, construct));
    151149
    152150                        // return the retVal object
    153151                        returnStmt->set_expr( new VariableExpr( returnVals.front() ) );
    154152                } // 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 );
    161158
    162159                ftype = functionDecl->get_functionType();
    163160                funcName = functionDecl->get_name();
    164                 return Parent::mutate( functionDecl );
    165161        }
    166162
     
    212208
    213209        void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) {
    214                 CtorDtor ctordtor;
    215                 mutateAll( translationUnit, ctordtor );
     210                PassVisitor<CtorDtor> ctordtor;
     211                acceptAll( translationUnit, ctordtor );
    216212        }
    217213
     
    291287        }
    292288
    293         DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {
     289        void CtorDtor::previsit( ObjectDecl * objDecl ) {
    294290                handleDWT( objDecl );
    295291                // hands off if @=, extern, builtin, etc.
     
    303299                        objDecl->set_init( genCtorInit( objDecl ) );
    304300                }
    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 );
    310305                inFunction = true;
    311306
    312307                handleDWT( functionDecl );
    313308
    314                 managedTypes.beginScope();
     309                GuardScope( managedTypes );
    315310                // go through assertions and recursively add seen ctor/dtors
    316311                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
    317312                        for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
    318                                 assertion = assertion->acceptMutator( *this );
     313                                handleDWT( assertion );
    319314                        }
    320315                }
    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
    329326                // don't construct members, but need to take note if there is a managed member,
    330327                // because that means that this type is also managed
     
    338335                        }
    339336                }
    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        }
    350342} // namespace InitTweak
    351343
  • src/InitTweak/InitTweak.cc

    r9c951e3 rb1e63ac5  
    1414                public:
    1515                        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                        }
    2320                };
    2421
     
    9289                InitImpl( Initializer * init ) : init( init ) {}
    9390
    94                 virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
     91                virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) {
    9592                        // this is wrong, but just a placeholder for now
    9693                        // if ( ! flattened ) flatten( indices );
     
    248245        }
    249246
    250         Statement * ExprImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
     247        Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) {
    251248                return NULL;
    252249        }
     
    477474                ConstExprChecker() : isConstExpr( true ) {}
    478475
    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; }
    481480                virtual void visit( NameExpr *nameExpr ) {
    482481                        // xxx - temporary hack, because 0 and 1 really should be constexprs, even though they technically aren't in Cforall today
     
    489488                        if ( ! dynamic_cast< NameExpr * >( arg) && ! dynamic_cast< VariableExpr * >( arg ) && ! dynamic_cast< MemberExpr * >( arg ) && ! dynamic_cast< UntypedMemberExpr * >( arg ) ) isConstExpr = false;
    490489                }
    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; }
    495494                // these might be okay?
    496495                // virtual void visit( SizeofExpr *sizeofExpr );
     
    503502                // virtual void visit( LogicalExpr *logicalExpr );
    504503                // 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; }
    512511
    513512                bool isConstExpr;
  • src/MakeLibCfa.cc

    r9c951e3 rb1e63ac5  
    7575                  case CodeGen::OT_POSTFIXASSIGN:
    7676                  case CodeGen::OT_INFIXASSIGN:
     77                  case CodeGen::OT_CTOR:
     78                  case CodeGen::OT_DTOR:
    7779                                funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( std::list< Label >(), newExpr ) );
    7880                                break;
    79                   case CodeGen::OT_CTOR:
    80                         // ctors don't return a value
    81                         if ( funcDecl->get_functionType()->get_parameters().size() == 1 ) {
    82                                 // intrinsic default constructors should do nothing
    83                                 // 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 assignment
    88                                 // 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 nothing
    96                         // delete newExpr;
    97                         break;
    9881                  case CodeGen::OT_CONSTANT:
    9982                  case CodeGen::OT_LABELADDRESS:
     
    10992                assert( ! objDecl->get_init() );
    11093                std::list< Expression* > noDesignators;
    111                 objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), noDesignators, false ) ); // cannot be constructed
     94                objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), false ) ); // cannot be constructed
    11295                newDecls.push_back( objDecl );
    11396        }
  • src/Makefile.am

    r9c951e3 rb1e63ac5  
    4343driver_cfa_cpp_SOURCES = ${SRC}
    4444driver_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
     45driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    4646driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
    4747
  • src/Makefile.in

    r9c951e3 rb1e63ac5  
    119119        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    120120        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
     121        ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \
    121122        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    122123        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    143144        Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \
    144145        Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \
    145         Parser/driver_cfa_cpp-parseutility.$(OBJEXT) \
     146        Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \
    146147        ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \
    147148        ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \
     
    161162        ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) \
    162163        ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT) \
     164        ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) \
    163165        SymTab/driver_cfa_cpp-Indexer.$(OBJEXT) \
    164166        SymTab/driver_cfa_cpp-Mangler.$(OBJEXT) \
     
    173175        SynTree/driver_cfa_cpp-PointerType.$(OBJEXT) \
    174176        SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT) \
    175         SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT) \
    176177        SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT) \
    177178        SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT) \
     
    395396        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    396397        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    397         ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
     398        ControlStruct/ForExprMutator.cc \
     399        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    398400        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    399401        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    406408        Parser/ExpressionNode.cc Parser/StatementNode.cc \
    407409        Parser/InitializerNode.cc Parser/TypeData.cc \
    408         Parser/LinkageSpec.cc Parser/parseutility.cc \
     410        Parser/LinkageSpec.cc Parser/parserutility.cc \
    409411        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    410412        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    415417        ResolvExpr/RenameVars.cc ResolvExpr/FindOpenVars.cc \
    416418        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 \
    423425        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
    424426        SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \
     
    448450driver_cfa_cpp_SOURCES = ${SRC}
    449451driver_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
     452driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    451453driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
    452454all: $(BUILT_SOURCES)
     
    595597        ControlStruct/$(am__dirstamp) \
    596598        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     599ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT):  \
     600        ControlStruct/$(am__dirstamp) \
     601        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    597602GenPoly/$(am__dirstamp):
    598603        @$(MKDIR_P) GenPoly
     
    664669Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
    665670        Parser/$(DEPDIR)/$(am__dirstamp)
    666 Parser/driver_cfa_cpp-parseutility.$(OBJEXT): Parser/$(am__dirstamp) \
     671Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
    667672        Parser/$(DEPDIR)/$(am__dirstamp)
    668673ResolvExpr/$(am__dirstamp):
     
    722727        ResolvExpr/$(am__dirstamp) \
    723728        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     729ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT):  \
     730        ResolvExpr/$(am__dirstamp) \
     731        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    724732SymTab/$(am__dirstamp):
    725733        @$(MKDIR_P) SymTab
     
    758766SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    759767        SynTree/$(DEPDIR)/$(am__dirstamp)
    760 SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT):  \
    761         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    762768SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT):  \
    763769        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
     
    856862        -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
    857863        -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT)
     864        -rm -f ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT)
    858865        -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT)
    859866        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
     
    885892        -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT)
    886893        -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT)
    887         -rm -f Parser/driver_cfa_cpp-parseutility.$(OBJEXT)
     894        -rm -f Parser/driver_cfa_cpp-parserutility.$(OBJEXT)
    888895        -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT)
    889896        -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT)
     
    893900        -rm -f ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT)
    894901        -rm -f ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT)
     902        -rm -f ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT)
    895903        -rm -f ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT)
    896904        -rm -f ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT)
     
    933941        -rm -f SynTree/driver_cfa_cpp-PointerType.$(OBJEXT)
    934942        -rm -f SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT)
    935         -rm -f SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT)
    936943        -rm -f SynTree/driver_cfa_cpp-Statement.$(OBJEXT)
    937944        -rm -f SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT)
     
    969976@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    970977@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@
    971979@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    972980@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
     
    9981006@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@
    9991007@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-parseutility.Po@am__quote@
     1008@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@
    10011009@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@
    10021010@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@
     
    10061014@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po@am__quote@
    10071015@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@
    10081017@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po@am__quote@
    10091018@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po@am__quote@
     
    10461055@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po@am__quote@
    10471056@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@
    10491057@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po@am__quote@
    10501058@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po@am__quote@
     
    13601368@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`
    13611369
     1370ControlStruct/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
     1377ControlStruct/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
    13621384GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    13631385@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
     
    16961718@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`
    16971719
    1698 Parser/driver_cfa_cpp-parseutility.o: Parser/parseutility.cc
    1699 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.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.cc
    1700 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
    1701 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.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-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc
    1704 
    1705 Parser/driver_cfa_cpp-parseutility.obj: Parser/parseutility.cc
    1706 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.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-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
    1708 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.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-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`
     1720Parser/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
     1727Parser/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`
    17111733
    17121734ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc
     
    19481970@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`
    19491971
     1972ResolvExpr/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
     1979ResolvExpr/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
    19501986SymTab/driver_cfa_cpp-Indexer.o: SymTab/Indexer.cc
    19511987@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
     
    21152151@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    21162152@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.cc
    2119 @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.cc
    2120 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po
    2121 @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.cc
    2124 
    2125 SynTree/driver_cfa_cpp-ReferenceType.obj: SynTree/ReferenceType.cc
    2126 @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.Po
    2128 @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`
    21312153
    21322154SynTree/driver_cfa_cpp-FunctionType.o: SynTree/FunctionType.cc
  • src/Parser/DeclarationNode.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 15:46:33 2017
    13 // Update Count     : 1018
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:27:00 2017
     13// Update Count     : 1019
    1414//
    1515
     
    5757        variable.tyClass = NoTypeClass;
    5858        variable.assertions = nullptr;
     59        variable.initializer = nullptr;
    5960
    6061//      attr.name = nullptr;
     
    7071//      delete variable.name;
    7172        delete variable.assertions;
     73        delete variable.initializer;
    7274
    7375        delete type;
     
    101103        newnode->variable.tyClass = variable.tyClass;
    102104        newnode->variable.assertions = maybeClone( variable.assertions );
     105        newnode->variable.initializer = maybeClone( variable.initializer );
    103106
    104107//      newnode->attr.name = attr.name ? new string( *attr.name ) : nullptr;
     
    857860}
    858861
     862DeclarationNode * 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
    859868DeclarationNode * DeclarationNode::cloneType( string * newName ) {
    860869        DeclarationNode * newnode = new DeclarationNode;
     
    10141023                assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
    10151024                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 );
    10171026                buildList( variable.assertions, ret->get_assertions() );
    10181027                return ret;
     
    10541063          case TypeData::Enum:
    10551064          case TypeData::Aggregate: {
    1056                   ReferenceToType * ret = buildComAggInst( type, attributes );
     1065                  ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
    10571066                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10581067                  return ret;
  • src/Parser/ExpressionNode.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 17:02:46 2017
    13 // Update Count     : 515
     12// Last Modified On : Wed Jun 28 21:08:15 2017
     13// Update Count     : 542
    1414//
    1515
     
    2727#include "SynTree/Declaration.h"
    2828#include "Common/UnimplementedError.h"
    29 #include "parseutility.h"
     29#include "parserutility.h"
    3030#include "Common/utility.h"
    3131
     
    6262        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    6363        int size;                                                                                       // 0 => int, 1 => long, 2 => long long
    64         unsigned long long v;                                                           // converted integral value
     64        unsigned long long int v;                                                               // converted integral value
    6565        size_t last = str.length() - 1;                                         // last character of constant
    6666
     
    118118        } // if
    119119
    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 ) );
    121121        delete &str;                                                                            // created by lex
    122122        return ret;
     
    133133        // floating-point constant has minimum of 2 characters: 1. or .1
    134134        size_t last = str.length() - 1;
     135        double v;
     136
     137        sscanf( str.c_str(), "%lg", &v );
    135138
    136139        if ( checkI( str[last] ) ) {                                            // imaginary ?
     
    150153        } // if
    151154
    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 ) );
    153156        delete &str;                                                                            // created by lex
    154157        return ret;
     
    156159
    157160Expression *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] ) );
    159162        delete &str;                                                                            // created by lex
    160163        return ret;
     
    164167        // string should probably be a primitive type
    165168        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 '"'
    168170                                                                   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 ) );
    170173        delete &str;                                                                            // created by lex
    171174        return ret;
     
    173176
    174177Expression *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 ) );
    176180        delete &str;                                                                            // created by lex
    177181        return ret;
     
    184188        std::stringstream ss( str );
    185189        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 ) ) );
    189191        delete &str;
    190192        return ret;
     
    207209} // build_field_name_fraction_constants
    208210
     211
     212
    209213Expression * 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 );
    211215        Expression * ret = build_constantInteger( *new std::string( str.substr(1) ) );
    212216        delete &str;
     
    215219
    216220Expression * 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 );
    218222        Expression * ret = build_constantInteger( *new std::string( str.substr( 0, str.size()-1 ) ) );
    219223        delete &str;
     
    221225} // build_field_name_REALDECIMALconstant
    222226
    223 NameExpr * build_varref( const string *name, bool labelp ) {
     227NameExpr * build_varref( const string *name ) {
    224228        NameExpr *expr = new NameExpr( *name, nullptr );
    225229        delete name;
     
    344348
    345349Expression *build_valexpr( StatementNode *s ) {
    346         return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr );
     350        return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ) );
    347351}
    348352Expression *build_typevalue( DeclarationNode *decl ) {
  • src/Parser/InitializerNode.cc

    r9c951e3 rb1e63ac5  
    7474
    7575        InitializerNode *moreInit;
    76         if  ( get_next() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) != 0) )
     76        if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) {
    7777                moreInit->printOneLine( os );
     78        }
    7879}
    7980
    8081Initializer *InitializerNode::build() const {
    8182        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
    8291                std::list< Initializer * > initlist;
    8392                buildList< Initializer, InitializerNode >( next_init(), initlist );
    84 
    85                 std::list< Expression * > designlist;
    86 
    87                 if ( designator != 0 ) {
    88                         buildList< Expression, ExpressionNode >( designator, designlist );
    89                 } // if
    90 
    9193                return new ListInit( initlist, designlist, maybeConstructed );
    9294        } 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                }
    10098        } // if
    101 
    10299        return 0;
    103100}
  • src/Parser/LinkageSpec.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:22:09 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct  2 23:16:21 2016
    13 // Update Count     : 23
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 11:51:00 2017
     13// Update Count     : 24
    1414//
    1515
     
    2828        } else if ( *spec == "\"C\"" ) {
    2929                return C;
     30        } else if ( *spec == "\"BuiltinC\"" ) {
     31                return BuiltinC;
    3032        } else {
    3133                throw SemanticError( "Invalid linkage specifier " + *spec );
     
    3638        assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
    3739        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",
    3941        };
    4042        return linkageKinds[linkage];
    4143}
    4244
    43 bool LinkageSpec::isDecoratable( Spec spec ) {
     45bool LinkageSpec::isMangled( Spec spec ) {
    4446        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    4547        static bool decoratable[LinkageSpec::NoOfSpecs] = {
    46                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     48                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    4749                        true,           true,           false,  true,           false,
     50                //      Builtin,        BuiltinC,
     51                        true,           false,
    4852        };
    4953        return decoratable[spec];
     
    5357        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    5458        static bool generatable[LinkageSpec::NoOfSpecs] = {
    55                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     59                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    5660                        true,           true,           true,   true,           false,
     61                //      Builtin,        BuiltinC,
     62                        true,           true,
    5763        };
    5864        return generatable[spec];
     
    6268        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    6369        static bool overridable[LinkageSpec::NoOfSpecs] = {
    64                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     70                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    6571                        true,           false,          false,  true,           false,
     72                //      Builtin,        BuiltinC,
     73                        false,          false,
    6674        };
    6775        return overridable[spec];
     
    7179        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    7280        static bool builtin[LinkageSpec::NoOfSpecs] = {
    73                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     81                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    7482                        true,           false,          false,  false,          true,
     83                //      Builtin,        BuiltinC,
     84                        true,           true,
    7585        };
    7686        return builtin[spec];
  • src/Parser/LinkageSpec.h

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  1 23:03:17 2016
    13 // Update Count     : 11
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 11:50:00 2017
     13// Update Count     : 12
    1414//
    1515
     
    2626                AutoGen,                                                                                // built by translator (struct assignment)
    2727                Compiler,                                                                               // gcc internal
     28                Builtin,                                                                                // mangled builtins
     29                BuiltinC,                                                                               // non-mangled builtins
    2830                NoOfSpecs
    2931        };
     
    3234        static std::string linkageName( Spec );
    3335 
    34         static bool isDecoratable( Spec );
     36        static bool isMangled( Spec );
    3537        static bool isGeneratable( Spec );
    3638        static bool isOverridable( Spec );
  • src/Parser/ParseNode.h

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 15:42:18 2017
    13 // Update Count     : 777
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 13:00:00 2017
     13// Update Count     : 779
    1414//
    1515
     
    6161        }
    6262
    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 {}
    6565
    6666        static int indent_by;
     
    113113        ExpressionNode * set_extension( bool exten ) { extension = exten; return this; }
    114114
    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 {}
    117117
    118118        template<typename T>
     
    166166Expression * build_field_name_REALDECIMALconstant( const std::string & str );
    167167
    168 NameExpr * build_varref( const std::string * name, bool labelp = false );
     168NameExpr * build_varref( const std::string * name );
    169169Expression * build_typevalue( DeclarationNode * decl );
    170170
     
    274274        DeclarationNode * addIdList( DeclarationNode * list ); // old-style functions
    275275        DeclarationNode * addInitializer( InitializerNode * init );
     276        DeclarationNode * addTypeInitializer( DeclarationNode * init );
    276277
    277278        DeclarationNode * cloneType( std::string * newName );
     
    282283        }
    283284
    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;
    286287
    287288        Declaration * build() const;
     
    301302                DeclarationNode::TypeClass tyClass;
    302303                DeclarationNode * assertions;
     304                DeclarationNode * initializer;
    303305        };
    304306        Variable_t variable;
     
    361363        virtual StatementNode * append_last_case( StatementNode * );
    362364
    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 {}
    365367  private:
    366368        std::unique_ptr<Statement> stmt;
     
    391393Statement * build_return( ExpressionNode * ctl );
    392394Statement * build_throw( ExpressionNode * ctl );
     395Statement * build_resume( ExpressionNode * ctl );
     396Statement * build_resume_at( ExpressionNode * ctl , ExpressionNode * target );
    393397Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt );
    394 Statement * build_catch( DeclarationNode * decl, StatementNode * stmt, bool catchAny = false );
     398Statement * build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body );
    395399Statement * build_finally( StatementNode * stmt );
    396400Statement * build_compound( StatementNode * first );
     
    411415                                result->location = cur->location;
    412416                                * out++ = result;
     417                        } else {
     418                                assertf(false, "buildList unknown type");
    413419                        } // if
    414420                } catch( SemanticError &e ) {
  • src/Parser/StatementNode.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 22:16:40 2017
    13 // Update Count     : 327
     12// Last Modified On : Wed Jun 28 21:08:37 2017
     13// Update Count     : 330
    1414//
    1515
     
    2121#include "SynTree/Statement.h"
    2222#include "SynTree/Expression.h"
    23 #include "parseutility.h"
     23#include "parserutility.h"
    2424#include "Common/utility.h"
    2525
     
    152152        return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr );
    153153}
     154
    154155Statement *build_throw( ExpressionNode *ctl ) {
    155156        std::list< Expression * > exps;
    156157        buildMoveList( ctl, exps );
    157158        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
     162Statement *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
     169Statement *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," );
    159173}
    160174
    161175Statement *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 );
    164178        CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    165179        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    166180        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
    167181}
    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 );
     182Statement *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() );
    173187}
    174188Statement *build_finally( StatementNode *stmt ) {
  • src/Parser/TypeData.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:12:51 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 15:52:43 2017
    13 // Update Count     : 563
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:28:00 2017
     13// Update Count     : 564
    1414//
    1515
     
    630630} // buildReference
    631631
    632 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {
     632AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    633633        assert( td->kind == TypeData::Aggregate );
    634634        AggregateDecl * at;
     
    638638          case DeclarationNode::Monitor:
    639639          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 );
    641641                buildForall( td->aggregate.params, at->get_parameters() );
    642642                break;
     
    659659} // buildAggregate
    660660
    661 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
     661ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    662662        switch ( type->kind ) {
    663663          case TypeData::Enum: {
     
    672672                  ReferenceToType * ret;
    673673                  if ( type->aggregate.body ) {
    674                           AggregateDecl * typedecl = buildAggregate( type, attributes );
     674                          AggregateDecl * typedecl = buildAggregate( type, attributes, linkage );
    675675                          switch ( type->aggregate.kind ) {
    676676                                case DeclarationNode::Struct:
     
    776776                if ( cur->has_enumeratorValue() ) {
    777777                        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() ) ) );
    779779                } // if
    780780        } // for
     
    793793TupleType * buildTuple( const TypeData * td ) {
    794794        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 );
    797798        buildForall( td->forall, ret->get_forall() );
    798799        return ret;
     
    818819                return decl->set_asmName( asmName );
    819820        } else if ( td->kind == TypeData::Aggregate ) {
    820                 return buildAggregate( td, attributes );
     821                return buildAggregate( td, attributes, linkage );
    821822        } else if ( td->kind == TypeData::Enum ) {
    822823                return buildEnum( td, attributes );
  • src/Parser/TypeData.h

    r9c951e3 rb1e63ac5  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:18:36 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:32:39 2017
    13 // Update Count     : 185
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:29:00 2017
     13// Update Count     : 186
    1414//
    1515
     
    103103ReferenceType * buildReference( const TypeData * );
    104104AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    105 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
     105ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
    106106ReferenceToType * buildAggInst( const TypeData * );
    107107TypeDecl * buildVariable( const TypeData * );
  • src/Parser/TypedefTable.h

    r9c951e3 rb1e63ac5  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 15 18:25:04 2016
    13 // Update Count     : 28
     12// Last Modified On : Wed Jun 28 21:56:34 2017
     13// Update Count     : 33
    1414//
    1515
     
    2222#include <stack>
    2323
    24 #include "lex.h"
     24#include "parser.hh"
    2525#include "parser.h"
    2626
  • src/Parser/lex.ll

    r9c951e3 rb1e63ac5  
    55 * file "LICENCE" distributed with Cforall.
    66 *
    7  * lex.l --
     7 * lex.ll --
    88 *
    99 * Author           : Peter A. Buhr
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Mon Mar 13 08:36:17 2017
    13  * Update Count     : 506
     12 * Last Modified On : Wed Jun 28 21:03:45 2017
     13 * Update Count     : 529
    1414 */
    1515
     
    2727#include <cstdio>                                                                               // FILENAME_MAX
    2828
    29 #include "lex.h"
    30 #include "parser.h"                                                                             // YACC generated definitions based on C++ grammar
    3129#include "ParseNode.h"
    3230#include "TypedefTable.h"
     
    7775                                // numeric constants, CFA: '_' in constant
    7876hex_quad {hex}("_"?{hex}){3}
    79 integer_suffix "_"?(([uU][lL]?)|([uU]("ll"|"LL")?)|([lL][uU]?)|("ll"|"LL")[uU]?)
     77integer_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]?)))
    8078
    8179octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    9189
    9290decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
    93 real_decimal {decimal_digits}"."
    94 real_fraction "."{decimal_digits}
    95 real_constant {decimal_digits}?{real_fraction}
     91real_decimal {decimal_digits}"."{exponent}?{floating_suffix}?
     92real_fraction "."{decimal_digits}{exponent}?{floating_suffix}?
     93real_constant {decimal_digits}{real_fraction}
    9694exponent "_"?[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)
     96floating_suffix "_"?([fFdDlL][iI]?|[iI][lLfFdD]?|"DL")
    10097floating_constant (({real_constant}{exponent}?)|({decimal_digits}{exponent})){floating_suffix}?
    10198
     
    236233long                    { KEYWORD_RETURN(LONG); }
    237234lvalue                  { KEYWORD_RETURN(LVALUE); }                             // CFA
    238 monitor         { KEYWORD_RETURN(MONITOR); }                    // CFA
     235monitor                 { KEYWORD_RETURN(MONITOR); }                    // CFA
    239236mutex                   { KEYWORD_RETURN(MUTEX); }                              // CFA
    240237_Noreturn               { KEYWORD_RETURN(NORETURN); }                   // C11
     
    378375"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    379376        /*
    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 juxtaposed
    382           to an identifier, e.g., "*i", users will be annoyed if they cannot do this with respect to operator
    383           identifiers. Even with this special hack, there are 5 general cases that cannot be handled. The first
    384           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 scanning
    390           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 of
    403           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;
    404401        */
    405 {op_unary}"?"({op_unary_pre_post}|"[?]"|{op_binary_over}"?") {
     402{op_unary}"?"({op_unary_pre_post}|"()"|"[?]"|{op_binary_over}"?") {
    406403        // 1 or 2 character unary operator ?
    407404        int i = yytext[1] == '?' ? 1 : 2;
  • src/Parser/module.mk

    r9c951e3 rb1e63ac5  
    1111## Created On       : Sat May 16 15:29:09 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Tue Aug 16 17:28:34 2016
    14 ## Update Count     : 101
     13## Last Modified On : Wed Jun 28 21:58:29 2017
     14## Update Count     : 104
    1515###############################################################################
    1616
     
    2929       Parser/TypeData.cc \
    3030       Parser/LinkageSpec.cc \
    31        Parser/parseutility.cc
     31       Parser/parserutility.cc
    3232
    3333MAINTAINERCLEANFILES += Parser/parser.output
  • src/Parser/parser.hh

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // lex.h --
     7// parser.hh --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep 22 08:58:10 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 21 11:28:47 2016
    13 // Update Count     : 347
     12// Last Modified On : Wed Jun 28 22:10:17 2017
     13// Update Count     : 349
    1414//
    1515
    16 #ifndef PARSER_LEX_H
    17 #define PARSER_LEX_H
     16#ifndef PARSER_HH
     17#define PARSER_HH
    1818
    1919int yylex();
     
    4242}; // Token
    4343
    44 #endif // PARSER_LEX_H
     44#endif // PARSER_HH
    4545
    4646// Local Variables: //
  • src/Parser/parser.yy

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // cfa.y --
     7// parser.yy --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 15:42:32 2017
    13 // Update Count     : 2318
     12// Last Modified On : Wed Jun 28 22:11:22 2017
     13// Update Count     : 2414
    1414//
    1515
     
    4848#include <cstdio>
    4949#include <stack>
    50 #include "lex.h"
    51 #include "parser.h"
    5250#include "ParseNode.h"
    5351#include "TypedefTable.h"
     
    8583        } // for
    8684} // distExt
     85
     86bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8787%}
     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}
    88107
    89108//************************* TERMINAL TOKENS ********************************
     
    138157%token ATassign                                                                                 // @=
    139158
    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
    161161%type<constant> string_literal
    162162%type<str> string_literal_list
     
    191191%type<sn> case_value_list                               case_label                                      case_label_list
    192192%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    193 %type<sn> handler_list                                  handler_clause                          finally_clause
     193%type<sn> /* handler_list */                    handler_clause                          finally_clause
    194194
    195195// declarations
     
    205205%type<en>   bit_subrange_size_opt bit_subrange_size
    206206
    207 %type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name
     207%type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type indirect_type
    208208
    209209%type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier
     
    259259%type<decl> type_declarator type_declarator_name type_declaring_list
    260260
    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
    262263
    263264%type<decl> variable_type_redeclarator type_ptr type_array type_function
    264265
    265266%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
    272272
    273273%type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list
     
    349349        IDENTIFIER
    350350        | ATTR_IDENTIFIER                                                                       // CFA
    351         | zero_one                                                                                      // CFA
    352         ;
    353 
    354 no_01_identifier:
    355         IDENTIFIER
    356         | ATTR_IDENTIFIER                                                                       // CFA
    357351        ;
    358352
    359353no_attr_identifier:
    360354        IDENTIFIER
    361         | zero_one                                                                                      // CFA
    362355        ;
    363356
     
    365358        ZERO
    366359        | ONE
    367         ;
     360        ;
    368361
    369362string_literal:
     
    393386        | '(' compound_statement ')'                                            // GCC, lambda expression
    394387                { $$ = new ExpressionNode( build_valexpr( $2 ) ); }
    395         | primary_expression '{' argument_expression_list '}' // CFA
     388        | primary_expression '{' argument_expression_list '}' // CFA, constructor call
    396389                {
    397390                        Token fn;
     
    399392                        $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
    400393                }
     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
    401398        ;
    402399
     
    429426        | postfix_expression DECR
    430427                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, $1 ) ); }
    431         | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal
     428        | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal
    432429                { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); }
    433430        | '^' primary_expression '{' argument_expression_list '}' // CFA
     
    481478        | no_attr_identifier fraction_constants
    482479                {
    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 ) );
    488485                }
    489486        ;
     
    533530        | SIZEOF unary_expression
    534531                { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); }
    535         | SIZEOF '(' type_name_no_function ')'
     532        | SIZEOF '(' type_no_function ')'
    536533                { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); }
    537534        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    538535                { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); }
    539         | ALIGNOF '(' type_name_no_function ')'                         // GCC, type alignment
     536        | ALIGNOF '(' type_no_function ')'                              // GCC, type alignment
    540537                { $$ = new ExpressionNode( build_alignOftype( $3 ) ); }
    541         | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')'
     538        | OFFSETOF '(' type_no_function ',' no_attr_identifier ')'
    542539                { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); }
    543540        | ATTR_IDENTIFIER
     
    545542        | ATTR_IDENTIFIER '(' argument_expression ')'
    546543                { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); }
    547         | ATTR_IDENTIFIER '(' type_name ')'
     544        | ATTR_IDENTIFIER '(' type ')'
    548545                { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); }
    549546//      | 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 ) ); }
    551548        ;
    552549
     
    567564cast_expression:
    568565        unary_expression
    569         | '(' type_name_no_function ')' cast_expression
     566        | '(' type_no_function ')' cast_expression
    570567                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    571 //      | '(' type_name_no_function ')' tuple
     568//      | '(' type_no_function ')' tuple
    572569//              { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    573570        ;
     
    656653        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    657654                { $$ = new ExpressionNode( build_cond( $1, $1, $4 ) ); }
    658 //      | logical_OR_expression '?' comma_expression ':' tuple // CFA, tuple expression
    659 //              { $$ = new ExpressionNode( build_cond( $1, $3, $5 ) ); }
    660655        ;
    661656
     
    669664        | unary_expression assignment_operator assignment_expression
    670665                { $$ = new ExpressionNode( build_binary_ptr( $2, $1, $3 ) ); }
    671 //      | tuple assignment_opt                                                          // CFA, tuple expression
    672 //              { $$ = ( $2 == 0 ) ? $1 : new ExpressionNode( build_binary_ptr( OperKinds::Assign, $1, $2 ) ); }
    673666        ;
    674667
     
    936929                { $$ = new StatementNode( build_throw( $2 ) ); }
    937930        | THROWRESUME assignment_expression_opt ';'                     // handles reresume
    938                 { $$ = new StatementNode( build_throw( $2 ) ); }
     931                { $$ = new StatementNode( build_resume( $2 ) ); }
    939932        | THROWRESUME assignment_expression_opt AT assignment_expression ';' // handles reresume
    940                 { $$ = new StatementNode( build_throw( $2 ) ); }
     933                { $$ = new StatementNode( build_resume_at( $2, $4 ) ); }
    941934        ;
    942935
    943936exception_statement:
    944         TRY compound_statement handler_list
     937        TRY compound_statement handler_clause
    945938                { $$ = new StatementNode( build_try( $2, $3, 0 ) ); }
    946939        | TRY compound_statement finally_clause
    947940                { $$ = new StatementNode( build_try( $2, 0, $3 ) ); }
    948         | TRY compound_statement handler_list finally_clause
     941        | TRY compound_statement handler_clause finally_clause
    949942                { $$ = new StatementNode( build_try( $2, $3, $4 ) ); }
    950943        ;
    951944
    952 handler_list:
    953         handler_clause
    954                 // 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_statement
    956                 { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    957         | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    958                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }
    959         | CATCHRESUME '(' ELLIPSIS ')' compound_statement
    960                 { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    961         | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement
    962                 { $$ = (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//      ;
    964957
    965958handler_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 ) ); }
    968967        | 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 ) ) ); }
    970969        | 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 ) ); }
    972971        | 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 ) ) ); }
    974973        ;
    975974
     
    13501349        basic_declaration_specifier
    13511350        | sue_declaration_specifier
    1352         | typedef_declaration_specifier
    1353         | typegen_declaration_specifier
     1351        | type_declaration_specifier
    13541352        ;
    13551353
     
    13621360        basic_declaration_specifier
    13631361        | sue_declaration_specifier_nobody
    1364         | typedef_declaration_specifier
    1365         | typegen_declaration_specifier
     1362        | type_declaration_specifier
    13661363        ;
    13671364
     
    13691366        basic_type_specifier
    13701367        | sue_type_specifier
    1371         | typedef_type_specifier
    1372         | typegen_type_specifier
     1368        | type_type_specifier
    13731369        ;
    13741370
     
    13811377        basic_type_specifier
    13821378        | sue_type_specifier_nobody
    1383         | typedef_type_specifier
    1384         | typegen_type_specifier
     1379        | type_type_specifier
    13851380        ;
    13861381
     
    15171512
    15181513basic_type_specifier:
    1519         direct_type_name
    1520         | type_qualifier_list_opt indirect_type_name type_qualifier_list_opt
     1514        direct_type
     1515        | type_qualifier_list_opt indirect_type type_qualifier_list_opt
    15211516                { $$ = $2->addQualifiers( $1 )->addQualifiers( $3 ); }
    15221517        ;
    15231518
    1524 direct_type_name:
     1519direct_type:
    15251520                // A semantic check is necessary for conflicting type qualifiers.
    15261521        basic_type_name
    15271522        | type_qualifier_list basic_type_name
    15281523                { $$ = $2->addQualifiers( $1 ); }
    1529         | direct_type_name type_qualifier
     1524        | direct_type type_qualifier
    15301525                { $$ = $1->addQualifiers( $2 ); }
    1531         | direct_type_name basic_type_name
     1526        | direct_type basic_type_name
    15321527                { $$ = $1->addType( $2 ); }
    15331528        ;
    15341529
    1535 indirect_type_name:
    1536         TYPEOF '(' type_name ')'                                                        // GCC: typeof(x) y;
     1530indirect_type:
     1531        TYPEOF '(' type ')'                                                                     // GCC: typeof(x) y;
    15371532                { $$ = $3; }
    15381533        | TYPEOF '(' comma_expression ')'                                       // GCC: typeof(a+b) y;
    15391534                { $$ = DeclarationNode::newTypeof( $3 ); }
    1540         | ATTR_TYPEGENname '(' type_name ')'                            // CFA: e.g., @type(x) y;
     1535        | ATTR_TYPEGENname '(' type ')'                                         // CFA: e.g., @type(x) y;
    15411536                { $$ = DeclarationNode::newAttr( $1, $3 ); }
    15421537        | ATTR_TYPEGENname '(' comma_expression ')'                     // CFA: e.g., @type(a+b) y;
     
    15561551sue_type_specifier:                                                                             // struct, union, enum + type specifier
    15571552        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 ); }
    15601557        | sue_type_specifier type_qualifier
    15611558                { $$ = $1->addQualifiers( $2 ); }
     
    15801577        ;
    15811578
    1582 typedef_declaration_specifier:
    1583         typedef_type_specifier
    1584         | declaration_qualifier_list typedef_type_specifier
     1579type_declaration_specifier:
     1580        type_type_specifier
     1581        | declaration_qualifier_list type_type_specifier
    15851582                { $$ = $2->addQualifiers( $1 ); }
    1586         | typedef_declaration_specifier storage_class           // remaining OBSOLESCENT (see 2)
     1583        | type_declaration_specifier storage_class                      // remaining OBSOLESCENT (see 2)
    15871584                { $$ = $1->addQualifiers( $2 ); }
    1588         | typedef_declaration_specifier storage_class type_qualifier_list
     1585        | type_declaration_specifier storage_class type_qualifier_list
    15891586                { $$ = $1->addQualifiers( $2 )->addQualifiers( $3 ); }
    15901587        ;
    15911588
    1592 typedef_type_specifier:                                                                 // typedef types
     1589type_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
     1597type_name:
    15931598        TYPEDEFname
    15941599                { $$ = 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
     1611typegen_name:                                                                                   // CFA
     1612        TYPEGENname '(' ')'
     1613                { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); }
     1614        | TYPEGENname '(' type_list ')'
     1615                { $$ = DeclarationNode::newFromTypeGen( $1, $3 ); }
    15991616        ;
    16001617
     
    16131630                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    16141631        | 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                }
    16161637          '{' field_declaration_list '}'
    16171638                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
    1618         | aggregate_key attribute_list_opt '(' type_name_list ')' '{' field_declaration_list '}' // CFA
     1639        | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list '}' // CFA
    16191640                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); }
    16201641        | aggregate_type_nobody
     
    16221643
    16231644aggregate_type_nobody:                                                                  // struct, union - {...}
    1624         aggregate_key attribute_list_opt no_attr_identifier_or_type_name
     1645        aggregate_key attribute_list_opt no_attr_identifier
    16251646                {
    16261647                        typedefTable.makeTypedef( *$3 );
    16271648                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    16281649                }
    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
    16301656                { $$ = $3->addQualifiers( $2 ); }
    16311657        ;
     
    18651891        ;
    18661892
    1867 no_01_identifier_or_type_name:
    1868         no_01_identifier
    1869         | TYPEDEFname
    1870         | TYPEGENname
    1871         ;
    1872 
    18731893no_attr_identifier_or_type_name:
    18741894        no_attr_identifier
     
    18771897        ;
    18781898
    1879 type_name_no_function:                                                                  // sizeof, alignof, cast (constructor)
     1899type_no_function:                                                                               // sizeof, alignof, cast (constructor)
    18801900        cfa_abstract_declarator_tuple                                           // CFA
    18811901        | type_specifier
     
    18841904        ;
    18851905
    1886 type_name:                                                                                              // typeof, assertion
    1887         type_name_no_function
     1906type:                                                                                                   // typeof, assertion
     1907        type_no_function
    18881908        | cfa_abstract_function                                                         // CFA
    18891909        ;
     
    19251945designation:
    19261946        designator_list ':'                                                                     // C99, CFA uses ":" instead of "="
    1927         | no_attr_identifier_or_type_name ':'                           // GCC, field name
     1947        | no_attr_identifier ':'                                                        // GCC, field name
    19281948                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    19291949        ;
     
    19371957
    19381958designator:
    1939         '.' no_attr_identifier_or_type_name                                     // C99, field name
     1959        '.' no_attr_identifier                                                          // C99, field name
    19401960                { $$ = new ExpressionNode( build_varref( $2 ) ); }
    19411961        | '[' push assignment_expression pop ']'                        // C99, single array element
     
    19681988//     on type arguments of polymorphic functions.
    19691989
    1970 typegen_declaration_specifier:                                                  // CFA
    1971         typegen_type_specifier
    1972         | declaration_qualifier_list typegen_type_specifier
    1973                 { $$ = $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_list
    1977                 { $$ = $1->addQualifiers( $2 )->addQualifiers( $3 ); }
    1978         ;
    1979 
    1980 typegen_type_specifier:                                                                 // CFA
    1981         typegen_name
    1982         | type_qualifier_list typegen_name
    1983                 { $$ = $2->addQualifiers( $1 ); }
    1984         | typegen_type_specifier type_qualifier
    1985                 { $$ = $1->addQualifiers( $2 ); }
    1986         ;
    1987 
    1988 typegen_name:                                                                                   // CFA
    1989         TYPEGENname '(' type_name_list ')'
    1990                 { $$ = DeclarationNode::newFromTypeGen( $1, $3 ); }
    1991         ;
    1992 
    19931990type_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
    19961994                { $$ = $1->appendList( $3 ); }
     1995        ;
     1996
     1997type_initializer_opt:                                                                   // CFA
     1998        // empty
     1999                { $$ = nullptr; }
     2000        | '=' type
     2001                { $$ = $2; }
    19972002        ;
    19982003
     
    20002005        type_class no_attr_identifier_or_type_name
    20012006                { typedefTable.addToEnclosingScope( *$2, TypedefTable::TD ); }
    2002           assertion_list_opt
    2003                 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addAssertions( $4 ); }
     2007          type_initializer_opt assertion_list_opt
     2008                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    20042009        | type_specifier identifier_parameter_declarator
    20052010        ;
     
    20242029
    20252030assertion:                                                                                              // CFA
    2026         '|' no_attr_identifier_or_type_name '(' type_name_list ')'
     2031        '|' no_attr_identifier_or_type_name '(' type_list ')'
    20272032                {
    20282033                        typedefTable.openTrait( *$2 );
     
    20312036        | '|' '{' push trait_declaration_list '}'
    20322037                { $$ = $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 ')'
    20342039                { $$ = nullptr; }
    20352040        ;
    20362041
    2037 type_name_list:                                                                                 // CFA
    2038         type_name
     2042type_list:                                                                                              // CFA
     2043        type
    20392044                { $$ = new ExpressionNode( build_typevalue( $1 ) ); }
    20402045        | assignment_expression
    2041         | type_name_list ',' type_name
     2046        | type_list ',' type
    20422047                { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( build_typevalue( $3 ) ) ) ); }
    2043         | type_name_list ',' assignment_expression
     2048        | type_list ',' assignment_expression
    20442049                { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
    20452050        ;
     
    20572062        type_declarator_name assertion_list_opt
    20582063                { $$ = $1->addAssertions( $2 ); }
    2059         | type_declarator_name assertion_list_opt '=' type_name
     2064        | type_declarator_name assertion_list_opt '=' type
    20602065                { $$ = $1->addAssertions( $2 )->addType( $4 ); }
    20612066        ;
     
    20672072                        $$ = DeclarationNode::newTypeDecl( $1, 0 );
    20682073                }
    2069         | no_01_identifier_or_type_name '(' push type_parameter_list pop ')'
     2074        | no_attr_identifier_or_type_name '(' push type_parameter_list pop ')'
    20702075                {
    20712076                        typedefTable.addToEnclosingScope( *$1, TypedefTable::TG );
     
    20932098        ;
    20942099
    2095 trait_declaration_list:                                                         // CFA
     2100trait_declaration_list:                                                                 // CFA
    20962101        trait_declaration
    20972102        | trait_declaration_list push trait_declaration
     
    20992104        ;
    21002105
    2101 trait_declaration:                                                                      // CFA
     2106trait_declaration:                                                                              // CFA
    21022107        cfa_trait_declaring_list pop ';'
    21032108        | trait_declaring_list pop ';'
  • src/Parser/parserutility.cc

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // parseutility.cc --
     7// parserutility.cc --
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:30:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 14 23:45:03 2016
    13 // Update Count     : 3
     12// Last Modified On : Wed Jun 28 22:11:32 2017
     13// Update Count     : 7
    1414//
    1515
    16 #include "parseutility.h"
     16#include "parserutility.h"
    1717#include "SynTree/Type.h"
    1818#include "SynTree/Expression.h"
     
    2626        UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) );
    2727        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 ) ) );
    2929        return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    3030}
  • src/Parser/parserutility.h

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // parseutility.h --
     7// parserutility.h --
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:31:46 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 16 15:32:58 2015
    13 // Update Count     : 2
     12// Last Modified On : Wed Jun 28 22:11:40 2017
     13// Update Count     : 3
    1414//
    1515
  • src/ResolvExpr/AlternativeFinder.cc

    r9c951e3 rb1e63ac5  
    9797                /// Prunes a list of alternatives down to those that have the minimum conversion cost for a given return type; skips ambiguous interpretations
    9898                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 ) {
    100100                        // select the alternatives that have the minimum conversion cost for a particular set of result types
    101101                        std::map< std::string, PruneStruct > selected;
     
    183183                        )
    184184                        AltList::iterator oldBegin = alternatives.begin();
    185                         pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ), indexer );
     185                        pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) );
    186186                        if ( alternatives.begin() == oldBegin ) {
    187187                                std::ostringstream stream;
     
    604604//          )
    605605                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                // )
    612612                addToIndexer( have, decls );
    613613                AssertionSet newNeed;
     
    627627                TypeEnvironment resultEnv;
    628628                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
    629630                AltList instantiatedActuals; // filled by instantiate function
    630631                if ( targetType && ! targetType->isVoid() && ! funcType->get_returnVals().empty() ) {
     
    808809        }
    809810
     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
    810837        void AlternativeFinder::visit( CastExpr *castExpr ) {
    811838                Type *& toType = castExpr->get_result();
     
    839866                                thisCost += Cost( 0, 0, discardedValues );
    840867
    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 ) );
    865869                        } // if
    866870                } // for
     
    11811185        }
    11821186
     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        }
    11831234} // namespace ResolvExpr
    11841235
  • src/ResolvExpr/AlternativeFinder.h

    r9c951e3 rb1e63ac5  
    7373                virtual void visit( UniqueExpr *unqExpr );
    7474                virtual void visit( StmtExpr *stmtExpr );
     75                virtual void visit( UntypedInitExpr *initExpr );
    7576                /// Runs a new alternative finder on each element in [begin, end)
    7677                /// and writes each alternative finder to out.
  • src/ResolvExpr/CastCost.cc

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // CastCost.cc -- 
     7// CastCost.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2626          public:
    2727                CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    28  
     28
    2929                virtual void visit( BasicType *basicType );
    3030                virtual void visit( PointerType *pointerType );
     
    3636                        NamedTypeDecl *namedType;
    3737                        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                                }
    3943                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
    4044                                TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
  • src/ResolvExpr/CommonType.cc

    r9c951e3 rb1e63ac5  
    4343
    4444                void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer );
    45                 template< typename RefType > void handleRefType( RefType *inst, Type *other );
    4645
    4746                Type *result;
     
    126125        }
    127126
    128         void CommonType::visit( VoidType *voidType ) {
    129         }
     127        void CommonType::visit( __attribute((unused)) VoidType *voidType ) {}
    130128
    131129        void CommonType::visit( BasicType *basicType ) {
     
    159157        void CommonType::visit( PointerType *pointerType ) {
    160158                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()) ) {
    162160                                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()) ) {
    164162                                getCommonWithVoidPointer( pointerType, otherPointer );
    165163                        } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst )
     
    189187        }
    190188
    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 ) {}
    205193
    206194        void CommonType::visit( EnumInstType *enumInstType ) {
     
    214202        }
    215203
    216         void CommonType::visit( TraitInstType *aggregateUseType ) {
     204        void CommonType::visit( __attribute((unused)) TraitInstType *aggregateUseType ) {
    217205        }
    218206
     
    239227        }
    240228
    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 ) {}
    246231
    247232        void CommonType::visit( ZeroType *zeroType ) {
  • src/ResolvExpr/ConversionCost.cc

    r9c951e3 rb1e63ac5  
    3030///     std::cout << "type inst " << destAsTypeInst->get_name();
    3131                        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                                }
    3337                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
    3438///       std::cout << " found" << std::endl;
     
    145149        };
    146150
    147         void ConversionCost::visit(VoidType *voidType) {
     151        void ConversionCost::visit( __attribute((unused)) VoidType *voidType ) {
    148152                cost = Cost::infinity;
    149153        }
     
    182186        }
    183187
    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) {}
    189190
    190191        void ConversionCost::visit(StructInstType *inst) {
     
    204205        }
    205206
    206         void ConversionCost::visit(EnumInstType *inst) {
     207        void ConversionCost::visit( __attribute((unused)) EnumInstType *inst ) {
    207208                static Type::Qualifiers q;
    208209                static BasicType integer( q, BasicType::SignedInt );
     
    213214        }
    214215
    215         void ConversionCost::visit(TraitInstType *inst) {
     216        void ConversionCost::visit( __attribute((unused)) TraitInstType *inst) {
    216217        }
    217218
     
    235236        }
    236237
    237         void ConversionCost::visit(TupleType *tupleType) {
     238        void ConversionCost::visit( __attribute((unused)) TupleType *tupleType) {
    238239                Cost c;
    239240                if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) {
     
    255256        }
    256257
    257         void ConversionCost::visit(VarArgsType *varArgsType) {
     258        void ConversionCost::visit( __attribute((unused)) VarArgsType *varArgsType) {
    258259                if ( dynamic_cast< VarArgsType* >( dest ) ) {
    259260                        cost = Cost::zero;
     
    261262        }
    262263
    263         void ConversionCost::visit(ZeroType *zeroType) {
     264        void ConversionCost::visit( __attribute((unused)) ZeroType *zeroType) {
    264265                if ( dynamic_cast< ZeroType* >( dest ) ) {
    265266                        cost = Cost::zero;
     
    277278        }
    278279
    279         void ConversionCost::visit(OneType *oneType) {
     280        void ConversionCost::visit( __attribute((unused)) OneType *oneType) {
    280281                if ( dynamic_cast< OneType* >( dest ) ) {
    281282                        cost = Cost::zero;
  • src/ResolvExpr/PtrsAssignable.cc

    r9c951e3 rb1e63ac5  
    6363        }
    6464
    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 ) {}
    6766
    68         void PtrsAssignable::visit( VoidType *voidType ) {
     67        void PtrsAssignable::visit( __attribute((unused)) VoidType *voidType ) {
    6968                if ( dynamic_cast< FunctionType* >( dest ) ) {
    7069                        result = 0;
     
    7473        }
    7574
    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 ) {
    8679                result = -1;
    8780        }
    8881
    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 ) {}
    9684
    9785        void PtrsAssignable::visit( EnumInstType *inst ) {
     
    10391        }
    10492
    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 ) {}
    10994        void PtrsAssignable::visit( TypeInstType *inst ) {
    11095                EqvClass eqvClass;
     
    116101        }
    117102
    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 ) {}
    151107       
    152108} // namespace ResolvExpr
  • src/ResolvExpr/PtrsCastable.cc

    r9c951e3 rb1e63ac5  
    9292        }
    9393
    94         void PtrsCastable::visit(VoidType *voidType) {
     94        void PtrsCastable::visit( __attribute__((unused)) VoidType *voidType) {
    9595                result = objectCast( dest, env, indexer );
    9696        }
    9797
    98         void PtrsCastable::visit(BasicType *basicType) {
     98        void PtrsCastable::visit( __attribute__((unused)) BasicType *basicType) {
    9999                result = objectCast( dest, env, indexer );
    100100        }
    101101
    102         void PtrsCastable::visit(PointerType *pointerType) {
     102        void PtrsCastable::visit( __attribute__((unused)) PointerType *pointerType) {
    103103                result = objectCast( dest, env, indexer );
    104104        }
    105105
    106         void PtrsCastable::visit(ArrayType *arrayType) {
     106        void PtrsCastable::visit( __attribute__((unused)) ArrayType *arrayType) {
    107107                result = objectCast( dest, env, indexer );
    108108        }
    109109
    110         void PtrsCastable::visit(FunctionType *functionType) {
     110        void PtrsCastable::visit( __attribute__((unused)) FunctionType *functionType) {
    111111                // result = -1;
    112112                result = functionCast( dest, env, indexer );
    113113        }
    114114
    115         void PtrsCastable::visit(StructInstType *inst) {
     115        void PtrsCastable::visit( __attribute__((unused)) StructInstType *inst) {
    116116                result = objectCast( dest, env, indexer );
    117117        }
    118118
    119         void PtrsCastable::visit(UnionInstType *inst) {
     119        void PtrsCastable::visit( __attribute__((unused)) UnionInstType *inst) {
    120120                result = objectCast( dest, env, indexer );
    121121        }
    122122
    123         void PtrsCastable::visit(EnumInstType *inst) {
     123        void PtrsCastable::visit( __attribute__((unused)) EnumInstType *inst) {
    124124                if ( dynamic_cast< EnumInstType* >( dest ) ) {
    125125                        result = 1;
     
    135135        }
    136136
    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 ) {}
    140138
    141139        void PtrsCastable::visit(TypeInstType *inst) {
     
    144142        }
    145143
    146         void PtrsCastable::visit(TupleType *tupleType) {
     144        void PtrsCastable::visit( __attribute__((unused)) TupleType *tupleType) {
    147145                result = objectCast( dest, env, indexer );
    148146        }
    149147
    150         void PtrsCastable::visit(VarArgsType *varArgsType) {
     148        void PtrsCastable::visit( __attribute__((unused)) VarArgsType *varArgsType) {
    151149                result = objectCast( dest, env, indexer );
    152150        }
    153151
    154         void PtrsCastable::visit(ZeroType *zeroType) {
     152        void PtrsCastable::visit( __attribute__((unused)) ZeroType *zeroType) {
    155153                result = objectCast( dest, env, indexer );
    156154        }
    157155
    158         void PtrsCastable::visit(OneType *oneType) {
     156        void PtrsCastable::visit( __attribute__((unused)) OneType *oneType) {
    159157                result = objectCast( dest, env, indexer );
    160158        }
  • src/ResolvExpr/Resolver.cc

    r9c951e3 rb1e63ac5  
    1414//
    1515
     16#include <iostream>
     17
     18#include "Alternative.h"
     19#include "AlternativeFinder.h"
     20#include "CurrentObject.h"
     21#include "RenameVars.h"
    1622#include "Resolver.h"
    17 #include "AlternativeFinder.h"
    18 #include "Alternative.h"
    19 #include "RenameVars.h"
    2023#include "ResolveTypeof.h"
    2124#include "typeops.h"
     25
     26#include "SynTree/Expression.h"
     27#include "SynTree/Initializer.h"
    2228#include "SynTree/Statement.h"
    2329#include "SynTree/Type.h"
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Initializer.h"
     30
     31#include "SymTab/Autogen.h"
    2632#include "SymTab/Indexer.h"
    27 #include "SymTab/Autogen.h"
     33
    2834#include "Common/utility.h"
     35
    2936#include "InitTweak/InitTweak.h"
    3037
    31 #include <iostream>
    3238using namespace std;
    3339
     
    3945                        if ( const Resolver * res = dynamic_cast< const Resolver * >( &other ) ) {
    4046                                functionReturn = res->functionReturn;
    41                                 initContext = res->initContext;
     47                                currentObject = res->currentObject;
    4248                                inEnumDecl = res->inEnumDecl;
    4349                        }
     
    7985
    8086                Type * functionReturn = nullptr;
    81                 Type *initContext = nullptr;
     87                CurrentObject currentObject = nullptr;
    8288                bool inEnumDecl = false;
    8389        };
     
    124130                        } // if
    125131#endif
    126                         assert( finder.get_alternatives().size() == 1 );
     132                        assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
    127133                        Alternative &choice = finder.get_alternatives().front();
    128134                        Expression *newExpr = choice.expr->clone();
     
    186192                // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting
    187193                // 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() ) ) {
    191197                        // enumerator initializers should not use the enum type to initialize, since
    192198                        // 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 ) );
    194200                }
    195201                Parent::visit( objectDecl );
    196                 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) {
     202                if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) {
    197203                        // delete newly created signed int type
    198                         delete initContext;
    199                 }
    200                 initContext = temp;
     204                        // delete currentObject.getType();
     205                }
    201206        }
    202207
     
    315320
    316321        void Resolver::visit( SwitchStmt *switchStmt ) {
    317                 ValueGuard< Type * > oldInitContext( initContext );
     322                ValueGuard< CurrentObject > oldCurrentObject( currentObject );
    318323                Expression *newExpr;
    319324                newExpr = findIntegralExpression( switchStmt->get_condition(), *this );
     
    321326                switchStmt->set_condition( newExpr );
    322327
    323                 initContext = newExpr->get_result();
     328                currentObject = CurrentObject( newExpr->get_result() );
    324329                Parent::visit( switchStmt );
    325330        }
     
    327332        void Resolver::visit( CaseStmt *caseStmt ) {
    328333                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() );
    331337                        Expression * newExpr = findSingleExpression( castExpr, *this );
    332338                        castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
     
    370376
    371377        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;
    419407                                        }
    420408                                }
    421409                        }
    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();
    486417        }
    487418
    488419        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 {
    573449        }
    574450
  • src/ResolvExpr/TypeMap.h

    r9c951e3 rb1e63ac5  
    110110                        }
    111111
    112                         virtual void visit( VoidType *voidType ) {
     112                        virtual void visit( __attribute__((unused)) VoidType *voidType ) {
    113113                                findAndReplace( typeMap.voidValue );
    114114                        }
     
    138138                        }
    139139
    140                         virtual void visit( FunctionType *functionType ) {
     140                        virtual void visit( __attribute__((unused)) FunctionType *functionType ) {
    141141                                findAndReplace( typeMap.functionPointerValue );
    142142                        }
  • src/ResolvExpr/Unify.cc

    r9c951e3 rb1e63ac5  
    115115        }
    116116
    117         bool isFtype( Type *type, const SymTab::Indexer &indexer ) {
     117        bool isFtype( Type *type ) {
    118118                if ( dynamic_cast< FunctionType* >( type ) ) {
    119119                        return true;
     
    124124        }
    125125
    126         bool tyVarCompatible( const TypeDecl::Data & data, Type *type, const SymTab::Indexer &indexer ) {
     126        bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
    127127                switch ( data.kind ) {
    128128                  case TypeDecl::Any:
     
    132132                        // type must also be complete
    133133                        // 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() );
    135135                  case TypeDecl::Ftype:
    136                         return isFtype( type, indexer );
     136                        return isFtype( type );
    137137                  case TypeDecl::Ttype:
    138138                        // ttype unifies with any tuple type
     
    145145                OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() );
    146146                assert( tyvar != openVars.end() );
    147                 if ( ! tyVarCompatible( tyvar->second, other, indexer ) ) {
     147                if ( ! tyVarCompatible( tyvar->second, other ) ) {
    148148                        return false;
    149149                } // if
     
    345345                std::cerr << "unifyInexact type 1 is ";
    346346                type1->print( std::cerr );
    347                 std::cerr << "type 2 is ";
     347                std::cerr << " type 2 is ";
    348348                type2->print( std::cerr );
    349349                std::cerr << std::endl;
     
    389389        }
    390390
    391         void Unify::visit(VoidType *voidType) {
     391        void Unify::visit( __attribute__((unused)) VoidType *voidType) {
    392392                result = dynamic_cast< VoidType* >( type2 );
    393393        }
     
    615615                        } else if ( tupleParam ) {
    616616                                // bundle other parameters into tuple to match
    617                                 TupleType* binder = new TupleType{ paramTy->get_qualifiers() };
     617                                std::list< Type * > binderTypes;
    618618
    619619                                do {
    620                                         binder->get_types().push_back( otherParam->get_type()->clone() );
     620                                        binderTypes.push_back( otherParam->get_type()->clone() );
    621621                                        ++jt;
    622622
     
    627627                                } while (true);
    628628
    629                                 otherParamTy = binder;
     629                                otherParamTy = new TupleType{ paramTy->get_qualifiers(), binderTypes };
    630630                                ++it;  // skip ttype parameter for break
    631631                        } else if ( otherTupleParam ) {
    632632                                // bundle parameters into tuple to match other
    633                                 TupleType* binder = new TupleType{ otherParamTy->get_qualifiers() };
     633                                std::list< Type * > binderTypes;
    634634
    635635                                do {
    636                                         binder->get_types().push_back( param->get_type()->clone() );
     636                                        binderTypes.push_back( param->get_type()->clone() );
    637637                                        ++it;
    638638
     
    643643                                } while (true);
    644644
    645                                 paramTy = binder;
     645                                paramTy = new TupleType{ otherParamTy->get_qualifiers(), binderTypes };
    646646                                ++jt;  // skip ttype parameter for break
    647647                        }
     
    692692
    693693        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 ) {
    695695                auto get_type = [](Type * t) { return t; };
    696696                for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
     
    742742                        flatten( flat2.get(), back_inserter( types2 ) );
    743743
    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 ) {
    749749                result = dynamic_cast< VarArgsType* >( type2 );
    750750        }
    751751
    752         void Unify::visit(ZeroType *zeroType) {
     752        void Unify::visit( __attribute__((unused)) ZeroType *zeroType ) {
    753753                result = dynamic_cast< ZeroType* >( type2 );
    754754        }
    755755
    756         void Unify::visit(OneType *oneType) {
     756        void Unify::visit( __attribute__((unused)) OneType *oneType ) {
    757757                result = dynamic_cast< OneType* >( type2 );
    758758        }
     
    765765                        return function->get_returnVals().front()->get_type()->clone();
    766766                } else {
    767                         TupleType * tupleType = new TupleType( Type::Qualifiers() );
     767                        std::list< Type * > types;
    768768                        for ( DeclarationWithType * decl : function->get_returnVals() ) {
    769                                 tupleType->get_types().push_back( decl->get_type()->clone() );
     769                                types.push_back( decl->get_type()->clone() );
    770770                        } // for
    771                         return tupleType;
     771                        return new TupleType( Type::Qualifiers(), types );
    772772                }
    773773        }
  • src/ResolvExpr/module.mk

    r9c951e3 rb1e63ac5  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    3131       ResolvExpr/PolyCost.cc \
    3232       ResolvExpr/Occurs.cc \
    33        ResolvExpr/TypeEnvironment.cc
     33       ResolvExpr/TypeEnvironment.cc \
     34       ResolvExpr/CurrentObject.cc
  • src/ResolvExpr/typeops.h

    r9c951e3 rb1e63ac5  
    118118
    119119        // in Unify.cc
    120         bool isFtype( Type *type, const SymTab::Indexer &indexer );
     120        bool isFtype( Type *type );
    121121        bool typesCompatible( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    122122        bool typesCompatibleIgnoreQualifiers( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
     
    130130                TypeEnvironment env;
    131131                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                         } // if
    142                 }
    143                 return ( i1 == c1.end() ) && ( i2 == c2.end() );
    144132        }
    145133
  • src/SymTab/Autogen.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 03 15:45:56 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:41:08 2017
    13 // Update Count     : 60
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:30:00 2017
     13// Update Count     : 61
    1414//
    1515
     
    263263        // E ?=?(E volatile*, int),
    264264        //   ?=?(E _Atomic volatile*, int);
    265         void makeEnumFunctions( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
     265        void makeEnumFunctions( EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
    266266
    267267                // T ?=?(E *, E);
     
    401401        /// generates struct constructors, destructor, and assignment functions
    402402        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
    403409                // Make function polymorphic in same parameters as generic struct, if applicable
    404410                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
     
    487493
    488494        /// generates the body of a union assignment/copy constructor/field constructor
    489         void makeUnionAssignBody( FunctionDecl * funcDecl, bool isDynamicLayout ) {
     495        void makeUnionAssignBody( FunctionDecl * funcDecl ) {
    490496                FunctionType * ftype = funcDecl->get_functionType();
    491497                assert( ftype->get_parameters().size() == 2 );
     
    507513                // Make function polymorphic in same parameters as generic union, if applicable
    508514                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               
    511516                // default ctor/dtor need only first parameter
    512517                // void ?{}(T *); void ^?{}(T *);
     
    534539                FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting );
    535540
    536                 makeUnionAssignBody( assignDecl, isDynamicLayout );
     541                makeUnionAssignBody( assignDecl );
    537542
    538543                // body of assignment and copy ctor is the same
    539                 makeUnionAssignBody( copyCtorDecl, isDynamicLayout );
     544                makeUnionAssignBody( copyCtorDecl );
    540545
    541546                // create a constructor which takes the first member type as a parameter.
     
    552557                                FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting );
    553558
    554                                 makeUnionAssignBody( ctor, isDynamicLayout );
     559                                makeUnionAssignBody( ctor );
    555560                                memCtors.push_back( ctor );
    556561                                // only generate a ctor for the first field
     
    579584                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
    580585                        // enumInst->set_baseEnum( enumDecl );
    581                         makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter );
     586                        makeEnumFunctions( enumInst, functionNesting, declsToAddAfter );
    582587                }
    583588        }
  • src/SymTab/Autogen.h

    r9c951e3 rb1e63ac5  
    1010// Created On       : Sun May 17 21:53:34 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:10:41 2017
    13 // Update Count     : 9
     12// Last Modified On : Wed Jun 21 17:25:26 2017
     13// Update Count     : 14
    1414//
    1515
     
    4343        template< typename OutputIterator >
    4444        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 ) );
    4848
    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 );
    6665
    67                 Statement * listInit = srcParam.buildListInit( fExpr );
     66        Statement * listInit = srcParam.buildListInit( fExpr );
    6867
    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 );
    7170
    72                 *out++ = new ExprStmt( noLabels, fExpr );
     71        *out++ = new ExprStmt( noLabels, fExpr );
    7372
    74                 srcParam.clearArrayIndices();
     73        srcParam.clearArrayIndices();
    7574
    76                 return listInit;
     75        return listInit;
    7776        }
    7877
     
    8887                Expression * begin, * end, * update, * cmp;
    8988                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 ) );
    9291                        end = array->get_dimension()->clone();
    9392                        cmp = new NameExpr( "?<?" );
     
    9796                        begin = new UntypedExpr( new NameExpr( "?-?" ) );
    9897                        ((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 ) );
    101100                        cmp = new NameExpr( "?>=?" );
    102101                        update = new NameExpr( "--?" );
    103102                }
    104103
    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 ) );
    106105
    107106                UntypedExpr *cond = new UntypedExpr( cmp );
  • src/SymTab/FixFunction.cc

    r9c951e3 rb1e63ac5  
    2424
    2525        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() );
    2727                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() );
    2830                delete functionDecl;
    2931                return pointer;
  • src/SymTab/ImplementationType.cc

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ImplementationType.cc -- 
     7// ImplementationType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    6161        }
    6262
    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 ) {}
    6865
    6966        void ImplementationType::visit(PointerType *pointerType) {
     
    7976        }
    8077
    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 ) {}
    10283
    10384        void ImplementationType::visit(TypeInstType *inst) {
     
    11192
    11293        void ImplementationType::visit(TupleType *tupleType) {
    113                 TupleType *newType = new TupleType( Type::Qualifiers() );
     94                std::list< Type * > types;
    11495                for ( std::list< Type* >::iterator i = tupleType->get_types().begin(); i != tupleType->get_types().end(); ++i ) {
    11596                        Type *implType = implementationType( *i, indexer );
    11697                        implType->get_qualifiers() |= tupleType->get_qualifiers();
    117                         newType->get_types().push_back( implType );
     98                        types.push_back( implType );
    11899                } // for
    119                 result = newType;
     100                result = new TupleType( Type::Qualifiers(), types );
    120101        }
    121102
    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 ) {}
    130106} // namespace SymTab
    131107
  • src/SymTab/Indexer.cc

    r9c951e3 rb1e63ac5  
    124124                        };
    125125                        // 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
    130131                        std::list< DeclBall > decls;
    131132
     
    138139                                bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() );
    139140                                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);
    144146                                return *this;
    145147                        }
     
    164166                }
    165167
    166                 // if a type contains user defined ctor/dtors, then special rules trigger, which determine
    167                 // the set of ctor/dtors that are seen by the requester. In particular, if the user defines
     168                // 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
    168170                // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor
    169171                // 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).
    171174                for ( std::pair< const std::string, ValueType > & pair : funcMap ) {
    172175                        ValueType & val = pair.second;
    173176                        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 ) {
    175183                                        // decl conforms to the rules described above, so it should be seen by the requester
    176184                                        out.push_back( ball.decl );
     
    278286                addType( typeDecl );
    279287                acceptAll( typeDecl->get_assertions(), *this );
     288                acceptNewScope( typeDecl->get_init(), *this );
    280289        }
    281290
     
    487496        }
    488497
    489         void Indexer::visit( UntypedValofExpr *valofExpr ) {
    490                 acceptNewScope( valofExpr->get_result(), *this );
    491                 maybeAccept( valofExpr->get_body(), *this );
    492         }
    493 
    494498        void Indexer::visit( RangeExpr *rangeExpr ) {
    495499                maybeAccept( rangeExpr->get_low(), *this );
     
    510514                acceptNewScope( tupleExpr->get_result(), *this );
    511515                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 );
    518516        }
    519517
  • src/SymTab/Indexer.h

    r9c951e3 rb1e63ac5  
    6969                virtual void visit( ConstructorExpr * ctorExpr );
    7070                virtual void visit( CompoundLiteralExpr *compLitExpr );
    71                 virtual void visit( UntypedValofExpr *valofExpr );
    7271                virtual void visit( RangeExpr *rangeExpr );
    7372                virtual void visit( UntypedTupleExpr *tupleExpr );
    7473                virtual void visit( TupleExpr *tupleExpr );
    7574                virtual void visit( TupleIndexExpr *tupleExpr );
    76                 virtual void visit( MemberTupleExpr *tupleExpr );
    7775                virtual void visit( TupleAssignExpr *tupleExpr );
    7876                virtual void visit( StmtExpr * stmtExpr );
  • src/SymTab/Mangler.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:40:01 2017
    13 // Update Count     : 20
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:31:00 2017
     13// Update Count     : 21
    1414//
    1515
     
    7272                        } else {
    7373                                // if we add another kind of overridable function, this has to change
    74                                 assert( false );
     74                                assert( false && "unknown overrideable linkage" );
    7575                        } // if
    7676                }
     
    236236        }
    237237
    238         void Mangler::visit( ZeroType *zeroType ) {
     238        void Mangler::visit( __attribute__((unused)) ZeroType *zeroType ) {
    239239                mangleName << "Z";
    240240        }
    241241
    242         void Mangler::visit( OneType *oneType ) {
     242        void Mangler::visit( __attribute__((unused)) OneType *oneType ) {
    243243                mangleName << "O";
    244244        }
  • src/SymTab/Validate.cc

    r9c951e3 rb1e63ac5  
    3838//   definition occurs later in the input.
    3939
     40#include <algorithm>
     41#include <iterator>
    4042#include <list>
    41 #include <iterator>
     43
     44#include "CodeGen/CodeGenerator.h"
     45
     46#include "Common/PassVisitor.h"
    4247#include "Common/ScopedMap.h"
     48#include "Common/UniqueName.h"
    4349#include "Common/utility.h"
    44 #include "Common/UniqueName.h"
     50
    4551#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"
    5459#include "FixFunction.h"
    5560// #include "ImplementationType.h"
    56 #include "GenPoly/DeclMutator.h"
    57 #include "AddVisit.h"
     61#include "Indexer.h"
    5862#include "MakeLibCfa.h"
    5963#include "TypeEquality.h"
    60 #include "Autogen.h"
     64#include "Validate.h"
     65
    6166#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"
    6575
    6676#define debugPrint( x ) if ( doDebug ) { std::cout << x; }
     
    96106
    97107        /// 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 {
    103109                static void fix( std::list< Declaration * > &translationUnit );
    104110
    105                 virtual void visit( FunctionDecl * functionDecl );
    106                 virtual void visit( FunctionType * ftype );
     111                void postvisit( FunctionDecl * functionDecl );
     112                void postvisit( FunctionType * ftype );
    107113        };
    108114
    109115        /// 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 );
    114119        };
    115120
     
    119124          public:
    120125                LinkReferenceToTypes( bool doDebug, const Indexer *indexer );
    121           private:
    122126                using Parent::visit;
    123127                void visit( EnumInstType *enumInst ) final;
     
    129133                void visit( UnionDecl *unionDecl ) final;
    130134                void visit( TypeInstType *typeInst ) final;
    131 
     135          private:
    132136                const Indexer *indexer;
    133137
     
    140144        };
    141145
    142         /// Replaces array and function types in forall lists by appropriate pointer type
    143         class Pass3 final : 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 {
    144148                typedef Indexer Parent;
    145149          public:
    146150                using Parent::visit;
    147                 Pass3( const Indexer *indexer );
    148           private:
     151                ForallPointerDecay( const Indexer *indexer );
     152
    149153                virtual void visit( ObjectDecl *object ) override;
    150154                virtual void visit( FunctionDecl *func ) override;
     
    153157        };
    154158
    155         class ReturnChecker : public Visitor {
    156           public:
     159        struct ReturnChecker : public WithGuards {
    157160                /// Checks that return statements return nothing if their return type is void
    158161                /// and return something if the return type is non-void.
    159162                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;
    165169        };
    166170
     
    198202        };
    199203
    200         class VerifyCtorDtorAssign : public Visitor {
    201         public:
     204        struct VerifyCtorDtorAssign {
    202205                /// ensure that constructors, destructors, and assignment have at least one
    203206                /// parameter, the first of which must be a pointer, and that ctor/dtors have no
     
    205208                static void verify( std::list< Declaration * > &translationUnit );
    206209
    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 {
    212220                /// for array types without an explicit length, compute the length and store it so that it
    213221                /// is known to the rest of the phases. For example,
     
    219227                static void computeLength( std::list< Declaration * > & translationUnit );
    220228
    221                 virtual void visit( 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> {
    225233                Type::StorageClasses storageClasses;
    226234
    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 );
    230237        };
    231238
    232239        void validate( std::list< Declaration * > &translationUnit, bool doDebug ) {
    233                 EnumAndPointerDecayPass epc;
     240                PassVisitor<EnumAndPointerDecay> epc;
    234241                LinkReferenceToTypes lrt( doDebug, 0 );
    235                 Pass3 pass3( 0 );
    236                 CompoundLiteral compoundliteral;
    237 
    238                 HoistStruct::hoistStruct( translationUnit );
     242                ForallPointerDecay fpd( 0 );
     243                PassVisitor<CompoundLiteral> compoundliteral;
     244                PassVisitor<ValidateGenericParameters> genericParams;
     245
    239246                EliminateTypedef::eliminateTypedef( translationUnit );
     247                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    240248                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    241249                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
    242251                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist
    243252                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    244253                Concurrency::applyKeywords( translationUnit );
    245                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass
     254                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    246255                Concurrency::implementMutexFuncs( translationUnit );
    247256                Concurrency::implementThreadStarter( translationUnit );
    248257                ReturnChecker::checkFunctionReturns( translationUnit );
    249                 compoundliteral.mutateDeclarationList( translationUnit );
    250                 acceptAll( translationUnit, pass3 );
     258                mutateAll( translationUnit, compoundliteral );
     259                acceptAll( translationUnit, fpd );
    251260                ArrayLength::computeLength( translationUnit );
    252261        }
    253262
    254263        void validateType( Type *type, const Indexer *indexer ) {
    255                 EnumAndPointerDecayPass epc;
     264                PassVisitor<EnumAndPointerDecay> epc;
    256265                LinkReferenceToTypes lrt( false, indexer );
    257                 Pass3 pass3( indexer );
     266                ForallPointerDecay fpd( indexer );
    258267                type->accept( epc );
    259268                type->accept( lrt );
    260                 type->accept( pass3 );
     269                type->accept( fpd );
    261270        }
    262271
     
    337346        }
    338347
    339         void EnumAndPointerDecayPass::visit( EnumDecl *enumDecl ) {
     348        void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) {
    340349                // Set the type of each member of the enumeration to be EnumConstant
    341350                for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
     
    344353                        obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) );
    345354                } // for
    346                 Parent::visit( enumDecl );
    347355        }
    348356
     
    351359                void fixFunctionList( DWTList & dwts, FunctionType * func ) {
    352360                        // 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 class
     361                        // entirely. other fix ups are handled by the FixFunction class
    354362                        typedef typename DWTList::iterator DWTIterator;
    355363                        DWTIterator begin( dwts.begin() ), end( dwts.end() );
     
    370378                                for ( ; i != end; ++i ) {
    371379                                        FixFunction fixer;
    372                                         *i = (*i )->acceptMutator( fixer );
     380                                        *i = (*i)->acceptMutator( fixer );
    373381                                        if ( fixer.get_isVoid() ) {
    374382                                                throw SemanticError( "invalid type void in function type ", func );
     
    379387        }
    380388
    381         void EnumAndPointerDecayPass::visit( FunctionType *func ) {
     389        void EnumAndPointerDecay::previsit( FunctionType *func ) {
    382390                // Fix up parameters and return types
    383391                fixFunctionList( func->get_parameters(), func );
    384392                fixFunctionList( func->get_returnVals(), func );
    385                 Visitor::visit( func );
    386393        }
    387394
     
    496503        void LinkReferenceToTypes::visit( StructDecl *structDecl ) {
    497504                // 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)
    498506                Parent::visit( structDecl );
    499507                if ( ! structDecl->get_members().empty() ) {
     
    529537        }
    530538
    531         Pass3::Pass3( const Indexer *other_indexer ) :  Indexer( false ) {
     539        ForallPointerDecay::ForallPointerDecay( const Indexer *other_indexer ) :  Indexer( false ) {
    532540                if ( other_indexer ) {
    533541                        indexer = other_indexer;
     
    567575        }
    568576
    569         void Pass3::visit( ObjectDecl *object ) {
     577        void ForallPointerDecay::visit( ObjectDecl *object ) {
    570578                forallFixer( object->get_type() );
    571579                if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) {
     
    576584        }
    577585
    578         void Pass3::visit( FunctionDecl *func ) {
     586        void ForallPointerDecay::visit( FunctionDecl *func ) {
    579587                forallFixer( func->get_type() );
    580588                Parent::visit( func );
     
    583591
    584592        void ReturnChecker::checkFunctionReturns( std::list< Declaration * > & translationUnit ) {
    585                 ReturnChecker checker;
     593                PassVisitor<ReturnChecker> checker;
    586594                acceptAll( translationUnit, checker );
    587595        }
    588596
    589         void ReturnChecker::visit( FunctionDecl * functionDecl ) {
    590                 std::list< DeclarationWithType * > oldReturnVals = returnVals;
     597        void ReturnChecker::previsit( FunctionDecl * functionDecl ) {
     598                GuardValue( returnVals );
    591599                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 ) {
    597603                // Previously this also checked for the existence of an expr paired with no return values on
    598604                // the  function return type. This is incorrect, since you can have an expression attached to
     
    804810
    805811        void VerifyCtorDtorAssign::verify( std::list< Declaration * > & translationUnit ) {
    806                 VerifyCtorDtorAssign verifier;
     812                PassVisitor<VerifyCtorDtorAssign> verifier;
    807813                acceptAll( translationUnit, verifier );
    808814        }
    809815
    810         void VerifyCtorDtorAssign::visit( FunctionDecl * funcDecl ) {
     816        void VerifyCtorDtorAssign::previsit( FunctionDecl * funcDecl ) {
    811817                FunctionType * funcType = funcDecl->get_functionType();
    812818                std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals();
     
    826832                        }
    827833                }
    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 ) {
    833880                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 ) {
    839884                // transform [storage_class] ... (struct S){ 3, ... };
    840885                // into [storage_class] struct S temp =  { 3, ... };
    841886                static UniqueName indexName( "_compLit" );
    842887
    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 );
    846891                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 );
    850894        }
    851895
    852896        void ReturnTypeFixer::fix( std::list< Declaration * > &translationUnit ) {
    853                 ReturnTypeFixer fixer;
     897                PassVisitor<ReturnTypeFixer> fixer;
    854898                acceptAll( translationUnit, fixer );
    855899        }
    856900
    857         void ReturnTypeFixer::visit( FunctionDecl * functionDecl ) {
    858                 Parent::visit( functionDecl );
     901        void ReturnTypeFixer::postvisit( FunctionDecl * functionDecl ) {
    859902                FunctionType * ftype = functionDecl->get_functionType();
    860903                std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();
     
    867910                                ret->set_name( toString( "_retval_", CodeGen::genName( functionDecl ) ) );
    868911                        }
    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 ) {
    873917                // xxx - need to handle named return values - this information needs to be saved somehow
    874918                // so that resolution has access to the names.
     
    888932
    889933        void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) {
    890                 ArrayLength len;
     934                PassVisitor<ArrayLength> len;
    891935                acceptAll( translationUnit, len );
    892936        }
    893937
    894         void ArrayLength::visit( ObjectDecl * objDecl ) {
     938        void ArrayLength::previsit( ObjectDecl * objDecl ) {
    895939                if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
    896940                        if ( at->get_dimension() != nullptr ) return;
  • src/SynTree/AggregateDecl.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:56:39 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:49:07 2017
    13 // Update Count     : 20
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jun 27 15:30:00 2017
     13// Update Count     : 21
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Attribute.h

    r9c951e3 rb1e63ac5  
    4040};
    4141
     42const std::list< Attribute * > noAttributes;
     43
    4244#endif
    4345
  • src/SynTree/BaseSyntaxNode.h

    r9c951e3 rb1e63ac5  
    2424        CodeLocation location;
    2525
    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;
    2729};
    2830
  • src/SynTree/Constant.cc

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Constant.cc -- 
     7// Constant.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 30 15:18:38 2015
    13 // Update Count     : 12
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Jun 22 10:11:00 2017
     13// Update Count     : 28
    1414//
    1515
     
    2121#include "Type.h"
    2222
    23 Constant::Constant( Type *type_, std::string value_ ) : type( type_ ), value( value_ ) {}
     23Constant::Constant( Type * type, std::string rep, unsigned long long val ) : type( type ), rep( rep ), val( val ) {}
     24Constant::Constant( Type * type, std::string rep, double val ) : type( type ), rep( rep ), val( val ) {}
    2425
    25 Constant::Constant( const Constant &other ) {
     26Constant::Constant( const Constant &other ) : rep( other.rep ), val( other.val ) {
    2627        type = other.type->clone();
    27         value = other.value;
    2828}
    2929
    3030Constant::~Constant() { delete type; }
    3131
     32Constant Constant::from_bool( bool b ) {
     33        return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b );
     34}
     35
    3236Constant 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 );
    3438}
    3539
    3640Constant 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 );
    3842}
    3943
    4044Constant 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 );
    4246}
    4347
    44 Constant *Constant::clone() const { assert( false ); return 0; }
     48unsigned 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
     53double Constant::get_dval() const {
     54        assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     55        return val.dval;
     56}
    4557
    4658void Constant::print( std::ostream &os ) const {
    47         os << "(" << value;
     59        os << "(" << rep << " " << val.ival;
    4860        if ( type ) {
    4961                os << ": ";
  • src/SynTree/Constant.h

    r9c951e3 rb1e63ac5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Constant.h -- 
     7// Constant.h --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun 30 13:33:17 2016
    13 // Update Count     : 6
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Jun 22 10:13:00 2017
     13// Update Count     : 15
    1414//
    1515
     
    2323class Constant {
    2424  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 );
    2728        virtual ~Constant();
    2829
    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;
    3336
     37        /// generates a boolean constant of the given bool
     38        static Constant from_bool( bool b );
    3439        /// generates an integer constant of the given int
    3540        static Constant from_int( int i );
     
    3944        static Constant from_double( double d );
    4045
    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;
    4549  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;
    4858};
    4959
  • src/SynTree/Declaration.h

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 16:05:08 2017
    13 // Update Count     : 121
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jun 27 15:31:00 2017
     13// Update Count     : 122
    1414//
    1515
     
    194194        };
    195195
    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 );
    197197        TypeDecl( const TypeDecl &other );
     198        virtual ~TypeDecl();
    198199
    199200        Kind get_kind() const { return kind; }
     201
     202        Type * get_init() const { return init; }
     203        TypeDecl * set_init( Type * newValue ) { init = newValue; return this; }
    200204
    201205        bool isComplete() const { return kind == Any || sized; }
     
    209213        virtual void accept( Visitor &v ) { v.visit( this ); }
    210214        virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     215        virtual void print( std::ostream &os, int indent = 0 ) const;
     216
    211217  private:
    212218        Kind kind;
     219        Type * init;
    213220        bool sized;
    214221};
     
    231238        typedef Declaration Parent;
    232239  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 );
    234241        AggregateDecl( const AggregateDecl &other );
    235242        virtual ~AggregateDecl();
     
    259266        typedef AggregateDecl Parent;
    260267  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 ) {}
    262269        StructDecl( const StructDecl &other ) : Parent( other ) {}
    263270
     
    277284        typedef AggregateDecl Parent;
    278285  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 ) {}
    280287        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    281288
     
    290297        typedef AggregateDecl Parent;
    291298  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 ) {}
    293300        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    294301
  • src/SynTree/Expression.cc

    r9c951e3 rb1e63ac5  
    2121#include <iterator>
    2222
     23#include "Declaration.h"
     24#include "Expression.h"
     25#include "Initializer.h"
     26#include "Statement.h"
    2327#include "Type.h"
    24 #include "Initializer.h"
    25 #include "Expression.h"
    26 #include "Declaration.h"
    27 #include "Statement.h"
    2828#include "TypeSubstitution.h"
     29#include "VarExprReplacer.h"
     30
    2931#include "Common/utility.h"
     32#include "Common/PassVisitor.h"
     33
    3034#include "InitTweak/InitTweak.h"
    3135
     
    9296
    9397        Declaration *decl = get_var();
    94         // if ( decl != 0) decl->print(os, indent + 2);
    9598        if ( decl != 0) decl->printShort(os, indent + 2);
    9699        os << std::endl;
     
    287290        delete arg;
    288291}
    289 
    290 // CastExpr *CastExpr::clone() const { return 0; }
    291292
    292293void CastExpr::print( std::ostream &os, int indent ) const {
     
    355356}
    356357
    357 //// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned...
    358358MemberExpr::MemberExpr( const MemberExpr &other ) :
    359359                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
     
    361361
    362362MemberExpr::~MemberExpr() {
    363         // delete member;
     363        // don't delete the member declaration, since it points somewhere else in the tree
    364364        delete aggregate;
    365365}
     
    591591}
    592592
    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 
    603593RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    604594RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
     
    670660}
    671661
     662InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {}
     663InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {}
     664InitAlternative::~InitAlternative() {
     665        delete type;
     666        delete designation;
     667}
     668
     669UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {}
     670UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {}
     671UntypedInitExpr::~UntypedInitExpr() {
     672        delete expr;
     673}
     674
     675void 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
     687InitExpr::InitExpr( Expression * expr, Designation * designation ) : expr( expr ), designation( designation ) {
     688        set_result( expr->get_result()->clone() );
     689}
     690InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {}
     691InitExpr::~InitExpr() {
     692        delete expr;
     693        delete designation;
     694}
     695
     696void 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
    672704std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    673705        if ( expr ) {
  • src/SynTree/Expression.h

    r9c951e3 rb1e63ac5  
    226226};
    227227
    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.
    229230class MemberExpr : public Expression {
    230231  public:
     
    247248};
    248249
    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.
    250252class VariableExpr : public Expression {
    251253  public:
     
    598600};
    599601
    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 
    618602/// RangeExpr represents a range e.g. '3 ... 5' or '1~10'
    619603class RangeExpr : public Expression {
     
    688672        Expression * tuple;
    689673        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 analyzer
    693 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;
    711674};
    712675
     
    781744};
    782745
     746struct InitAlternative {
     747public:
     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
     756class UntypedInitExpr : public Expression {
     757public:
     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;
     771private:
     772        Expression * expr;
     773        std::list<InitAlternative> initAlts;
     774};
     775
     776class InitExpr : public Expression {
     777public:
     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;
     792private:
     793        Expression * expr;
     794        Designation * designation;
     795};
     796
     797
    783798std::ostream & operator<<( std::ostream & out, const Expression * expr );
    784799
  • src/SynTree/Initializer.cc

    r9c951e3 rb1e63ac5  
    1919#include "Common/utility.h"
    2020
     21Designation::Designation( const std::list< Expression * > & designators ) : designators( designators ) {}
     22Designation::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
     28Designation::~Designation() {
     29        // std::cerr << "destroying designation" << std::endl;
     30        deleteAll( designators );
     31        // std::cerr << "finished destroying designation" << std::endl;
     32}
     33
     34void 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
    2145Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {}
    2246Initializer::Initializer( const Initializer & other ) : BaseSyntaxNode( other ), maybeConstructed( other.maybeConstructed ) {
    2347}
    24 
    25 
    2648Initializer::~Initializer() {}
    2749
    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 ) {
     50SingleInit::SingleInit( Expression *v, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ) {
    3851}
    3952
    4053SingleInit::SingleInit( const SingleInit &other ) : Initializer(other), value ( maybeClone( other.value ) ) {
    41         cloneAll(other.designators, designators );
    4254}
    4355
    4456SingleInit::~SingleInit() {
    4557        delete value;
    46         deleteAll(designators);
    4758}
    4859
    49 void SingleInit::print( std::ostream &os, int indent ) {
    50         os << std::endl << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
     60void SingleInit::print( std::ostream &os, int indent ) const {
     61        os << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
    5162        os << std::string(indent+4, ' ' );
    5263        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         } // if
    6164}
    6265
    63 ListInit::ListInit( const std::list<Initializer*> &_initializers, const std::list<Expression *> &_designators, bool maybeConstructed )
    64         : Initializer( maybeConstructed ), initializers( _initializers ), designators( _designators ) {
     66
     67ListInit::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() );
    6577}
    6678
    6779ListInit::ListInit( const ListInit & other ) : Initializer( other ) {
    6880        cloneAll( other.initializers, initializers );
    69         cloneAll( other.designators, designators );
     81        cloneAll( other.designations, designations );
    7082}
    71 
    7283
    7384ListInit::~ListInit() {
    7485        deleteAll( initializers );
    75         deleteAll( designators );
     86        deleteAll( designations );
    7687}
    7788
    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
     89void 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        }
    8694
    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        }
    9299}
    93100
     
    103110}
    104111
    105 void ConstructorInit::print( std::ostream &os, int indent ) {
     112void ConstructorInit::print( std::ostream &os, int indent ) const {
    106113        os << std::endl << std::string(indent, ' ') << "Constructor initializer: " << std::endl;
    107114        if ( ctor ) {
     
    124131}
    125132
    126 std::ostream & operator<<( std::ostream & out, Initializer * init ) {
    127         init->print( out );
     133std::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
     142std::ostream & operator<<( std::ostream & out, const Designation * des ) {
     143        if ( des ) {
     144                des->print( out );
     145        } else {
     146                out << "nullptr";
     147        }
    128148        return out;
    129149}
  • src/SynTree/Initializer.h

    r9c951e3 rb1e63ac5  
    2525#include "Visitor.h"
    2626
    27 const std::list<Expression*> noDesignators;
     27// Designation: list of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an object being initialized.
     28class Designation : public BaseSyntaxNode {
     29public:
     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;
     40private:
     41        std::list< Expression * > designators;
     42};
     43
     44const std::list<Designation *> noDesignators;
    2845
    2946// Initializer: base class for object initializers (provide default values)
    3047class Initializer : public BaseSyntaxNode {
    3148  public:
    32         //      Initializer( std::string _name = std::string(""), int _pos = 0 );
    3349        Initializer( bool maybeConstructed );
    3450        Initializer( const Initializer & other );
    3551        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 reached
    48         }
    4952
    5053        bool get_maybeConstructed() { return maybeConstructed; }
     
    5356        virtual void accept( Visitor &v ) = 0;
    5457        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;
    5659  private:
    57         //      std::string name;
    58         //      int pos;
    5960        bool maybeConstructed;
    6061};
     
    6364class SingleInit : public Initializer {
    6465  public:
    65         SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );
     66        SingleInit( Expression *value, bool maybeConstructed = false );
    6667        SingleInit( const SingleInit &other );
    6768        virtual ~SingleInit();
     
    7071        void set_value( Expression *newValue ) { value = newValue; }
    7172
    72         std::list<Expression *> &get_designators() { return designators; }
    73         void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }
    74 
    7573        virtual SingleInit *clone() const { return new SingleInit( *this); }
    7674        virtual void accept( Visitor &v ) { v.visit( this ); }
    7775        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;
    7977  private:
    8078        //Constant *value;
    8179        Expression *value;      // has to be a compile-time constant
    82         std::list< Expression * > designators;
    8380};
    8481
     
    8885  public:
    8986        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 );
    9188        ListInit( const ListInit & other );
    9289        virtual ~ListInit();
    9390
    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; }
    9893
    9994        typedef std::list<Initializer*>::iterator iterator;
     95        typedef std::list<Initializer*>::const_iterator const_iterator;
    10096        iterator begin() { return initializers.begin(); }
    10197        iterator end() { return initializers.end(); }
     98        const_iterator begin() const { return initializers.begin(); }
     99        const_iterator end() const { return initializers.end(); }
    102100
    103101        virtual ListInit *clone() const { return new ListInit( *this ); }
    104102        virtual void accept( Visitor &v ) { v.visit( this ); }
    105103        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;
    107105  private:
    108         std::list<Initializer*> initializers;  // order *is* important
    109         std::list<Expression *> designators;
     106        std::list<Initializer *> initializers;  // order *is* important
     107        std::list<Designation *> designations;  // order/length is consistent with initializers
    110108};
    111109
     
    130128        virtual void accept( Visitor &v ) { v.visit( this ); }
    131129        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;
    133131
    134132  private:
     
    140138};
    141139
    142 std::ostream & operator<<( std::ostream & out, Initializer * init );
     140std::ostream & operator<<( std::ostream & out, const Initializer * init );
     141std::ostream & operator<<( std::ostream & out, const Designation * des );
    143142
    144143#endif // INITIALIZER_H
  • src/SynTree/Mutator.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:45:19 2017
    13 // Update Count     : 22
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun 22 13:43:00 2017
     13// Update Count     : 24
    1414//
    1515
     
    7777TypeDecl *Mutator::mutate( TypeDecl *typeDecl ) {
    7878        handleNamedTypeDecl( typeDecl );
     79        typeDecl->set_init( maybeMutate( typeDecl->get_init(), *this ) );
    7980        return typeDecl;
    8081}
     
    152153}
    153154
     155Statement *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
    154161Statement *Mutator::mutate( TryStmt *tryStmt ) {
    155162        tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
    156163        mutateAll( tryStmt->get_catchers(), *this );
     164        tryStmt->set_finally( maybeMutate( tryStmt->get_finally(), *this ) );
    157165        return tryStmt;
    158166}
     
    160168Statement *Mutator::mutate( CatchStmt *catchStmt ) {
    161169        catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
     170        catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) );
    162171        catchStmt->set_body( maybeMutate( catchStmt->get_body(), *this ) );
    163172        return catchStmt;
     
    373382}
    374383
    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 
    381384Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
    382385        rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) );
     
    404407        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    405408        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 ) );
    414409        return tupleExpr;
    415410}
     
    438433}
    439434
     435Expression *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
     443Expression *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
    440451
    441452Type *Mutator::mutate( VoidType *voidType ) {
     
    510521        mutateAll( tupleType->get_forall(), *this );
    511522        mutateAll( tupleType->get_types(), *this );
     523        mutateAll( tupleType->get_members(), *this );
    512524        return tupleType;
    513525}
     
    546558
    547559
     560Designation *Mutator::mutate( Designation * designation ) {
     561        mutateAll( designation->get_designators(), *this );
     562        return designation;
     563}
     564
    548565Initializer *Mutator::mutate( SingleInit *singleInit ) {
    549566        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
     
    552569
    553570Initializer *Mutator::mutate( ListInit *listInit ) {
    554         mutateAll( listInit->get_designators(), *this );
     571        mutateAll( listInit->get_designations(), *this );
    555572        mutateAll( listInit->get_initializers(), *this );
    556573        return listInit;
  • src/SynTree/Mutator.h

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  9 14:23:23 2017
    13 // Update Count     : 13
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun  8 15:45:00 2017
     13// Update Count     : 14
    1414//
    1515#include <cassert>
     
    4646        virtual Statement* mutate( BranchStmt *branchStmt );
    4747        virtual Statement* mutate( ReturnStmt *returnStmt );
    48         virtual Statement* mutate( TryStmt *returnStmt );
     48        virtual Statement* mutate( ThrowStmt *throwStmt );
     49        virtual Statement* mutate( TryStmt *tryStmt );
    4950        virtual Statement* mutate( CatchStmt *catchStmt );
    5051        virtual Statement* mutate( FinallyStmt *catchStmt );
     
    7778        virtual Expression* mutate( ConstructorExpr *ctorExpr );
    7879        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
    79         virtual Expression* mutate( UntypedValofExpr *valofExpr );
    8080        virtual Expression* mutate( RangeExpr *rangeExpr );
    8181        virtual Expression* mutate( UntypedTupleExpr *tupleExpr );
    8282        virtual Expression* mutate( TupleExpr *tupleExpr );
    8383        virtual Expression* mutate( TupleIndexExpr *tupleExpr );
    84         virtual Expression* mutate( MemberTupleExpr *tupleExpr );
    8584        virtual Expression* mutate( TupleAssignExpr *assignExpr );
    8685        virtual Expression* mutate( StmtExpr * stmtExpr );
    8786        virtual Expression* mutate( UniqueExpr * uniqueExpr );
     87        virtual Expression* mutate( UntypedInitExpr * initExpr );
     88        virtual Expression* mutate( InitExpr * initExpr );
    8889
    8990        virtual Type* mutate( VoidType *basicType );
     
    105106        virtual Type* mutate( OneType *oneType );
    106107
     108        virtual Designation* mutate( Designation *designation );
    107109        virtual Initializer* mutate( SingleInit *singleInit );
    108110        virtual Initializer* mutate( ListInit *listInit );
  • src/SynTree/ObjectDecl.cc

    r9c951e3 rb1e63ac5  
    5656
    5757        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, ' ');
    6161                os << "maybeConstructed? " << init->get_maybeConstructed();
    6262        } // if
  • src/SynTree/Statement.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 12 13:58:48 2016
    13 // Update Count     : 62
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 10:37:00 2017
     13// Update Count     : 64
    1414//
    1515
     
    3030Statement::Statement( std::list<Label> _labels ) : labels( _labels ) {}
    3131
    32 void Statement::print( std::ostream &, int indent ) const {}
     32void Statement::print( __attribute__((unused)) std::ostream &, __attribute__((unused)) int indent ) const {}
    3333
    3434Statement::~Statement() {}
     
    101101}
    102102
    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 ) {}
     103ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr ) : Statement( labels ), expr( _expr ) {}
     104
     105ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
    106106
    107107ReturnStmt::~ReturnStmt() {
     
    110110
    111111void ReturnStmt::print( std::ostream &os, int indent ) const {
    112         os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";
     112        os <<  "Return Statement, returning: ";
    113113        if ( expr != 0 ) {
    114114                os << endl << string( indent+2, ' ' );
     
    287287}
    288288
    289 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &_handlers, FinallyStmt *_finallyBlock ) :
     289ThrowStmt::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
     294ThrowStmt::ThrowStmt( const ThrowStmt &other ) :
     295        Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) {
     296}
     297
     298ThrowStmt::~ThrowStmt() {
     299        delete expr;
     300        delete target;
     301}
     302
     303void 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
     315TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &_handlers, FinallyStmt *_finallyBlock ) :
    290316        Statement( labels ), block( tryBlock ),  handlers( _handlers ), finallyBlock( _finallyBlock ) {
    291317}
     
    308334        // handlers
    309335        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++)
    311337                (*i )->print( os, indent + 4 );
    312338
     
    318344}
    319345
    320 CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool catchAny ) :
    321         Statement( labels ), decl ( _decl ), body( _body ), catchRest ( catchAny ) {
     346CatchStmt::CatchStmt( std::list<Label> labels, Kind _kind, Declaration *_decl, Expression *_cond, Statement *_body ) :
     347        Statement( labels ), kind ( _kind ), decl ( _decl ), cond ( _cond ), body( _body ) {
    322348}
    323349
    324350CatchStmt::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 ) ) {
    326352}
    327353
     
    332358
    333359void CatchStmt::print( std::ostream &os, int indent ) const {
    334         os << "Catch Statement" << endl;
     360        os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
    335361
    336362        os << string( indent, ' ' ) << "... catching" << endl;
     
    338364                decl->printShort( os, indent + 4 );
    339365                os << endl;
    340         } else if ( catchRest )
    341                 os << string( indent + 4 , ' ' ) << "the rest" << endl;
     366        }
    342367        else
    343368                os << string( indent + 4 , ' ' ) << ">>> Error:  this catch clause must have a declaration <<<" << endl;
     
    365390NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {}
    366391
    367 void NullStmt::print( std::ostream &os, int indent ) const {
     392void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const {
    368393        os << "Null Statement" << endl ;
    369394}
  • src/SynTree/Statement.h

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 12 13:57:46 2016
    13 // Update Count     : 65
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 13:35:00 2017
     13// Update Count     : 67
    1414//
    1515
     
    5757  private:
    5858        std::list<Statement*> kids;
     59};
     60
     61class 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:
    5972};
    6073
     
    261274class ReturnStmt : public Statement {
    262275  public:
    263         ReturnStmt( std::list<Label> labels, Expression *expr, bool throwP = false );
     276        ReturnStmt( std::list<Label> labels, Expression *expr );
    264277        ReturnStmt( const ReturnStmt &other );
    265278        virtual ~ReturnStmt();
     
    274287  private:
    275288        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
     291class 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;
    291313};
    292314
    293315class TryStmt : public Statement {
    294316  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 );
    296318        TryStmt( const TryStmt &other );
    297319        virtual ~TryStmt();
     
    299321        CompoundStmt *get_block() const { return block; }
    300322        void set_block( CompoundStmt *newValue ) { block = newValue; }
    301         std::list<Statement *>& get_catchers() { return handlers; }
     323        std::list<CatchStmt *>& get_catchers() { return handlers; }
    302324
    303325        FinallyStmt *get_finally() const { return finallyBlock; }
     
    311333  private:
    312334        CompoundStmt *block;
    313         std::list<Statement *> handlers;
     335        std::list<CatchStmt *> handlers;
    314336        FinallyStmt *finallyBlock;
    315337};
     
    317339class CatchStmt : public Statement {
    318340  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 );
    320345        CatchStmt( const CatchStmt &other );
    321346        virtual ~CatchStmt();
    322347
     348        Kind get_kind() { return kind; }
    323349        Declaration *get_decl() { return decl; }
    324350        void set_decl( Declaration *newValue ) { decl = newValue; }
    325 
     351        Expression *get_cond() { return cond; }
     352        void set_cond( Expression *newCond ) { cond = newCond; }
    326353        Statement *get_body() { return body; }
    327354        void set_body( Statement *newValue ) { body = newValue; }
     
    333360
    334361  private:
     362        Kind kind;
    335363        Declaration *decl;
     364        Expression *cond;
    336365        Statement *body;
    337         bool catchRest;
    338366};
    339367
  • src/SynTree/SynTree.h

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  9 14:23:49 2017
    13 // Update Count     : 8
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun  8 17:00:00 2017
     13// Update Count     : 9
    1414//
    1515
     
    5151class BranchStmt;
    5252class ReturnStmt;
     53class ThrowStmt;
    5354class TryStmt;
    5455class CatchStmt;
     
    8990class TupleExpr;
    9091class TupleIndexExpr;
    91 class MemberTupleExpr;
    9292class TupleAssignExpr;
    9393class StmtExpr;
    9494class UniqueExpr;
     95class UntypedInitExpr;
     96class InitExpr;
    9597
    9698class Type;
     
    114116class OneType;
    115117
     118class Designation;
    116119class Initializer;
    117120class SingleInit;
  • src/SynTree/TupleExpr.cc

    r9c951e3 rb1e63ac5  
    7878}
    7979
    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 
    10280TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ) {
    10381        // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments
  • src/SynTree/TupleType.cc

    r9c951e3 rb1e63ac5  
    1414//
    1515
     16#include "Declaration.h"
     17#include "Initializer.h"
    1618#include "Type.h"
    1719#include "Common/utility.h"
     20#include "Parser/LinkageSpec.h"
    1821
    1922TupleType::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        }
    2033}
    2134
    2235TupleType::TupleType( const TupleType& other ) : Type( other ) {
    2336        cloneAll( other.types, types );
     37        cloneAll( other.members, members );
    2438}
    2539
    2640TupleType::~TupleType() {
    2741        deleteAll( types );
     42        deleteAll( members );
    2843}
    2944
  • src/SynTree/Type.h

    r9c951e3 rb1e63ac5  
    307307private:
    308308        Type *base;
    309         unsigned int level = 0;
    310309};
    311310
     
    354353        virtual void print( std::ostream & os, int indent = 0 ) const;
    355354
    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 {}
    357356  protected:
    358357        virtual std::string typeString() const = 0;
     
    501500class TupleType : public Type {
    502501  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 * >()  );
    504503        TupleType( const TupleType& );
    505504        virtual ~TupleType();
     
    508507        typedef value_type::iterator iterator;
    509508
    510         std::list<Type*>& get_types() { return types; }
     509        std::list<Type *> & get_types() { return types; }
    511510        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; }
    512515
    513516        iterator begin() { return types.begin(); }
     
    526529        virtual void print( std::ostream & os, int indent = 0 ) const;
    527530  private:
    528         std::list<Type*> types;
     531        std::list<Type *> types;
     532        std::list<Declaration *> members;
    529533};
    530534
  • src/SynTree/TypeDecl.cc

    r9c951e3 rb1e63ac5  
    1818#include "Common/utility.h"
    1919
    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 ) {
     20TypeDecl::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 ) {
    2121}
    2222
    23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), sized( other.sized ) {
     23TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), init( maybeClone( other.init ) ), sized( other.sized ) {
     24}
     25
     26TypeDecl::~TypeDecl() {
     27  delete init;
    2428}
    2529
     
    3438}
    3539
     40void 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
    3649std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) {
    3750  return os << data.kind << ", " << data.isComplete;
  • src/SynTree/TypeSubstitution.cc

    r9c951e3 rb1e63ac5  
    166166                        boundVars.insert( (*tyvar )->get_name() );
    167167                } // for
    168         } // if
    169         // bind type variables from generic type instantiations
    170         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                 } // for
     168                // 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
    175175        } // if
    176176        Type *ret = Mutator::mutate( type );
  • src/SynTree/VarExprReplacer.cc

    r9c951e3 rb1e63ac5  
    1414//
    1515
     16#include "Declaration.h"
    1617#include "Expression.h"
    1718#include "VarExprReplacer.h"
    1819
    19 VarExprReplacer::VarExprReplacer( const DeclMap & declMap ) : declMap( declMap ) {}
     20VarExprReplacer::VarExprReplacer( const DeclMap & declMap, bool debug ) : declMap( declMap ), debug( debug ) {}
    2021
    2122// replace variable with new node from decl map
    2223void 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        }
    2731}
  • src/SynTree/VarExprReplacer.h

    r9c951e3 rb1e63ac5  
    2727private:
    2828        const DeclMap & declMap;
     29  bool debug;
    2930public:
    30         VarExprReplacer( const DeclMap & declMap );
     31        VarExprReplacer( const DeclMap & declMap, bool debug = false );
    3132
    3233        // replace variable with new node from decl map
  • src/SynTree/Visitor.cc

    r9c951e3 rb1e63ac5  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:45:25 2017
    13 // Update Count     : 24
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jun 22 13:41:00 2017
     13// Update Count     : 26
    1414//
    1515
     
    6767void Visitor::visit( TypeDecl *typeDecl ) {
    6868        handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );
     69        maybeAccept( typeDecl->get_init(), *this );
    6970}
    7071
     
    121122}
    122123
    123 void Visitor::visit( BranchStmt *branchStmt ) {
     124void Visitor::visit( __attribute__((unused)) BranchStmt *branchStmt ) {
    124125}
    125126
    126127void Visitor::visit( ReturnStmt *returnStmt ) {
    127128        maybeAccept( returnStmt->get_expr(), *this );
     129}
     130
     131void Visitor::visit( ThrowStmt * throwStmt ) {
     132        maybeAccept( throwStmt->get_expr(), *this );
     133        maybeAccept( throwStmt->get_target(), *this );
    128134}
    129135
     
    131137        maybeAccept( tryStmt->get_block(), *this );
    132138        acceptAll( tryStmt->get_catchers(), *this );
     139        maybeAccept( tryStmt->get_finally(), *this );
    133140}
    134141
    135142void Visitor::visit( CatchStmt *catchStmt ) {
    136143        maybeAccept( catchStmt->get_decl(), *this );
     144        maybeAccept( catchStmt->get_cond(), *this );
    137145        maybeAccept( catchStmt->get_body(), *this );
    138146}
     
    142150}
    143151
    144 void Visitor::visit( NullStmt *nullStmt ) {
     152void Visitor::visit( __attribute__((unused)) NullStmt *nullStmt ) {
    145153}
    146154
     
    295303}
    296304
    297 void Visitor::visit( UntypedValofExpr *valofExpr ) {
    298         maybeAccept( valofExpr->get_result(), *this );
    299         maybeAccept( valofExpr->get_body(), *this );
    300 }
    301 
    302305void Visitor::visit( RangeExpr *rangeExpr ) {
    303306        maybeAccept( rangeExpr->get_low(), *this );
     
    318321        maybeAccept( tupleExpr->get_result(), *this );
    319322        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 );
    326323}
    327324
     
    343340}
    344341
     342void 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
     348void Visitor::visit( InitExpr * initExpr ) {
     349        maybeAccept( initExpr->get_result(), *this );
     350        maybeAccept( initExpr->get_expr(), *this );
     351        maybeAccept( initExpr->get_designation(), *this );
     352}
     353
    345354
    346355void Visitor::visit( VoidType *voidType ) {
     
    404413        acceptAll( tupleType->get_forall(), *this );
    405414        acceptAll( tupleType->get_types(), *this );
     415        acceptAll( tupleType->get_members(), *this );
    406416}
    407417
     
    433443}
    434444
     445void Visitor::visit( Designation * designation ) {
     446        acceptAll( designation->get_designators(), *this );
     447}
    435448
    436449void Visitor::visit( SingleInit *singleInit ) {
     
    439452
    440453void Visitor::visit( ListInit *listInit ) {
    441         acceptAll( listInit->get_designators(), *this );
     454        acceptAll( listInit->get_designations(), *this );
    442455        acceptAll( listInit->get_initializers(), *this );
    443456}
     
    450463
    451464
    452 void Visitor::visit( Subrange *subrange ) {}
    453 
    454 
    455 void Visitor::visit( Constant *constant ) {}
     465void Visitor::visit( __attribute__((unused)) Subrange *subrange ) {}
     466
     467
     468void Visitor::visit( __attribute__((unused)) Constant *constant ) {}
    456469// Local Variables: //
    457470// tab-width: 4 //
  • src/SynTree/Visitor.h

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May  3 08:58:00 2017
    13 // Update Count     : 10
     12// Last Modified On : Thr Jun 08 15:45:00 2017
     13// Update Count     : 11
    1414//
    1515
     
    4949        virtual void visit( BranchStmt *branchStmt );
    5050        virtual void visit( ReturnStmt *returnStmt );
     51        virtual void visit( ThrowStmt *throwStmt );
    5152        virtual void visit( TryStmt *tryStmt );
    5253        virtual void visit( CatchStmt *catchStmt );
     
    8081        virtual void visit( ConstructorExpr * ctorExpr );
    8182        virtual void visit( CompoundLiteralExpr *compLitExpr );
    82         virtual void visit( UntypedValofExpr *valofExpr );
    8383        virtual void visit( RangeExpr *rangeExpr );
    8484        virtual void visit( UntypedTupleExpr *tupleExpr );
    8585        virtual void visit( TupleExpr *tupleExpr );
    8686        virtual void visit( TupleIndexExpr *tupleExpr );
    87         virtual void visit( MemberTupleExpr *tupleExpr );
    8887        virtual void visit( TupleAssignExpr *assignExpr );
    8988        virtual void visit( StmtExpr * stmtExpr );
    9089        virtual void visit( UniqueExpr * uniqueExpr );
     90        virtual void visit( UntypedInitExpr * initExpr );
     91        virtual void visit( InitExpr * initExpr );
    9192
    9293        virtual void visit( VoidType *basicType );
     
    108109        virtual void visit( OneType *oneType );
    109110
     111        virtual void visit( Designation *designation );
    110112        virtual void visit( SingleInit *singleInit );
    111113        virtual void visit( ListInit *listInit );
  • src/SynTree/ZeroOneType.cc

    r9c951e3 rb1e63ac5  
    2020ZeroType::ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2121
    22 void ZeroType::print( std::ostream &os, int indent ) const {
     22void ZeroType::print( std::ostream &os, __attribute__((unused)) int indent ) const {
    2323        os << "zero_t";
    2424}
     
    2828OneType::OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2929
    30 void OneType::print( std::ostream &os, int indent ) const {
     30void OneType::print( std::ostream &os, __attribute__((unused)) int indent ) const {
    3131        os << "one_t";
    3232}
  • src/Tuples/TupleExpansion.cc

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:05:17 2017
    13 // Update Count     : 15
     12// Last Modified On : Wed Jun 21 17:35:04 2017
     13// Update Count     : 19
    1414//
    1515
     
    1818#include <cassert>
    1919#include "Tuples.h"
     20#include "Common/PassVisitor.h"
     21#include "Common/ScopedMap.h"
    2022#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"
    2130#include "SynTree/Mutator.h"
    2231#include "SynTree/Statement.h"
    23 #include "SynTree/Declaration.h"
    2432#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"
    3233
    3334namespace Tuples {
     
    8283                };
    8384
    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 );
    9088                };
    9189
     
    116114                replacer.mutateDeclarationList( translationUnit );
    117115
    118                 TupleIndexExpander idxExpander;
     116                PassVisitor<TupleIndexExpander> idxExpander;
    119117                mutateAll( translationUnit, idxExpander );
    120118
     
    193191                                commaExpr->set_arg1( nullptr );
    194192                        }
    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 ) ) ) );
    197195                        addDeclaration( finished );
    198196                        // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N))
    199197                        // 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 ) ) );
    201199                        ConditionalExpr * condExpr = new ConditionalExpr( new VariableExpr( finished ), var->clone(),
    202200                                new CommaExpr( new CommaExpr( assignUnq, assignFinished ), var->clone() ) );
     
    250248        }
    251249
    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();
    254252                assert( tuple );
    255253                tupleExpr->set_tuple( nullptr );
     
    312310        Type * makeTupleType( const std::list< Expression * > & exprs ) {
    313311                // 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 );
    316314                for ( Expression * expr : exprs ) {
    317315                        assert( expr->get_result() );
    318316                        if ( expr->get_result()->isVoid() ) {
    319317                                // if the type of any expr is void, the type of the entire tuple is void
    320                                 delete tupleType;
    321318                                return new VoidType( Type::Qualifiers() );
    322319                        }
    323320                        Type * type = expr->get_result()->clone();
    324                         tupleType->get_types().push_back( type );
     321                        types.push_back( type );
    325322                        // the qualifiers on the tuple type are the qualifiers that exist on all component types
    326323                        qualifiers &= type->get_qualifiers();
    327324                } // for
    328325                if ( exprs.empty() ) qualifiers = Type::Qualifiers();
    329                 return tupleType;
     326                return new TupleType( qualifiers, types );
    330327        }
    331328
    332329        TypeInstType * isTtype( Type * type ) {
    333330                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 ) {
    335332                                return inst;
    336333                        }
     
    356353                                maybeImpure = true;
    357354                        }
    358                         virtual void visit( UntypedExpr * untypedExpr ) { maybeImpure = true; }
     355                        virtual void visit( __attribute__((unused)) UntypedExpr * untypedExpr ) { maybeImpure = true; }
    359356                        bool maybeImpure = false;
    360357                };
  • src/driver/Makefile.am

    r9c951e3 rb1e63ac5  
    1616
    1717# applies to both programs
    18 AM_CXXFLAGS = -Wall -O2
     18AM_CXXFLAGS = -Wall -O2 -g -std=c++14
    1919if BUILD_NO_LIB
    2020else
  • src/driver/Makefile.in

    r9c951e3 rb1e63ac5  
    208208
    209209# applies to both programs
    210 AM_CXXFLAGS = -Wall -O2 $(am__append_1) $(am__append_2) \
     210AM_CXXFLAGS = -Wall -O2 -g -std=c++14 $(am__append_1) $(am__append_2) \
    211211        $(am__append_3)
    212212cfa_SOURCES = cfa.cc
  • src/driver/cc1.cc

    r9c951e3 rb1e63ac5  
    8484
    8585
    86 void sigTermHandler( int signal ) {
     86void sigTermHandler( __attribute__((unused)) int signal ) {
    8787        if ( tmpfilefd != -1 ) {                                                        // RACE, file created ?
    8888                rmtmpfile();                                                                    // remove
     
    469469
    470470
    471 int main( const int argc, const char * const argv[], const char * const env[] ) {
     471int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    472472#ifdef __DEBUG_H__
    473473        for ( int i = 0; env[i] != NULL; i += 1 ) {
  • src/driver/cfa.cc

    r9c951e3 rb1e63ac5  
    271271                args[nargs] = "-ldl";
    272272                nargs += 1;
     273                args[nargs] = "-lrt";
     274                nargs += 1;
    273275                args[nargs] = "-Xlinker";
    274276                nargs += 1;
  • src/libcfa/Makefile.am

    r9c951e3 rb1e63ac5  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:54:01 2015
    12 ## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sun May 14 21:04:21 2017
    14 ## Update Count     : 214
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jun 28 15:36:00 2017
     14## Update Count     : 215
    1515###############################################################################
    1616
     
    4141CC = ${abs_top_srcdir}/src/driver/cfa
    4242
    43 headers = limits stdlib math iostream fstream iterator rational assert containers/pair containers/vector
     43headers = assert fstream iostream iterator limits math rational stdlib \
     44          containers/maybe containers/pair containers/result containers/vector
    4445
    4546# not all platforms support concurrency, add option do disable it
     
    5354# not all platforms support concurrency, add option do disable it
    5455if BUILD_CONCURRENCY
    55 libsrc += concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     56libsrc += concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c
    5657endif
    5758
     
    6364        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6465
     66libcfa_a-exception.o : exception.c
     67        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     68
    6569concurrency/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
     72libcfa_d_a-exception.o : exception.c
    6673        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    6774
     
    7178libcfa_a_CFLAGS = -nodebug -O2
    7279libcfa_d_a_SOURCES = ${libsrc}
    73 libcfa_d_a_CFLAGS = -debug -O0
     80libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
    7481
    7582stdhdr = ${shell echo stdhdr/*}
  • src/libcfa/Makefile.in

    r9c951e3 rb1e63ac5  
    4646
    4747# not all platforms support concurrency, add option do disable it
    48 @BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     48@BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c
    4949subdir = src/libcfa
    5050DIST_COMMON = $(am__nobase_cfa_include_HEADERS_DIST) \
     
    9898libcfa_d_a_LIBADD =
    9999am__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
    106107am__dirstamp = $(am__leading_dot)dirstamp
    107108@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    109110@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_d_a-kernel.$(OBJEXT) \
    110111@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) \
     112am__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) \
    116118        containers/libcfa_d_a-pair.$(OBJEXT) \
     119        containers/libcfa_d_a-result.$(OBJEXT) \
    117120        containers/libcfa_d_a-vector.$(OBJEXT) $(am__objects_1)
    118121@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)
    120125am__objects_4 = libcfa_d_a-libcfa-prelude.$(OBJEXT) \
    121126        libcfa_d_a-interpose.$(OBJEXT) \
     
    127132libcfa_a_LIBADD =
    128133am__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
    135141@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    136142@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
    137143@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-kernel.$(OBJEXT) \
    138144@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) \
     145am__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) \
    143150        containers/libcfa_a-pair.$(OBJEXT) \
     151        containers/libcfa_a-result.$(OBJEXT) \
    144152        containers/libcfa_a-vector.$(OBJEXT) $(am__objects_5)
    145153@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)
    147157am__objects_8 = libcfa_a-libcfa-prelude.$(OBJEXT) \
    148158        libcfa_a-interpose.$(OBJEXT) \
     
    179189DIST_SOURCES = $(am__libcfa_d_a_SOURCES_DIST) \
    180190        $(am__libcfa_a_SOURCES_DIST)
    181 am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \
    182         fstream iterator rational assert containers/pair \
    183         containers/vector concurrency/coroutine concurrency/thread \
    184         concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \
    185         gmp concurrency/invoke.h
     191am__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
    186196HEADERS = $(nobase_cfa_include_HEADERS)
    187197ETAGS = etags
     
    313323EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@
    314324AM_CCASFLAGS = @CFA_FLAGS@
    315 headers = limits stdlib math iostream fstream iterator rational assert \
    316         containers/pair containers/vector $(am__append_3)
     325headers = assert fstream iostream iterator limits math rational stdlib \
     326        containers/maybe containers/pair containers/result \
     327        containers/vector $(am__append_3)
    317328libobjs = ${headers:=.o}
    318329libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     
    321332libcfa_a_CFLAGS = -nodebug -O2
    322333libcfa_d_a_SOURCES = ${libsrc}
    323 libcfa_d_a_CFLAGS = -debug -O0
     334libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
    324335stdhdr = ${shell echo stdhdr/*}
    325336cfa_includedir = $(CFA_INCDIR)
     
    404415        @$(MKDIR_P) containers/$(DEPDIR)
    405416        @: > containers/$(DEPDIR)/$(am__dirstamp)
     417containers/libcfa_d_a-maybe.$(OBJEXT): containers/$(am__dirstamp) \
     418        containers/$(DEPDIR)/$(am__dirstamp)
    406419containers/libcfa_d_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     420        containers/$(DEPDIR)/$(am__dirstamp)
     421containers/libcfa_d_a-result.$(OBJEXT): containers/$(am__dirstamp) \
    407422        containers/$(DEPDIR)/$(am__dirstamp)
    408423containers/libcfa_d_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
     
    426441        concurrency/$(am__dirstamp) \
    427442        concurrency/$(DEPDIR)/$(am__dirstamp)
     443concurrency/libcfa_d_a-alarm.$(OBJEXT): concurrency/$(am__dirstamp) \
     444        concurrency/$(DEPDIR)/$(am__dirstamp)
    428445concurrency/libcfa_d_a-invoke.$(OBJEXT): concurrency/$(am__dirstamp) \
     446        concurrency/$(DEPDIR)/$(am__dirstamp)
     447concurrency/libcfa_d_a-preemption.$(OBJEXT):  \
     448        concurrency/$(am__dirstamp) \
    429449        concurrency/$(DEPDIR)/$(am__dirstamp)
    430450libcfa-d.a: $(libcfa_d_a_OBJECTS) $(libcfa_d_a_DEPENDENCIES) $(EXTRA_libcfa_d_a_DEPENDENCIES)
     
    434454libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \
    435455        libhdr/$(DEPDIR)/$(am__dirstamp)
     456containers/libcfa_a-maybe.$(OBJEXT): containers/$(am__dirstamp) \
     457        containers/$(DEPDIR)/$(am__dirstamp)
    436458containers/libcfa_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     459        containers/$(DEPDIR)/$(am__dirstamp)
     460containers/libcfa_a-result.$(OBJEXT): containers/$(am__dirstamp) \
    437461        containers/$(DEPDIR)/$(am__dirstamp)
    438462containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
     
    446470concurrency/libcfa_a-monitor.$(OBJEXT): concurrency/$(am__dirstamp) \
    447471        concurrency/$(DEPDIR)/$(am__dirstamp)
     472concurrency/libcfa_a-alarm.$(OBJEXT): concurrency/$(am__dirstamp) \
     473        concurrency/$(DEPDIR)/$(am__dirstamp)
    448474concurrency/libcfa_a-invoke.$(OBJEXT): concurrency/$(am__dirstamp) \
     475        concurrency/$(DEPDIR)/$(am__dirstamp)
     476concurrency/libcfa_a-preemption.$(OBJEXT):  \
     477        concurrency/$(am__dirstamp) \
    449478        concurrency/$(DEPDIR)/$(am__dirstamp)
    450479libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES)
     
    456485        -rm -f *.$(OBJEXT)
    457486        -rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT)
     487        -rm -f concurrency/libcfa_a-alarm.$(OBJEXT)
    458488        -rm -f concurrency/libcfa_a-coroutine.$(OBJEXT)
    459489        -rm -f concurrency/libcfa_a-invoke.$(OBJEXT)
    460490        -rm -f concurrency/libcfa_a-kernel.$(OBJEXT)
    461491        -rm -f concurrency/libcfa_a-monitor.$(OBJEXT)
     492        -rm -f concurrency/libcfa_a-preemption.$(OBJEXT)
    462493        -rm -f concurrency/libcfa_a-thread.$(OBJEXT)
     494        -rm -f concurrency/libcfa_d_a-alarm.$(OBJEXT)
    463495        -rm -f concurrency/libcfa_d_a-coroutine.$(OBJEXT)
    464496        -rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT)
    465497        -rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT)
    466498        -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
     499        -rm -f concurrency/libcfa_d_a-preemption.$(OBJEXT)
    467500        -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
     501        -rm -f containers/libcfa_a-maybe.$(OBJEXT)
    468502        -rm -f containers/libcfa_a-pair.$(OBJEXT)
     503        -rm -f containers/libcfa_a-result.$(OBJEXT)
    469504        -rm -f containers/libcfa_a-vector.$(OBJEXT)
     505        -rm -f containers/libcfa_d_a-maybe.$(OBJEXT)
    470506        -rm -f containers/libcfa_d_a-pair.$(OBJEXT)
     507        -rm -f containers/libcfa_d_a-result.$(OBJEXT)
    471508        -rm -f containers/libcfa_d_a-vector.$(OBJEXT)
    472509        -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT)
     
    497534@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
    498535@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@
    499537@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutine.Po@am__quote@
    500538@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-invoke.Po@am__quote@
    501539@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-kernel.Po@am__quote@
    502540@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@
    503542@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@
    504544@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po@am__quote@
    505545@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-invoke.Po@am__quote@
    506546@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-kernel.Po@am__quote@
    507547@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@
    508549@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@
    509551@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@
    510553@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@
    511555@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@
    512557@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@
    513558@AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@
     
    581626@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`
    582627
     628libcfa_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
     635libcfa_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
     642libcfa_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
     649libcfa_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
     656libcfa_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
     663libcfa_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
     670libcfa_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
     677libcfa_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
    583684libcfa_d_a-limits.o: limits.c
    584685@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
     
    595696@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`
    596697
     698libcfa_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
     705libcfa_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
     712libcfa_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
     719libcfa_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
    597726libcfa_d_a-stdlib.o: stdlib.c
    598727@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
     
    609738@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`
    610739
    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`
     740containers/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
     747containers/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`
    694753
    695754containers/libcfa_d_a-pair.o: containers/pair.c
     
    707766@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`
    708767
     768containers/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
     775containers/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
    709782containers/libcfa_d_a-vector.o: containers/vector.c
    710783@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
     
    777850@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`
    778851
     852concurrency/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
     859concurrency/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
    779866concurrency/libcfa_d_a-invoke.obj: concurrency/invoke.c
    780867@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`
     
    784871@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`
    785872
     873concurrency/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
     880concurrency/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
    786887libcfa_a-libcfa-prelude.obj: libcfa-prelude.c
    787888@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`
     
    819920@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`
    820921
     922libcfa_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
     929libcfa_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
     936libcfa_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
     943libcfa_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
     950libcfa_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
     957libcfa_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
     964libcfa_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
     971libcfa_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
    821978libcfa_a-limits.o: limits.c
    822979@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
     
    833990@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`
    834991
     992libcfa_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
     999libcfa_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
     1006libcfa_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
     1013libcfa_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
    8351020libcfa_a-stdlib.o: stdlib.c
    8361021@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
     
    8471032@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`
    8481033
    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`
     1034containers/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
     1041containers/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`
    9321047
    9331048containers/libcfa_a-pair.o: containers/pair.c
     
    9451060@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`
    9461061
     1062containers/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
     1069containers/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
    9471076containers/libcfa_a-vector.o: containers/vector.c
    9481077@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
     
    10151144@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`
    10161145
     1146concurrency/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
     1153concurrency/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
    10171160concurrency/libcfa_a-invoke.obj: concurrency/invoke.c
    10181161@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`
     
    10211164@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    10221165@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
     1167concurrency/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
     1174concurrency/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`
    10231180install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS)
    10241181        @$(NORMAL_INSTALL)
     
    12711428        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    12721429
     1430libcfa_a-exception.o : exception.c
     1431        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     1432
    12731433concurrency/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
     1436libcfa_d_a-exception.o : exception.c
    12741437        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    12751438
  • src/libcfa/concurrency/coroutine

    r9c951e3 rb1e63ac5  
    7171// Suspend implementation inlined for performance
    7272static inline void suspend() {
    73       coroutine_desc * src = this_coroutine();          // optimization
     73        coroutine_desc * src = this_coroutine();                // optimization
    7474
    7575        assertf( src->last != 0,
     
    9191        coroutine_desc * dst = get_coroutine(cor);
    9292
    93       if( unlikely(!dst->stack.base) ) {
     93        if( unlikely(!dst->stack.base) ) {
    9494                create_stack(&dst->stack, dst->stack.size);
    9595                CtxStart(cor, CtxInvokeCoroutine);
    9696        }
    9797
    98       // not resuming self ?
     98        // not resuming self ?
    9999        if ( src != dst ) {
    100100                assertf( dst->state != Halted ,
     
    103103                        src->name, src, dst->name, dst );
    104104
    105             // set last resumer
     105                // set last resumer
    106106                dst->last = src;
    107107        } // if
    108108
    109       // always done for performance testing
     109        // always done for performance testing
    110110        CoroutineCtxSwitch( src, dst );
    111111}
     
    114114        coroutine_desc * src = this_coroutine();                // optimization
    115115
    116       // not resuming self ?
     116        // not resuming self ?
    117117        if ( src != dst ) {
    118118                assertf( dst->state != Halted ,
     
    121121                        src->name, src, dst->name, dst );
    122122
    123             // set last resumer
     123                // set last resumer
    124124                dst->last = src;
    125125        } // if
    126126
    127       // always done for performance testing
     127        // always done for performance testing
    128128        CoroutineCtxSwitch( src, dst );
    129129}
  • src/libcfa/concurrency/kernel

    r9c951e3 rb1e63ac5  
    2828//-----------------------------------------------------------------------------
    2929// Locks
     30bool try_lock( spinlock * );
    3031void lock( spinlock * );
    3132void unlock( spinlock * );
     
    8586
    8687        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;
    8795};
    8896
     
    94102
    95103// Local Variables: //
    96 // mode: c //
    97 // tab-width: 4 //
     104// mode: CFA //
     105// tab-width: 6 //
    98106// End: //
  • src/libcfa/concurrency/kernel.c

    r9c951e3 rb1e63ac5  
    3636//CFA Includes
    3737#include "libhdr.h"
     38#include "preemption.h"
    3839
    3940//Private includes
     
    4748KERNEL_STORAGE(processorCtx_t, systemProcessorCtx);
    4849KERNEL_STORAGE(cluster, systemCluster);
    49 KERNEL_STORAGE(processor, systemProcessor);
     50KERNEL_STORAGE(system_proc_t, systemProcessor);
    5051KERNEL_STORAGE(thread_desc, mainThread);
    5152KERNEL_STORAGE(machine_context_t, mainThread_context);
    5253
    5354cluster * systemCluster;
    54 processor * systemProcessor;
     55system_proc_t * systemProcessor;
    5556thread_desc * mainThread;
    5657
     
    118119// Processor coroutine
    119120void ?{}(processorCtx_t * this, processor * proc) {
    120         (&this->__cor){};
     121        (&this->__cor){ "Processor" };
    121122        this->proc = proc;
    122123        proc->runner = this;
     
    139140        (&this->terminated){};
    140141        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;
    141146
    142147        start( this );
     
    149154        (&this->terminated){};
    150155        this->is_terminated = false;
     156        this->disable_preempt_count = 0;
     157        this->pending_preemption = false;
    151158
    152159        this->runner = runner;
    153160        LIB_DEBUG_PRINT_SAFE("Kernel : constructing processor context %p\n", runner);
    154161        runner{ this };
     162}
     163
     164void ?{}(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 };
    155170}
    156171
     
    178193void main(processorCtx_t * runner) {
    179194        processor * this = runner->proc;
     195
    180196        LIB_DEBUG_PRINT_SAFE("Kernel : core %p starting\n", this);
    181197
    182         thread_desc * readyThread = NULL;
    183         for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )
    184198        {
    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++ )
    188206                {
    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
    203227        signal( &this->terminated );
    204228        LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this);
     
    287311        // appropriate stack.
    288312        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;
    291315
    292316        // Main routine of the core returned, the core is now fully terminated
     
    299323        LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this);
    300324       
    301         // pthread_attr_t attributes;
    302         // pthread_attr_init( &attributes );
    303 
    304325        pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this );
    305 
    306         // pthread_attr_destroy( &attributes );
    307326
    308327        LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);       
     
    314333        if( !thrd ) return;
    315334
    316         assertf( thrd->next == NULL, "Expected null got %p", thrd->next );
     335        verifyf( thrd->next == NULL, "Expected null got %p", thrd->next );
    317336       
    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 );
    321340}
    322341
     
    367386}
    368387
     388//=============================================================================================
     389// Kernel Setup logic
     390//=============================================================================================
    369391//-----------------------------------------------------------------------------
    370392// Kernel boot procedures
     
    379401        mainThread{ &info };
    380402
     403        LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n");
     404
     405        // Enable preemption
     406        kernel_start_preemption();
     407
    381408        // Initialize the system cluster
    382409        systemCluster = (cluster *)&systemCluster_storage;
    383410        systemCluster{};
    384411
     412        LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n");
     413
    385414        // Initialize the system processor and the system processor ctx
    386415        // (the coroutine that contains the processing control flow)
    387         systemProcessor = (processor *)&systemProcessor_storage;
     416        systemProcessor = (system_proc_t *)&systemProcessor_storage;
    388417        systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtx_storage };
    389418
    390419        // Add the main thread to the ready queue
    391         // once resume is called on systemProcessor->ctx the mainThread needs to be scheduled like any normal thread
     420        // once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread
    392421        ScheduleThread(mainThread);
    393422
    394423        //initialize the global state variables
    395         this_processor = systemProcessor;
     424        this_processor = &systemProcessor->proc;
    396425        this_processor->current_thread = mainThread;
    397426        this_processor->current_coroutine = &mainThread->cor;
     
    400429        // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that
    401430        // mainThread is on the ready queue when this call is made.
    402         resume(systemProcessor->runner);
     431        resume( systemProcessor->proc.runner );
    403432
    404433
     
    414443        // When its coroutine terminates, it return control to the mainThread
    415444        // which is currently here
    416         systemProcessor->is_terminated = true;
     445        systemProcessor->proc.is_terminated = true;
    417446        suspend();
    418447
     
    421450        // Destroy the system processor and its context in reverse order of construction
    422451        // These were manually constructed so we need manually destroy them
    423         ^(systemProcessor->runner){};
     452        ^(systemProcessor->proc.runner){};
    424453        ^(systemProcessor){};
    425454
     
    484513}
    485514
     515//=============================================================================================
     516// Kernel Utilities
     517//=============================================================================================
    486518//-----------------------------------------------------------------------------
    487519// Locks
     
    491523void ^?{}( spinlock * this ) {
    492524
     525}
     526
     527bool try_lock( spinlock * this ) {
     528        return this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0;
    493529}
    494530
     
    541577
    542578void append( __thread_queue_t * this, thread_desc * t ) {
    543         assert(this->tail != NULL);
     579        verify(this->tail != NULL);
    544580        *this->tail = t;
    545581        this->tail = &t->next;
     
    563599
    564600void push( __condition_stack_t * this, __condition_criterion_t * t ) {
    565         assert( !t->next );
     601        verify( !t->next );
    566602        t->next = this->top;
    567603        this->top = t;
  • src/libcfa/concurrency/kernel_private.h

    r9c951e3 rb1e63ac5  
    2121#include "thread"
    2222
     23#include "alarm.h"
     24
     25#include "libhdr.h"
     26
    2327//-----------------------------------------------------------------------------
    2428// Scheduler
     
    3539//-----------------------------------------------------------------------------
    3640// Processor
    37 struct processorCtx_t {
     41coroutine processorCtx_t {
    3842        processor * proc;
    39         coroutine_desc __cor;
    4043};
    41 
    42 DECL_COROUTINE(processorCtx_t);
    4344
    4445void main(processorCtx_t *);
     
    4748void finishRunning(processor * this);
    4849void spin(processor * this, unsigned int * spin_count);
     50
     51struct system_proc_t {
     52        processor proc;
     53
     54        alarm_list_t alarms;
     55        spinlock alarm_lock;
     56
     57        bool pending_alarm;
     58};
     59
     60extern cluster * systemCluster;
     61extern system_proc_t * systemProcessor;
     62extern thread_local processor * this_processor;
     63
     64static 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
     69static 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
     74static 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}
    4982
    5083//-----------------------------------------------------------------------------
  • src/libcfa/concurrency/monitor

    r9c951e3 rb1e63ac5  
    2626static inline void ?{}(monitor_desc * this) {
    2727        this->owner = NULL;
    28       this->stack_owner = NULL;
     28        this->stack_owner = NULL;
    2929        this->recursion = 0;
    3030}
     
    3333        monitor_desc ** m;
    3434        int count;
    35       monitor_desc ** prev_mntrs;
    36       unsigned short  prev_count;
     35        monitor_desc ** prev_mntrs;
     36        unsigned short  prev_count;
    3737};
    3838
     
    5959        unsigned short count;                           //Number of criterions in the criteria
    6060        __condition_node_t * next;                      //Intrusive linked list Next field
     61        uintptr_t user_info;                            //Custom user info accessible before signalling
    6162};
    6263
     
    8586}
    8687
    87 void wait( condition * this );
    88 void signal( condition * this );
     88void wait( condition * this, uintptr_t user_info = 0 );
     89bool signal( condition * this );
     90bool signal_block( condition * this );
     91static inline bool is_empty( condition * this ) { return !this->blocked.head; }
     92uintptr_t front( condition * this );
     93
     94struct __acceptable_t {
     95        void (*func)(void);
     96        unsigned short count;
     97        monitor_desc * monitors[1];
     98};
     99
     100void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) );
     101
    89102#endif //MONITOR_H
  • src/libcfa/concurrency/monitor.c

    r9c951e3 rb1e63ac5  
    5656                else if( this->owner == thrd) {
    5757                        //We already have the monitor, just not how many times we took it
    58                         assert( this->recursion > 0 );
     58                        verify( this->recursion > 0 );
    5959                        this->recursion += 1;
    6060                }
     
    6262                        //Some one else has the monitor, wait in line for it
    6363                        append( &this->entry_queue, thrd );
     64                        LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd);
    6465                        ScheduleInternal( &this->lock );
    6566
     
    7778                lock( &this->lock );
    7879
    79                 thread_desc * thrd = this_thread();
    80 
    8180                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 );
    8382
    8483                //Leaving a recursion level, decrement the counter
     
    9796                unlock( &this->lock );
    9897
     98                LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
     99
    99100                //We need to wake-up the thread
    100101                ScheduleThread( new_owner );
     
    134135}
    135136
    136 void debug_break() __attribute__(( noinline ))
    137 {
    138        
     137void ?{}(__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
     144void ?{}(__condition_criterion_t * this ) {
     145        this->ready  = false;
     146        this->target = NULL;
     147        this->owner  = NULL;
     148        this->next   = NULL;
     149}
     150
     151void ?{}(__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;
    139156}
    140157
    141158//-----------------------------------------------------------------------------
    142159// Internal scheduling
    143 void wait( condition * this ) {
     160void wait( condition * this, uintptr_t user_info = 0 ) {
    144161        LIB_DEBUG_PRINT_SAFE("Waiting\n");
    145162
     
    148165        //Check that everything is as expected
    149166        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 );
    151169
    152170        unsigned short count = this->monitor_count;
     
    156174        LIB_DEBUG_PRINT_SAFE("count %i\n", count);
    157175
    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 };
    162177
    163178        __condition_criterion_t criteria[count];
    164179        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 };
    169181                LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
    170182        }
     
    184196        }
    185197
    186         debug_break();
    187 
    188198        for( int i = 0; i < count; i++) {
    189199                thread_desc * new_owner = next_thread( this->monitors[i] );
    190200                thread_count = insert_unique( threads, thread_count, new_owner );
    191201        }
    192 
    193         debug_break();
    194202
    195203        LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     
    212220}
    213221
    214 void signal( condition * this ) {
    215         if( !this->blocked.head ) {
     222bool signal( condition * this ) {
     223        if( is_empty( this ) ) {
    216224                LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
    217                 return;
     225                return false;
    218226        }
    219227
    220228        //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 );
    223231
    224232        unsigned short count = this->monitor_count;
    225233       
     234        //Some more checking in debug
    226235        LIB_DEBUG_DO(
    227236                thread_desc * this_thrd = this_thread();
     
    237246        );
    238247
     248        //Lock all the monitors
    239249        lock_all( this->monitors, NULL, count );
    240250        LIB_DEBUG_PRINT_SAFE("Signalling");
    241251
     252        //Pop the head of the waiting queue
    242253        __condition_node_t * node = pop_head( &this->blocked );
     254
     255        //Add the thread to the proper AS stack
    243256        for(int i = 0; i < count; i++) {
    244257                __condition_criterion_t * crit = &node->criteria[i];
     
    250263        LIB_DEBUG_PRINT_SAFE("\n");
    251264
     265        //Release
    252266        unlock_all( this->monitors, count );
     267
     268        return true;
     269}
     270
     271bool 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
     326uintptr_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
     336void __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 );
    253360}
    254361
     
    335442
    336443        for(    int i = 0; i < count; i++ ) {
     444
    337445                LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
    338446                if( &criteria[i] == target ) {
     
    379487
    380488void append( __condition_blocked_queue_t * this, __condition_node_t * c ) {
    381         assert(this->tail != NULL);
     489        verify(this->tail != NULL);
    382490        *this->tail = c;
    383491        this->tail = &c->next;
  • src/libcfa/concurrency/thread

    r9c951e3 rb1e63ac5  
    8282
    8383void yield();
     84void yield( unsigned times );
    8485
    8586#endif //THREADS_H
  • src/libcfa/concurrency/thread.c

    r9c951e3 rb1e63ac5  
    8787}
    8888
     89void yield( unsigned times ) {
     90        for( unsigned i = 0; i < times; i++ ) {
     91                yield();
     92        }
     93}
     94
    8995void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    9096        // set state of current coroutine to inactive
  • src/libcfa/containers/vector

    r9c951e3 rb1e63ac5  
    2222
    2323//------------------------------------------------------------------------------
     24//Allocator
     25forall(otype T)
     26struct heap_allocator
     27{
     28        T* storage;
     29        size_t capacity;
     30};
     31
     32forall(otype T)
     33void ?{}(heap_allocator(T)* this);
     34
     35forall(otype T)
     36void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);
     37
     38forall(otype T)
     39heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);
     40
     41forall(otype T)
     42void ^?{}(heap_allocator(T)* this);
     43
     44forall(otype T)
     45void realloc_storage(heap_allocator(T)* this, size_t size);
     46
     47forall(otype T)
     48static inline T* data(heap_allocator(T)* this)
     49{
     50        return this->storage;
     51}
     52
     53//------------------------------------------------------------------------------
    2454//Declaration
    2555trait allocator_c(otype T, otype allocator_t)
     
    2959};
    3060
    31 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     61forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
    3262struct vector;
    3363
     
    4676void ^?{}(vector(T, allocator_t)* this);
    4777
    48 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     78forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
    4979struct vector
    5080{
     
    136166// }
    137167
    138 //------------------------------------------------------------------------------
    139 //Allocator
    140 forall(otype T)
    141 struct heap_allocator
    142 {
    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 
    168168#endif // VECTOR_H
    169169
  • src/libcfa/gmp

    r9c951e3 rb1e63ac5  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 14 23:47:36 2017
    13 // Update Count     : 9
     12// Last Modified On : Sat May 27 09:55:51 2017
     13// Update Count     : 14
    1414//
    1515
     
    2222
    2323// 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 ); }
     24static inline void ?{}( Int * this ) { mpz_init( this->mpz ); }
     25static inline void ?{}( Int * this, Int init ) { mpz_init_set( this->mpz, init.mpz ); }
     26static inline void ?{}( Int * this, zero_t ) { mpz_init_set_si( this->mpz, 0 ); }
     27static inline void ?{}( Int * this, one_t ) { mpz_init_set_si( this->mpz, 1 ); }
     28static inline void ?{}( Int * this, signed long int init ) { mpz_init_set_si( this->mpz, init ); }
     29static inline void ?{}( Int * this, unsigned long int init ) { mpz_init_set_ui( this->mpz, init ); }
     30static inline void ?{}( Int * this, const char * val ) { if ( mpz_init_set_str( this->mpz, val, 0 ) ) abort(); }
     31static inline void ^?{}( Int * this ) { mpz_clear( this->mpz ); }
    3232
    3333// 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 short 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; }
     34static inline Int ?=?( Int * lhs, Int rhs ) { mpz_set( lhs->mpz, rhs.mpz ); return *lhs; }
     35static inline Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; }
     36static inline Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; }
     37static inline Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; }
     38
     39static inline char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
     40static inline short int ?=?( short int * lhs, Int rhs ) { short int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
     41static inline int ?=?( int * lhs, Int rhs ) { int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
     42static inline long int ?=?( long int * lhs, Int rhs ) { long int val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
     43static inline unsigned char ?=?( unsigned char * lhs, Int rhs ) { unsigned char val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }
     44static inline unsigned short int ?=?( unsigned short int * lhs, Int rhs ) { unsigned short int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }
     45static inline unsigned int ?=?( unsigned int * lhs, Int rhs ) { unsigned int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }
     46static inline unsigned long int ?=?( unsigned long int * lhs, Int rhs ) { unsigned long int val = mpz_get_ui( rhs.mpz ); *lhs = val; return val; }
    4747
    4848// 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 ); }
     49static inline long int narrow( Int val ) { return mpz_get_si( val.mpz ); }
     50static inline unsigned long int narrow( Int val ) { return mpz_get_ui( val.mpz ); }
    5151
    5252// 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 ); }
     53static inline int ?==?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) == 0; }
     54static inline int ?==?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
     55static inline int ?==?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
     56static inline int ?==?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
     57static inline int ?==?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
     58
     59static inline int ?!=?( Int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
     60static inline int ?!=?( Int oper1, long int oper2 ) { return ! ( oper1 == oper2 ); }
     61static inline int ?!=?( long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
     62static inline int ?!=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 == oper2 ); }
     63static inline int ?!=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
     64
     65static inline int ?<?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) < 0; }
     66static inline int ?<?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
     67static inline int ?<?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
     68static inline int ?<?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
     69static inline int ?<?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
     70
     71static inline int ?<=?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) <= 0; }
     72static inline int ?<=?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
     73static inline int ?<=?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
     74static inline int ?<=?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
     75static inline int ?<=?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
     76
     77static inline int ?>?( Int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
     78static inline int ?>?( Int oper1, long int oper2 ) { return ! ( oper1 <= oper2 ); }
     79static inline int ?>?( long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
     80static inline int ?>?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 <= oper2 ); }
     81static inline int ?>?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
     82
     83static inline int ?>=?( Int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
     84static inline int ?>=?( Int oper1, long int oper2 ) { return ! ( oper1 < oper2 ); }
     85static inline int ?>=?( long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
     86static inline int ?>=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 < oper2 ); }
     87static inline int ?>=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
    8888
    8989// 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; }
     90static inline Int +?( Int oper ) { Int pos; mpz_set( pos.mpz, oper.mpz ); return pos; }
     91static inline Int -?( Int oper ) { Int neg; mpz_neg( neg.mpz, oper.mpz ); return neg; }
     92static inline Int ~?( Int oper ) { Int comp; mpz_com( comp.mpz, oper.mpz ); return comp; }
     93
     94static inline Int ?&?( Int oper1, Int oper2 ) { Int conjunction; mpz_and( conjunction.mpz, oper1.mpz, oper2.mpz ); return conjunction; }
     95static 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; }
     96static 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; }
     97static 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; }
     98static 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; }
     99static inline Int ?&=?( Int * lhs, Int rhs ) { return *lhs = *lhs & rhs; }
     100
     101static inline Int ?|?( Int oper1, Int oper2 ) { Int disjunction; mpz_ior( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
     102static 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; }
     103static 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; }
     104static 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; }
     105static 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; }
     106static inline Int ?|=?( Int * lhs, Int rhs ) { return *lhs = *lhs | rhs; }
     107
     108static inline Int ?^?( Int oper1, Int oper2 ) { Int disjunction; mpz_xor( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
     109static 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; }
     110static 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; }
     111static 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; }
     112static 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; }
     113static inline Int ?^=?( Int * lhs, Int rhs ) { return *lhs = *lhs ^ rhs; }
     114
     115static inline Int ?+?( Int addend1, Int addend2 ) { Int sum; mpz_add( sum.mpz, addend1.mpz, addend2.mpz ); return sum; }
     116static 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; }
     117static 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; }
     118static inline Int ?+?( Int addend1, unsigned long int addend2 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
     119static inline Int ?+?( unsigned long int addend2, Int addend1 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
     120static inline Int ?+=?( Int * lhs, Int rhs ) { return *lhs = *lhs + rhs; }
     121static inline Int ?+=?( Int * lhs, long int rhs ) { return *lhs = *lhs + rhs; }
     122static inline Int ?+=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs + rhs; }
     123static inline Int ++?( Int * lhs ) { return *lhs += 1; }
     124static inline Int ?++( Int * lhs ) { Int ret = *lhs; *lhs += 1; return ret; }
     125
     126static inline Int ?-?( Int minuend, Int subtrahend ) { Int diff; mpz_sub( diff.mpz, minuend.mpz, subtrahend.mpz ); return diff; }
     127static 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; }
     128static 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; }
     129static inline Int ?-?( Int minuend, unsigned long int subtrahend ) { Int diff; mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); return diff; }
     130static inline Int ?-?( unsigned long int minuend, Int subtrahend ) { Int diff; mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); return diff; }
     131static inline Int ?-=?( Int * lhs, Int rhs ) { return *lhs = *lhs - rhs; }
     132static inline Int ?-=?( Int * lhs, long int rhs ) { return *lhs = *lhs - rhs; }
     133static inline Int ?-=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs - rhs; }
     134static inline Int --?( Int * lhs ) { return *lhs -= 1; }
     135static inline Int ?--( Int * lhs ) { Int ret = *lhs; *lhs -= 1; return ret; }
     136
     137static inline Int ?*?( Int multiplicator, Int multiplicand ) { Int product; mpz_mul( product.mpz, multiplicator.mpz, multiplicand.mpz ); return product; }
     138static inline Int ?*?( Int multiplicator, long int multiplicand ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
     139static inline Int ?*?( long int multiplicand, Int multiplicator ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
     140static inline Int ?*?( Int multiplicator, unsigned long int multiplicand ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
     141static inline Int ?*?( unsigned long int multiplicand, Int multiplicator ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
     142static inline Int ?*=?( Int * lhs, Int rhs ) { return *lhs = *lhs * rhs; }
     143static inline Int ?*=?( Int * lhs, long int rhs ) { return *lhs = *lhs * rhs; }
     144static inline Int ?*=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs * rhs; }
    145145
    146146// 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 ) {
     147static inline Int ?/?( Int dividend, Int divisor ) { Int quotient; mpz_tdiv_q( quotient.mpz, dividend.mpz, divisor.mpz ); return quotient; }
     148static inline Int ?/?( Int dividend, unsigned long int divisor ) { Int quotient; mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor ); return quotient; }
     149static inline Int ?/?( unsigned long int dividend, Int divisor ) {
    150150        Int quotient;
    151151    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
     
    164164        return quotient;
    165165} // ?/?
    166 Int ?/?( Int dividend, long int divisor ) {
     166static inline Int ?/?( Int dividend, long int divisor ) {
    167167        Int quotient;
    168168    if ( divisor >= 0 )
     
    174174        return quotient;
    175175} // ?/?
    176 Int ?/?( long int dividend, Int divisor ) {
     176static inline Int ?/?( long int dividend, Int divisor ) {
    177177        Int quotient;
    178178    if ( mpz_fits_slong_p( divisor.mpz ) )
     
    185185        return quotient;
    186186} // ?/?
    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 ) {
     187static inline Int ?/=?( Int * lhs, Int rhs ) { return *lhs = *lhs / rhs; }
     188static inline Int ?/=?( Int * lhs, long int rhs ) { return *lhs = *lhs / rhs; }
     189static inline Int ?/=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs / rhs; }
     190
     191static 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 ]; }
     192static 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
     194static inline Int ?%?( Int dividend, Int divisor ) { Int remainder; mpz_tdiv_r( remainder.mpz, dividend.mpz, divisor.mpz ); return remainder; }
     195static inline Int ?%?( Int dividend, unsigned long int divisor ) { Int remainder; mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, divisor ); return remainder; }
     196static inline Int ?%?( unsigned long int dividend, Int divisor ) {
    197197        Int remainder;
    198198    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
     
    210210        return remainder;
    211211} // ?%?
    212 Int ?%?( Int dividend, long int divisor ) {
     212static inline Int ?%?( Int dividend, long int divisor ) {
    213213        Int remainder;
    214214    mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, (divisor >= 0 ? divisor : -divisor));
    215215        return remainder;
    216216} // ?%?
    217 Int ?%?( long int dividend, Int divisor ) {
     217static inline Int ?%?( long int dividend, Int divisor ) {
    218218        Int remainder;
    219219    if ( mpz_fits_slong_p( divisor.mpz ) )
     
    226226        return remainder;
    227227} // ?%?
    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; }
     228static inline Int ?%=?( Int * lhs, Int rhs ) { return *lhs = *lhs % rhs; }
     229static inline Int ?%=?( Int * lhs, long int rhs ) { return *lhs = *lhs % rhs; }
     230static inline Int ?%=?( Int * lhs, unsigned long int rhs ) { return *lhs = *lhs % rhs; }
     231
     232static inline Int ?<<?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_mul_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
     233static inline Int ?<<=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs << shift; }
     234static inline Int ?>>?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_fdiv_q_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
     235static inline Int ?>>=?( Int * lhs, mp_bitcnt_t shift ) { return *lhs = *lhs >> shift; }
    236236
    237237// 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; }
     238static inline Int abs( Int oper ) { Int positive; mpz_abs( positive.mpz, oper.mpz ); return positive; }
     239static inline Int fact( unsigned long int N ) { Int factorial; mpz_fac_ui( factorial.mpz, N ); return factorial; }
     240static inline Int gcd( Int oper1, Int oper2 ) { Int gcdret; mpz_gcd( gcdret.mpz, oper1.mpz, oper2.mpz ); return gcdret; }
     241static inline Int pow( Int base, unsigned long int exponent ) { Int power; mpz_pow_ui( power.mpz, base.mpz, exponent ); return power; }
     242static inline Int pow( unsigned long int base, unsigned long int exponent ) { Int power; mpz_ui_pow_ui( power.mpz, base, exponent ); return power; }
     243static inline void srandom( gmp_randstate_t state ) { gmp_randinit_default( state ); }
     244static inline Int random( gmp_randstate_t state, mp_bitcnt_t n ) { Int rand; mpz_urandomb( rand.mpz, state, n ); return rand; }
     245static inline Int random( gmp_randstate_t state, Int n ) { Int rand; mpz_urandomm( rand.mpz, state, n.mpz ); return rand; }
     246static inline Int random( gmp_randstate_t state, mp_size_t max_size ) { Int rand; mpz_random( rand.mpz, max_size ); return rand; }
     247static inline int sgn( Int oper ) { return mpz_sgn( oper.mpz ); }
     248static inline Int sqrt( Int oper ) { Int root; mpz_sqrt( root.mpz, oper.mpz ); return root; }
    249249
    250250// I/O
    251 forall( dtype istype | istream( istype ) )
     251static inline forall( dtype istype | istream( istype ) )
    252252istype * ?|?( istype * is, Int * mp ) {
    253253        gmp_scanf( "%Zd", mp );
     
    255255} // ?|?
    256256
    257 forall( dtype ostype | ostream( ostype ) )
     257static inline forall( dtype ostype | ostream( ostype ) )
    258258ostype * ?|?( ostype * os, Int mp ) {
    259259        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
  • src/libcfa/libhdr/libdebug.h

    r9c951e3 rb1e63ac5  
    1818
    1919#ifdef __CFA_DEBUG__
    20       #define LIB_DEBUG_DO(x) x
    21       #define LIB_NO_DEBUG_DO(x) ((void)0)
     20        #define LIB_DEBUG_DO(x) x
     21        #define LIB_NO_DEBUG_DO(x) ((void)0)
    2222#else
    23       #define LIB_DEBUG_DO(x) ((void)0)
    24       #define LIB_NO_DEBUG_DO(x) x     
     23        #define LIB_DEBUG_DO(x) ((void)0)
     24        #define LIB_NO_DEBUG_DO(x) x     
    2525#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
    2635
    2736#ifdef __cforall
  • src/libcfa/math

    r9c951e3 rb1e63ac5  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 12:45:02 2016
    13 // Update Count     : 59
     12// Last Modified On : Wed May 24 17:40:39 2017
     13// Update Count     : 60
    1414//
    1515
     
    2020#include <math.h>                                                                               // fpclassify, isfinite, isnormal, isnan, isinf
    2121} // 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 );
    2922
    3023float ?%?( float, float );
  • src/libcfa/math.c

    r9c951e3 rb1e63ac5  
    1010// Created On       : Tue Apr 19 22:23:08 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 08:52:31 2016
    13 // Update Count     : 75
     12// Last Modified On : Tue May 23 22:52:13 2017
     13// Update Count     : 76
    1414//
    1515
     
    1919#include <complex.h>
    2020} // 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 ); }
    2621
    2722float ?%?( float x, float y ) { return fmodf( x, y ); }
  • src/libcfa/stdlib

    r9c951e3 rb1e63ac5  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:42:44 2017
    13 // Update Count     : 107
     12// Last Modified On : Fri Jun  2 15:51:03 2017
     13// Update Count     : 218
    1414//
    1515
     
    2828//---------------------------------------
    2929
    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
     31static 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
     36extern "C" { void * calloc( size_t dim, size_t size ); } // default C routine
     37static 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
     42extern "C" { void * realloc( void * ptr, size_t size ); } // default C routine for void *
     43static 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
     48extern "C" { void * memalign( size_t align, size_t size ); } // use default C routine for void *
     49static 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
     54static 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
     59extern "C" { int posix_memalign( void ** ptr, size_t align, size_t size ); } // use default C routine for void *
     60static 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
     66extern "C" { void * memset( void * dest, int c, size_t size ); } // use default C routine for void *
     67
     68static 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
     72static 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
     78static 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
     82static 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
     88static 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
     92forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
     93
     94static 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
     98static 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
     104static 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
     108static 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
     116static 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
     120extern "C" { void * memcpy( void * dest, const void * src, size_t size ); } // use default C routine for void *
     121static 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
     127static 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
     131static 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
     137forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * new( Params p );
     138forall( dtype T | { void ^?{}( T * ); } ) void delete( T * ptr );
     139forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } ) void delete( T * ptr, Params rest );
     140
     141// allocation/deallocation and constructor/destructor, array types
     142forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * anew( size_t dim, Params p );
     143forall( dtype T | sized(T) | { void ^?{}( T * ); } ) void adelete( size_t dim, T arr[] );
     144forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest );
    53145
    54146//---------------------------------------
     
    83175
    84176forall( otype T | { int ?<?( T, T ); } )
    85 T * bsearch( T key, const T * arr, size_t dimension );
    86 
    87 forall( otype T | { int ?<?( T, T ); } )
    88 unsigned int bsearch( T key, const T * arr, size_t dimension );
    89 
    90 
    91 forall( otype T | { int ?<?( T, T ); } )
    92 void qsort( const T * arr, size_t dimension );
     177T * bsearch( T key, const T * arr, size_t dim );
     178
     179forall( otype T | { int ?<?( T, T ); } )
     180unsigned int bsearch( T key, const T * arr, size_t dim );
     181
     182
     183forall( otype T | { int ?<?( T, T ); } )
     184void qsort( const T * arr, size_t dim );
    93185
    94186//---------------------------------------
     
    109201double abs( double _Complex );
    110202long double abs( long double _Complex );
    111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     203forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
    112204T abs( T );
    113205
     
    115207
    116208void 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();
     209char rand48( void );
     210int rand48( void );
     211unsigned int rand48( void );
     212long int rand48( void );
     213unsigned long int rand48( void );
     214float rand48( void );
     215double rand48( void );
     216float _Complex rand48( void );
     217double _Complex rand48( void );
     218long double _Complex rand48( void );
    127219
    128220//---------------------------------------
  • src/libcfa/stdlib.c

    r9c951e3 rb1e63ac5  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:43:00 2017
    13 // Update Count     : 191
     12// Last Modified On : Thu Jun  1 21:52:57 2017
     13// Update Count     : 280
    1414//
    1515
     
    2121#define _XOPEN_SOURCE 600                                                               // posix_memalign, *rand48
    2222#include <stdlib.h>                                                                             // malloc, free, calloc, realloc, memalign, posix_memalign, bsearch
    23 #include <string.h>                                                                             // memset
     23#include <string.h>                                                                             // memcpy, memset
    2424#include <malloc.h>                                                                             // malloc_usable_size
    2525#include <math.h>                                                                               // fabsf, fabs, fabsl
     
    2727} // extern "C"
    2828
    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
     30forall( 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
     41forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
    7842T * new( Params p ) {
    79         return ((T *)malloc()){ p };
     43        return (malloc()){ p };                                                         // run constructor
    8044} // new
    8145
    82 forall( dtype T | { void ^?{}(T *); } )                                 // delete
     46forall( dtype T | { void ^?{}( T * ); } )
    8347void delete( T * ptr ) {
    84         if ( ptr ) {
    85                 ^ptr{};
     48        if ( ptr ) {                                                                            // ignore null
     49                ^ptr{};                                                                                 // run destructor
    8650                free( ptr );
    87         }
     51        } // if
    8852} // delete
    8953
    90 forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } )
     54forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } )
    9155void delete( T * ptr, Params rest ) {
    92         if ( ptr ) {
    93                 ^ptr{};
     56        if ( ptr ) {                                                                            // ignore null
     57                ^ptr{};                                                                                 // run destructor
    9458                free( ptr );
    95         }
     59        } // if
    9660        delete( rest );
    9761} // delete
     62
     63
     64// allocation/deallocation and constructor/destructor, array types
     65forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
     66T * 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
     74forall( dtype T | sized(T) | { void ^?{}( T * ); } )
     75void 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
     84forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } )
     85void 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
    9894
    9995//---------------------------------------
     
    242238
    243239forall( otype T | { int ?<?( T, T ); } )
    244 T * bsearch( T key, const T * arr, size_t dimension ) {
     240T * bsearch( T key, const T * arr, size_t dim ) {
    245241        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, dimension, sizeof(T), comp );
     242        return (T *)bsearch( &key, arr, dim, sizeof(T), comp );
    247243} // bsearch
    248244
    249245forall( otype T | { int ?<?( T, T ); } )
    250 unsigned int bsearch( T key, const T * arr, size_t dimension ) {
    251         T *result = bsearch( key, arr, dimension );
    252         return result ? result - arr : dimension;                       // pointer subtraction includes sizeof(T)
     246unsigned 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)
    253249} // bsearch
    254250
    255251forall( otype T | { int ?<?( T, T ); } )
    256 void qsort( const T * arr, size_t dimension ) {
     252void qsort( const T * arr, size_t dim ) {
    257253        int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
    258         qsort( arr, dimension, sizeof(T), comp );
     254        qsort( arr, dim, sizeof(T), comp );
    259255} // qsort
    260256
     
    279275
    280276void 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 lrand48
    287 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); }
     277char rand48( void ) { return mrand48(); }
     278int rand48( void ) { return mrand48(); }
     279unsigned int rand48( void ) { return lrand48(); }
     280long int rand48( void ) { return mrand48(); }
     281unsigned long int rand48( void ) { return lrand48(); }
     282float rand48( void ) { return (float)drand48(); }               // otherwise float uses lrand48
     283double rand48( void ) { return drand48(); }
     284float _Complex rand48( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
     285double _Complex rand48( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }
     286long double _Complex rand48( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
    291287
    292288//---------------------------------------
  • src/main.cc

    r9c951e3 rb1e63ac5  
    1010// Author           : Richard C. Bilson
    1111// Created On       : Fri May 15 23:12:02 2015
    12 // Last Modified By : Andrew Beach
    13 // Last Modified On : Wed May 10 14:45:00 2017
    14 // Update Count     : 437
     12// Last Modified By : Peter A. Buhr
     13// Last Modified On : Thu Jun 29 12:46:50 2017
     14// Update Count     : 441
    1515//
    1616
     
    2525using namespace std;
    2626
    27 #include "Parser/lex.h"
    28 #include "Parser/parser.h"
     27#include "Parser/parser.hh"
    2928#include "Parser/TypedefTable.h"
    3029#include "GenPoly/Lvalue.h"
     
    6463        bresolvep = false,
    6564        bboxp = false,
     65        bcodegenp = false,
    6666        ctorinitp = false,
    6767        declstatsp = false,
     
    145145} // sigSegvBusHandler
    146146
    147 void sigAbortHandler( int sig_num ) {
     147void sigAbortHandler( __attribute__((unused)) int sig_num ) {
    148148        backtrace( 6 );                                                                         // skip first 6 stack frames
    149149        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
     
    185185                if ( ! nopreludep ) {                                                   // include gcc builtins
    186186                        // -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 );
    190192
    191193                        // read the extra prelude in, if not generating the cfa library
     
    199201                                assertf( prelude, "cannot open prelude.cf\n" );
    200202                                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 );
    201208                        } // if
    202209                } // if
     
    306313                OPTPRINT( "box" )
    307314                GenPoly::box( translationUnit );
     315
     316                if ( bcodegenp ) {
     317                        dump( translationUnit );
     318                        return 0;
     319                }
    308320
    309321                if ( optind < argc ) {                                                  // any commands after the flags and input file ? => output file name
     
    377389
    378390        int c;
    379         while ( (c = getopt_long( argc, argv, "abBcdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     391        while ( (c = getopt_long( argc, argv, "abBcCdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
    380392                switch ( c ) {
    381393                  case Ast:
     
    394406                        ctorinitp = true;
    395407                        break;
     408                  case 'C':                                                                             // print before code generation
     409                        bcodegenp = true;
     410                        break;
    396411                  case DeclStats:
    397412                  case 'd':
     
    466481                        break;
    467482                  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
    469488                  default:
    470489                        abort();
  • src/prelude/Makefile.am

    r9c951e3 rb1e63ac5  
    2020# put into lib for now
    2121cfalibdir = ${CFA_LIBDIR}
    22 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
     22cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
     24
     25$(DEPDIR) :
     26        mkdir $(DEPDIR)
     27
     28$(DEPDIR)/builtins.Po : $(DEPDIR)
     29        touch ${@}
    2430
    2531# create extra forward types/declarations to reduce inclusion of library files
     
    2834
    2935# create forward declarations for gcc builtins
    30 builtins.cf : builtins.c prototypes.sed
     36gcc-builtins.cf : gcc-builtins.c prototypes.sed
    3137        ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
    3238
    33 builtins.c : builtins.def prototypes.awk
     39gcc-builtins.c : builtins.def prototypes.awk
    3440        ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
    3541
     
    3844prototypes.awk :
    3945
    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
     47builtins.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
     51include $(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
    4154        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    4255
    43 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     56bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    4457        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    4558
    46 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     59maintainer-clean-local :
     60        rm -rf $(DEPDIR)
     61
     62MAINTAINERCLEANFILES = 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  
    211211# put into lib for now
    212212cfalibdir = ${CFA_LIBDIR}
    213 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
     213cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
    214214noinst_DATA = ../libcfa/libcfa-prelude.c
    215 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     215MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
    216216all: all-am
    217217
     
    390390maintainer-clean: maintainer-clean-am
    391391        -rm -f Makefile
    392 maintainer-clean-am: distclean-am maintainer-clean-generic
     392maintainer-clean-am: distclean-am maintainer-clean-generic \
     393        maintainer-clean-local
    393394
    394395mostlyclean: mostlyclean-am
     
    416417        install-ps install-ps-am install-strip installcheck \
    417418        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 ${@}
    421429
    422430# create extra forward types/declarations to reduce inclusion of library files
     
    425433
    426434# create forward declarations for gcc builtins
    427 builtins.cf : builtins.c prototypes.sed
     435gcc-builtins.cf : gcc-builtins.c prototypes.sed
    428436        ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
    429437
    430 builtins.c : builtins.def prototypes.awk
     438gcc-builtins.c : builtins.def prototypes.awk
    431439        ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
    432440
     
    435443prototypes.awk :
    436444
    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
     446builtins.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
     450include $(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
    438453        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    439454
    440 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     455bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    441456        ${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
     458maintainer-clean-local :
     459        rm -rf $(DEPDIR)
    442460
    443461# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/prelude/prelude.cf

    r9c951e3 rb1e63ac5  
    309309// forall( dtype DT ) signed int ?!=?( const volatile void *, const volatile DT * );
    310310
    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 * );
    319319
    320320// ------------------------------------------------------------
     
    447447const volatile void *   ?=?( const volatile void * volatile *, const volatile void * );
    448448
    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 );
    460460
    461461forall( dtype T | sized(T) ) T *                        ?+=?(                T *          *, ptrdiff_t );
     
    799799void    ?{}( const volatile void *          *, const volatile void * );
    800800
    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 );
    809809
    810810// default ctors
  • src/tests/.expect/32/KRfunctions.txt

    r9c951e3 rb1e63ac5  
    66extern int printf(const char *__restrict __format, ...);
    77int __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;
    99}
    1010int __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;
    1212}
    1313int __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;
    1515}
    1616struct S {
     
    4040}
    4141int __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;
    4343    struct S __s__2sS_2;
    4444}
    4545int __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;
    4747}
    4848int __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;
    5050}
    5151int (*__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);
    5353}
    5454int (*__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);
    5656}
    5757int *__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;
    5959}
    6060int *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;
    6262}
    6363int *(*__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);
    6565    int *__x__FPi_ii__2(int __anonymous_object2, int __anonymous_object3);
    6666    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
     
    6868}
    6969int (*__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)[];
    7171}
    7272int (*__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)];
    7474}
    7575int (*__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)];
    7777}
    7878int (*__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)];
    8080}
    8181const int __fred__FCi___1(){
    82     const int ___retval_fred__Ci_1;
     82    __attribute__ ((unused)) const int ___retval_fred__Ci_1;
    8383    int *(*__x__PFPi_ii__2)(int __anonymous_object4, int __anonymous_object5);
    8484    int __a__i_2;
     
    8888    ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */);
    8989    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;
    9191    }
    9292    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;
    9494    }
    9595}
  • src/tests/.expect/32/attributes.txt

    r9c951e3 rb1e63ac5  
    66extern int printf(const char *__restrict __format, ...);
    77int __la__Fi___1(){
    8     int ___retval_la__i_1;
     8    __attribute__ ((unused)) int ___retval_la__i_1;
    99    L: __attribute__ ((unused)) ((void)1);
    1010}
     
    226226__attribute__ ((unused,used)) int __f1__Fi___1();
    227227__attribute__ ((unused)) int __f1__Fi___1(){
    228     int ___retval_f1__i_1;
     228    __attribute__ ((unused)) int ___retval_f1__i_1;
    229229}
    230230__attribute__ ((unused,unused,unused,used)) int **const __f2__FCPPi___1();
    231231__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;
    233233}
    234234__attribute__ ((unused,used,unused)) int (*__f3__FPA0i_i__1(int __anonymous_object1))[];
    235235__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)[];
    237237}
    238238__attribute__ ((unused,used,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object2);
    239239__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);
    241241}
    242242int __vtr__Fi___1(){
    243     int ___retval_vtr__i_1;
     243    __attribute__ ((unused)) int ___retval_vtr__i_1;
    244244    __attribute__ ((unused,unused,used)) int __t1__i_2;
    245245    __attribute__ ((unused,unused,unused,unused,unused)) int **__t2__PPi_2;
     
    251251int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1);
    252252int __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;
    254254}
    255255int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    256256int __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;
    258258}
    259259int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    260260int __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;
    262262}
    263263int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)());
    264264int __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;
    266266}
    267267int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) int __Foo__i_1);
     
    273273int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) int (*__anonymous_object7)(__attribute__ ((unused)) int (*__anonymous_object8)(__attribute__ ((unused,unused)) int __anonymous_object9)));
    274274int __ad__Fi___1(){
    275     int ___retval_ad__i_1;
     275    __attribute__ ((unused)) int ___retval_ad__i_1;
    276276    __attribute__ ((used,unused)) int __ad1__i_2;
    277277    __attribute__ ((unused,unused,unused)) int *__ad2__Pi_2;
  • src/tests/.expect/32/declarationSpecifier.txt

    r9c951e3 rb1e63ac5  
    670670static inline volatile const short __f48__FCVs___1();
    671671int __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;
    673673    ((void)(___retval_main__i_1=((int )0)) /* ?{} */);
    674674    return ((int )___retval_main__i_1);
     
    685685static inline int invoke_main(int argc, char **argv, char **envp);
    686686int 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;
    688688    int _tmp_cp_ret0;
    689689    ((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  
    8585__extension__ int j;
    8686__extension__ int __fred__Fi_i__1(int __p__i_1){
    87     int ___retval_fred__i_1;
     87    __attribute__ ((unused)) int ___retval_fred__i_1;
    8888    __extension__ struct S {
    8989        __extension__ int __a__i_2;
     
    105105    ((void)((*((int *)(&_tmp_cp_ret0)))) /* ^?{} */);
    106106    __extension__ int __mary__Fi_i__2(int __p__i_2){
    107         int ___retval_mary__i_2;
     107        __attribute__ ((unused)) int ___retval_mary__i_2;
    108108    }
    109109    ((void)__extension__ sizeof(3));
  • src/tests/.expect/32/gccExtensions.txt

    r9c951e3 rb1e63ac5  
    77extern int __x__i_1 asm ( "xx" );
    88int __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;
    1010    asm ( "nop" :  :  :  );
    1111    asm ( "nop" :  :  :  );
     
    2626    const int __i3__Ci_2;
    2727    inline int __f1__Fi___2(){
    28         int ___retval_f1__i_2;
     28        __attribute__ ((unused)) int ___retval_f1__i_2;
    2929    }
    3030    inline int __f2__Fi___2(){
    31         int ___retval_f2__i_2;
     31        __attribute__ ((unused)) int ___retval_f2__i_2;
    3232    }
    3333    int __s1__i_2;
     
    182182static inline int invoke_main(int argc, char **argv, char **envp);
    183183int 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;
    185185    int _tmp_cp_ret0;
    186186    ((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
     1fmod:1 1 1 1 1 1
     2remainder:-1 -1 -1
     3remquo:7 0.0999999 7 0.1 7 0.0999999999999999999
     4div:7 0.0999999 7 0.1 7 0.0999999999999999999
     5fma:-2 -2 -2
     6fdim:2 2 2
     7nan:nan nan nan
     8exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
     9exp2:2 2 2
     10expm1:1.71828 1.71828182845905 1.71828182845904524
     11log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
     12log2:3 3 3
     13log10:2 2 2
     14log1p:0.693147 0.693147180559945 0.693147180559945309
     15ilogb:0 0 0
     16logb:3 3 3
     17sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
     18cbrt:3 3 3
     19hypot:1.41421 1.4142135623731 1.41421356237309505
     20pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
     21sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
     22cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
     23tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.66624+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     25acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
     26atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
     27atan2: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
     28cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
     29tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
     30acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
     31asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
     32atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
     33erf:0.842701 0.842700792949715 0.842700792949714869
     34erfc:0.157299 0.157299207050285 0.157299207050285131
     35lgamma:1.79176 1.79175946922805 1.791759469228055
     36lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1
     37tgamma:6 6 6
     38floor:1 1 1
     39ceil:2 2 2
     40trunc:3 3 3
     41rint:2 2 2
     42rint:2 2 2
     43rint:2 2 2
     44lrint:2 2 2
     45llrint:2 2 2
     46nearbyint:4 4 4
     47round:2 2 2
     48round:2 2 2
     49round:2 2 2
     50lround:2 2 2
     51llround:2 2 2
     52copysign:-1 -1 -1
     53frexp:0.5 3 0.5 3 0.5 3
     54ldexp:8 8 8
     55modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2
     56nexttoward:2 2 2
     57scalbn:16 16 16
     58scalbln:16 16 16
  • src/tests/.expect/64/KRfunctions.txt

    r9c951e3 rb1e63ac5  
    66extern int printf(const char *__restrict __format, ...);
    77int __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;
    99}
    1010int __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;
    1212}
    1313int __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;
    1515}
    1616struct S {
     
    4040}
    4141int __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;
    4343    struct S __s__2sS_2;
    4444}
    4545int __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;
    4747}
    4848int __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;
    5050}
    5151int (*__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);
    5353}
    5454int (*__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);
    5656}
    5757int *__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;
    5959}
    6060int *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;
    6262}
    6363int *(*__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);
    6565    int *__x__FPi_ii__2(int __anonymous_object2, int __anonymous_object3);
    6666    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
     
    6868}
    6969int (*__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)[];
    7171}
    7272int (*__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)];
    7474}
    7575int (*__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)];
    7777}
    7878int (*__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)];
    8080}
    8181const int __fred__FCi___1(){
    82     const int ___retval_fred__Ci_1;
     82    __attribute__ ((unused)) const int ___retval_fred__Ci_1;
    8383    int *(*__x__PFPi_ii__2)(int __anonymous_object4, int __anonymous_object5);
    8484    int __a__i_2;
     
    8888    ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */);
    8989    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;
    9191    }
    9292    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;
    9494    }
    9595}
  • src/tests/.expect/64/attributes.txt

    r9c951e3 rb1e63ac5  
    66extern int printf(const char *__restrict __format, ...);
    77int __la__Fi___1(){
    8     int ___retval_la__i_1;
     8    __attribute__ ((unused)) int ___retval_la__i_1;
    99    L: __attribute__ ((unused)) ((void)1);
    1010}
     
    226226__attribute__ ((unused,used)) int __f1__Fi___1();
    227227__attribute__ ((unused)) int __f1__Fi___1(){
    228     int ___retval_f1__i_1;
     228    __attribute__ ((unused)) int ___retval_f1__i_1;
    229229}
    230230__attribute__ ((unused,unused,unused,used)) int **const __f2__FCPPi___1();
    231231__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;
    233233}
    234234__attribute__ ((unused,used,unused)) int (*__f3__FPA0i_i__1(int __anonymous_object1))[];
    235235__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)[];
    237237}
    238238__attribute__ ((unused,used,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object2);
    239239__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);
    241241}
    242242int __vtr__Fi___1(){
    243     int ___retval_vtr__i_1;
     243    __attribute__ ((unused)) int ___retval_vtr__i_1;
    244244    __attribute__ ((unused,unused,used)) int __t1__i_2;
    245245    __attribute__ ((unused,unused,unused,unused,unused)) int **__t2__PPi_2;
     
    251251int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1);
    252252int __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;
    254254}
    255255int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    256256int __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;
    258258}
    259259int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    260260int __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;
    262262}
    263263int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)());
    264264int __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;
    266266}
    267267int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) int __Foo__i_1);
     
    273273int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) int (*__anonymous_object7)(__attribute__ ((unused)) int (*__anonymous_object8)(__attribute__ ((unused,unused)) int __anonymous_object9)));
    274274int __ad__Fi___1(){
    275     int ___retval_ad__i_1;
     275    __attribute__ ((unused)) int ___retval_ad__i_1;
    276276    __attribute__ ((used,unused)) int __ad1__i_2;
    277277    __attribute__ ((unused,unused,unused)) int *__ad2__Pi_2;
  • src/tests/.expect/64/declarationSpecifier.txt

    r9c951e3 rb1e63ac5  
    670670static inline volatile const short __f48__FCVs___1();
    671671int __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;
    673673    ((void)(___retval_main__i_1=((int )0)) /* ?{} */);
    674674    return ((int )___retval_main__i_1);
     
    685685static inline int invoke_main(int argc, char **argv, char **envp);
    686686int 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;
    688688    int _tmp_cp_ret0;
    689689    ((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  
    8585__extension__ int j;
    8686__extension__ int __fred__Fi_i__1(int __p__i_1){
    87     int ___retval_fred__i_1;
     87    __attribute__ ((unused)) int ___retval_fred__i_1;
    8888    __extension__ struct S {
    8989        __extension__ int __a__i_2;
     
    105105    ((void)((*((int *)(&_tmp_cp_ret0)))) /* ^?{} */);
    106106    __extension__ int __mary__Fi_i__2(int __p__i_2){
    107         int ___retval_mary__i_2;
     107        __attribute__ ((unused)) int ___retval_mary__i_2;
    108108    }
    109109    ((void)__extension__ sizeof(3));
  • src/tests/.expect/64/gccExtensions.txt

    r9c951e3 rb1e63ac5  
    77extern int __x__i_1 asm ( "xx" );
    88int __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;
    1010    asm ( "nop" :  :  :  );
    1111    asm ( "nop" :  :  :  );
     
    2626    const int __i3__Ci_2;
    2727    inline int __f1__Fi___2(){
    28         int ___retval_f1__i_2;
     28        __attribute__ ((unused)) int ___retval_f1__i_2;
    2929    }
    3030    inline int __f2__Fi___2(){
    31         int ___retval_f2__i_2;
     31        __attribute__ ((unused)) int ___retval_f2__i_2;
    3232    }
    3333    int __s1__i_2;
     
    182182static inline int invoke_main(int argc, char **argv, char **envp);
    183183int 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;
    185185    int _tmp_cp_ret0;
    186186    ((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  
    44conversions
    55y:97
     6y:12345678901234567890123456789
    67y:3
    78y:-3
     
    2425z:150000000000000000000
    2526z:16666666666666666666
     2716666666666666666666, 2 16666666666666666666, 2
    2628x:16666666666666666666 y:2
    2729
  • 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
     1fmod:1 1 1 1 1 1
     2remainder:-1 -1 -1
     3remquo:7 0.0999999 7 0.1 7 0.0999999999999999999
     4div:7 0.0999999 7 0.1 7 0.0999999999999999999
     5fma:-2 -2 -2
     6fdim:2 2 2
     7nan:nan nan nan
     8exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
     9exp2:2 2 2
     10expm1:1.71828 1.71828182845905 1.71828182845904524
     11log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
     12log2:3 3 3
     13log10:2 2 2
     14log1p:0.693147 0.693147180559945 0.693147180559945309
     15ilogb:0 0 0
     16logb:3 3 3
     17sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
     18cbrt:3 3 3
     19hypot:1.41421 1.4142135623731 1.41421356237309505
     20pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
     21sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
     22cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
     23tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     25acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
     26atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
     27atan2: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
     28cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
     29tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
     30acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
     31asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
     32atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
     33erf:0.842701 0.842700792949715 0.842700792949714869
     34erfc:0.157299 0.157299207050285 0.157299207050285131
     35lgamma:1.79176 1.79175946922805 1.791759469228055
     36lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1
     37tgamma:6 6 6
     38floor:1 1 1
     39ceil:2 2 2
     40trunc:3 3 3
     41rint:2 2 2
     42rint:2 2 2
     43rint:2 2 2
     44lrint:2 2 2
     45llrint:2 2 2
     46nearbyint:4 4 4
     47round:2 2 2
     48round:2 2 2
     49round:2 2 2
     50lround:2 2 2
     51llround:2 2 2
     52copysign:-1 -1 -1
     53frexp:0.5 3 0.5 3 0.5 3
     54ldexp:8 8 8
     55modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2
     56nexttoward:2 2 2
     57scalbn:16 16 16
     58scalbln:16 16 16
  • src/tests/.expect/io.txt

    r9c951e3 rb1e63ac5  
    44123
    55
     6x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10
     71, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x
     8x`1`x'2'x"3"x:4:x 5 x   6       x
     97
     10x
     118
     12x
     139
     14x
     1510
     16x
     17x ( 1 ) x 2 , x 3 :x: 4
    618A
    7191 2 3 4 5 6 7 8
     
    1830abc, $xyz
    1931
    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
     321, 2, 3, 4
     331, $2, $3 ", $"
     341 2 3 " "
     35 1 2 3
     3612 3
     37123
     381 23
     391 2 3
     401 2 3 4 " "
     411, 2, 3, 4 ", "
     421, 2, 3, 4
    27433, 4, a, 7.2
    28443, 4, a, 7.2
    29453 4 a 7.2
    30  3 4 a 7.234a7.2 3 4 a 7.2
     46 3 4 a 7.234a7.23 4 a 7.2
    31473-4-a-7.2^3^4-3-4-a-7.2
  • src/tests/.expect/scopeErrors.txt

    r9c951e3 rb1e63ac5  
    33  with parameters
    44    double
    5   returning
    6     _retval_butThisIsAnError: double
    7   with body
     5  returning
     6    _retval_butThisIsAnError:       Attribute with name: unused
     7double
     8  with body
    89    CompoundStmt
  • src/tests/KRfunctions.c

    r9c951e3 rb1e63ac5  
    1 //                               -*- Mode: C -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1110// Created On       : Thu Feb 16 15:23:17 2017
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu Feb 16 15:25:52 2017
    14 // Update Count     : 2
     12// Last Modified On : Wed May 24 22:05:00 2017
     13// Update Count     : 3
    1514//
    1615
  • src/tests/Makefile.am

    r9c951e3 rb1e63ac5  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sun May 14 14:43:48 2017
    14 ## Update Count     : 42
     13## Last Modified On : Thu Jun  8 07:41:43 2017
     14## Update Count     : 44
    1515###############################################################################
    1616
     
    2020
    2121if BUILD_CONCURRENCY
    22 concurrent=yes
    23 quick_test+= coroutine thread monitor
    24 concurrent_test=coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
     22concurrent = yes
     23quick_test += coroutine thread monitor
     24concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt
    2525else
    2626concurrent=no
     
    3636
    3737.PHONY : list
    38 EXTRA_PROGRAMS = fstream_test vector_test avl_test constant0-1DP constant0-1ND constant0-1NDDP # build but do not install
     38EXTRA_PROGRAMS = fstream_test vector_test avl_test # build but do not install
    3939
    4040fstream_test_SOURCES = fstream_test.c
     
    5757        @+python test.py --debug=${debug} --concurrent=${concurrent} ${concurrent_test}
    5858
    59 .dummy : .dummy.c
     59.dummy : .dummy.c @CFA_BINDIR@/@CFA_NAME@
    6060        ${CC} ${BUILD_FLAGS} -XCFA -n ${<} -o ${@}                              #don't use CFLAGS, this rule is not a real test
    6161
    62 constant0-1DP : constant0-1.c
    63         ${CC} ${CFLAGS} -DDUPS ${<} -o ${@}
    6462
    65 constant0-1ND : constant0-1.c
    66         ${CC} ${CFLAGS} -DNEWDECL ${<} -o ${@}
     63% : %.c @CFA_BINDIR@/@CFA_NAME@
     64        ${CC} ${CFLAGS} ${<} -o ${@}
    6765
    68 constant0-1NDDP : constant0-1.c
    69         ${CC} ${CFLAGS} -DNEWDECL -DDUPS ${<} -o ${@}
    70 
    71 dtor-early-exit-ERR1: dtor-early-exit.c
     66dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    7267        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    7368
    74 dtor-early-exit-ERR2: dtor-early-exit.c
     69dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    7570        ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
    7671
    77 declarationSpecifier: declarationSpecifier.c
     72declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    7873        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    7974
    80 gccExtensions : gccExtensions.c
     75gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    8176        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8277
    83 extension : extension.c
     78extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    8479        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8580
    86 attributes : attributes.c
     81attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    8782        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8883
    89 KRfunctions : KRfunctions.c
     84KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    9085        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    9186
    92 gmp : gmp.c
     87gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    9388        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    9489
    95 memberCtors-ERR1: memberCtors.c
     90memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    9691        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    9792
    98 completeTypeError : completeTypeError.c
     93completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    9994        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    r9c951e3 rb1e63ac5  
    3939@BUILD_CONCURRENCY_TRUE@am__append_1 = coroutine thread monitor
    4040EXTRA_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)
    4342subdir = src/tests
    4443DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
     
    5655avl_test_OBJECTS = $(am_avl_test_OBJECTS)
    5756avl_test_LDADD = $(LDADD)
    58 constant0_1DP_SOURCES = constant0-1DP.c
    59 constant0_1DP_OBJECTS = constant0-1DP.$(OBJEXT)
    60 constant0_1DP_LDADD = $(LDADD)
    61 constant0_1ND_SOURCES = constant0-1ND.c
    62 constant0_1ND_OBJECTS = constant0-1ND.$(OBJEXT)
    63 constant0_1ND_LDADD = $(LDADD)
    64 constant0_1NDDP_SOURCES = constant0-1NDDP.c
    65 constant0_1NDDP_OBJECTS = constant0-1NDDP.$(OBJEXT)
    66 constant0_1NDDP_LDADD = $(LDADD)
    6757am_fstream_test_OBJECTS = fstream_test.$(OBJEXT)
    6858fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)
     
    9585am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    9686am__v_GEN_0 = @echo "  GEN   " $@;
    97 SOURCES = $(avl_test_SOURCES) constant0-1DP.c constant0-1ND.c \
    98         constant0-1NDDP.c $(fstream_test_SOURCES) \
     87SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    9988        $(vector_test_SOURCES)
    100 DIST_SOURCES = $(avl_test_SOURCES) constant0-1DP.c constant0-1ND.c \
    101         constant0-1NDDP.c $(fstream_test_SOURCES) \
     89DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    10290        $(vector_test_SOURCES)
    10391ETAGS = etags
     
    230218@BUILD_CONCURRENCY_TRUE@concurrent = yes
    231219@BUILD_CONCURRENCY_FALSE@concurrent_test =
    232 @BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
     220@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
    233221
    234222# applies to both programs
     
    297285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@
    298286@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@
    302287@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@
    303288@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@
     
    676661        @+python test.py --debug=${debug} --concurrent=${concurrent} ${concurrent_test}
    677662
    678 .dummy : .dummy.c
     663.dummy : .dummy.c @CFA_BINDIR@/@CFA_NAME@
    679664        ${CC} ${BUILD_FLAGS} -XCFA -n ${<} -o ${@}                              #don't use CFLAGS, this rule is not a real test
    680665
    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
     669dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    691670        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    692671
    693 dtor-early-exit-ERR2: dtor-early-exit.c
     672dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    694673        ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
    695674
    696 declarationSpecifier: declarationSpecifier.c
     675declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    697676        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    698677
    699 gccExtensions : gccExtensions.c
     678gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    700679        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    701680
    702 extension : extension.c
     681extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    703682        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    704683
    705 attributes : attributes.c
     684attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    706685        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    707686
    708 KRfunctions : KRfunctions.c
     687KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    709688        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    710689
    711 gmp : gmp.c
     690gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    712691        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    713692
    714 memberCtors-ERR1: memberCtors.c
     693memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    715694        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    716695
    717 completeTypeError : completeTypeError.c
     696completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    718697        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    719698
  • 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
    116#include <fstream>
    217#include <coroutine>
    318
    419coroutine Fibonacci {
    5       int fn; // used for communication
     20        int fn;                                         // used for communication
    621};
    722
    8 void ?{}(Fibonacci* this) {
    9       this->fn = 0;
     23void ?{}( Fibonacci * this ) {
     24        this->fn = 0;
    1025}
    1126
    12 void main(Fibonacci* this) {
    13       int fn1, fn2;             // retained between resumes
    14       this->fn = 0;
    15       fn1 = this->fn;
    16       suspend();                // return to last resume
     27void 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
    1732
    18       this->fn = 1;
    19       fn2 = fn1;
    20       fn1 = this->fn;
    21       suspend();                // return to last resume
     33        this->fn = 1;                                   // case 1
     34        fn2 = fn1;
     35        fn1 = this->fn;
     36        suspend();                                              // return to last resume
    2237
    23       for ( ;; ) {
    24             this->fn = fn1 + fn2;
    25             fn2 = fn1;
    26             fn1 = this->fn;
    27             suspend(); // return to last resume
    28       }
     38        for ( ;; ) {                                    // general case
     39                this->fn = fn1 + fn2;
     40                fn2 = fn1;
     41                fn1 = this->fn;
     42                suspend();                                      // return to last resume
     43        } // for
    2944}
    3045
    31 int next(Fibonacci* this) {
    32       resume(this); // transfer to last suspend
    33       return this->fn;
     46int next( Fibonacci * this ) {
     47        resume( this );                                 // transfer to last suspend
     48        return this->fn;
    3449}
    3550
    3651int 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}
    4157
    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  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 14 14:46:50 2017
    13 // Update Count     : 530
     12// Last Modified On : Wed May 24 22:05:38 2017
     13// Update Count     : 540
    1414//
    1515
    1616#include <gmp>
    1717
    18 int main() {
     18int main( void ) {
    1919        sout | "constructors" | endl;
    2020        short int si = 3;
     
    2525        sout | "conversions" | endl;
    2626        y = 'a';
     27        sout | "y:" | y | endl;
     28        y = "12345678901234567890123456789";
    2729        sout | "y:" | y | endl;
    2830        y = si;
     
    6264        z = x / 3;
    6365        sout | "z:" | z | endl;
     66        sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6467        [ x, y ] = div( x, 3 );
    6568        sout | "x:" | x | "y:" | y | endl;
    66 //      sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6769
    6870        sout | endl;
     
    7274        fn = (Int){0}; fn1 = fn;                                                        // 1st case
    7375        sout | (int)0 | fn | endl;
    74         fn = (Int){1}; fn2 = fn1; fn1 = fn;                                     // 2nd case
     76        fn = 1; fn2 = fn1; fn1 = fn;                                            // 2nd case
    7577        sout | 1 | fn | endl;
    76         for ( int i = 2; i <= 200; i += 1 ) {
     78        for ( unsigned int i = 2; i <= 200; i += 1 ) {
    7779                fn = fn1 + fn2; fn2 = fn1; fn1 = fn;                    // general case
    7880                sout | i | fn | endl;
     
    8385        sout | "Factorial Numbers" | endl;
    8486        Int fact;
    85         fact = (Int){1};                                                                        // 1st case
     87        fact = 1;                                                                                       // 1st case
    8688        sout | (int)0 | fact | endl;
    87         for ( int i = 1; i <= 40; i += 1 ) {
    88                 fact = fact * i;                                                                // general case
     89        for ( unsigned int i = 1; i <= 40; i += 1 ) {
     90                fact *= i;                                                                              // general case
    8991                sout | i | fact | endl;
    9092        } // for
     
    9294
    9395// Local Variables: //
    94 // mode: c //
    9596// tab-width: 4 //
     97// compile-command: "cfa gmp.c -l gmp" //
    9698// End: //
  • src/tests/identity.c

    r9c951e3 rb1e63ac5  
    77// identity.c --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Peter A. Buhr
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:15:08 2016
    13 // Update Count     : 13
     12// Last Modified On : Thu Jun  8 08:21:32 2017
     13// Update Count     : 18
    1414//
    1515
     
    3232        sout | "double\t\t\t"                           | identity( 4.1 ) | endl;
    3333        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;
    3437}
    3538
  • src/tests/io.c

    r9c951e3 rb1e63ac5  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 22:36:06 2017
    13 // Update Count     : 48
     12// Last Modified On : Thu Jun  8 09:52:10 2017
     13// Update Count     : 51
    1414//
    1515
     
    1717
    1818int main() {
    19         char c;                                                                                                         // basic types
     19        char c;                                                                                         // basic types
    2020        short int si;
    2121        unsigned short int usi;
     
    3232        double _Complex dc;
    3333        long double _Complex ldc;
    34         char s1[10], s2[10];
     34        enum { size = 10 };
     35        char s1[size], s2[size];
    3536
    3637        int x = 3, y = 5, z = 7;
     
    4142        sout | endl;
    4243
    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
    4483        open( &in, "io.data", "r" );
    4584
    46         &in | &c                                                                                                        // character
    47                 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli             // integral
    48                 | &f | &d | &ld                                                                                 // floating point
    49                 | &fc | &dc | &ldc                                                                              // floating-point complex
    50                 | cstr( s1 ) | cstr( s2, 10 );                                                  // C string, length unchecked and checked
     85        &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
    5190
    52         sout | c | ' ' | endl                                                                           // character
    53                  | si | usi | i | ui | li | uli | lli | ulli | endl             // integral
    54                  | f | d | ld | endl                                                                    // floating point
    55                  | fc | dc | ldc | endl;                                                                // complex
     91        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
    5695        sout | endl;
    57         sout | f | "" | d | "" | ld | endl                                                      // floating point without separator
    58                  | sepDisable | fc | dc | ldc | sepEnable | endl                // complex without separator
    59                  | sepOn | s1 | sepOff | s2 | endl                                              // local separator removal
    60                  | s1 | "" | s2 | endl;                                                                 // C string without separator
     96        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
    61100        sout | endl;
    62101
    63         sepSet( sout, ", $" );                                                                          // change separator, maximum of 15 characters
     102        sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
    64103        sout | f | d | ld | endl
    65                  | fc | dc | ldc | endl
    66                  | s1 | s2 | endl;
     104                | fc | dc | ldc | endl
     105                | s1 | s2 | endl;
    67106        sout | endl;
     107
     108        [int, int] t1 = [1, 2], t2 = [3, 4];
     109        sout | t1 | t2 | endl;                                                          // print tuple
     110
    68111        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;
    69116
    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
    108119
    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 };
    110132        sout | [ 3, 4, "a", 7.2 ] | endl;
    111         sout | t | endl;
     133        sout | t3 | endl;
    112134        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;
    115137        sepSet( sout, "^" );
    116138        sepSetTuple( sout, "-" );
    117         sout | t | 3 | 4 | t | endl;
     139        sout | t3 | 3 | 4 | t3 | endl;
    118140}
    119141
  • src/tests/libcfa_vector.c

    r9c951e3 rb1e63ac5  
    2727
    2828int main() {
    29         vector( int, heap_allocator(int) ) iv;
     29        vector( int ) iv;
    3030
    3131        assert( empty( &iv ) );
  • src/tests/math.c

    r9c951e3 rb1e63ac5  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 13:24:20 2016
    13 // Update Count     : 70
     12// Last Modified On : Wed May 24 13:04:33 2017
     13// Update Count     : 71
    1414//
    1515
     
    2222        long double l;
    2323
    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;
    2524        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;
    2625        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
    116int main() {
    217        1;                                                      // decimal
     
    4863        0x_ff.ffp0;                                     // hex real
    4964        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  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 21:32:22 2017
    13 // Update Count     : 64
     12// Last Modified On : Wed May 17 15:46:35 2017
     13// Update Count     : 65
    1414//
    1515
  • src/tests/sched-int-disjoint.c

    r9c951e3 rb1e63ac5  
    44#include <thread>
    55
     6#ifndef N
    67#define N 100_000
     8#endif
    79
    810enum state_t { WAIT, SIGNAL, BARGE };
     
    7880        signal( &cond, a, &data );
    7981
    80         int pauses = (unsigned)rand48() % 10;
    81         for(int i = 0; i < pauses; i++) {
    82                 yield();
    83         }
     82        yield( (unsigned)rand48() % 10 );
    8483
    8584        //This is technically a mutual exclusion violation but the mutex monitor protects us
  • src/tests/sched-int-wait.c

    r9c951e3 rb1e63ac5  
    55#include <thread>
    66
    7 static const int N = 10_000;
     7#ifndef N
     8#define N 10_000
     9#endif
    810
    911monitor global_t {};
  • src/tests/test.py

    r9c951e3 rb1e63ac5  
    197197                        # fetch return code and error from the diff command
    198198                        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               
    199205        # clean the executable
    200206        sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
     
    253259        # for each test to run
    254260        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)
    256262        except KeyboardInterrupt:
    257263                pool.terminate()
  • src/tests/tuplePolymorphism.c

    r9c951e3 rb1e63ac5  
    99// Author           : Rob Schluntz
    1010// Created On       : Tue Nov 16 10:38:00 2016
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Nov 16 10:39:18 2016
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu May 18 18:05:12 2017
     13// Update Count     : 4
    1414//
    1515
    1616// packed is needed so that structs are not passed with the same alignment as function arguments
    1717__attribute__((packed)) struct A {
    18   double x;
    19   char y;
    20   double z;
     18        double x;
     19        char y;
     20        double z;
    2121};
    2222
    2323__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;
    2727};
    2828
     
    3939
    4040int main() {
    41   int x1 = 123, x3 = 456;
    42   double x2 = 999.123;
     41        int x1 = 123, x3 = 456;
     42        double x2 = 999.123;
    4343
    44   int i1 = 111, i3 = 222;
    45   double i2 = 333;
     44        int i1 = 111, i3 = 222;
     45        double i2 = 333;
    4646
    47   int d1 = 555, d3 = 444;
    48   double d2 = 666;
     47        int d1 = 555, d3 = 444;
     48        double d2 = 666;
    4949
    5050
    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);
    5555
    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);
    6161
    62   // ensure non-matching assertions are specialized correctly
    63   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 });
    6464}
    6565
     
    7373// tab-width: 4 //
    7474// End: //
    75 
Note: See TracChangeset for help on using the changeset viewer.