Changeset b826e6b for src


Ignore:
Timestamp:
Jul 19, 2017, 11:49:33 AM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
9cc0472
Parents:
fea3faa (diff), a57cb58 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
20 added
1 deleted
142 edited
3 moved

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rfea3faa rb826e6b  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
    20 
    21 #include "Parser/ParseNode.h"
    22 
    23 #include "SynTree/Declaration.h"
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Initializer.h"
    26 #include "SynTree/Statement.h"
    27 #include "SynTree/Type.h"
    28 #include "SynTree/Attribute.h"
    29 
    30 #include "Common/utility.h"
    31 #include "Common/UnimplementedError.h"
     16#include <cassert>                   // for assert, assertf
     17#include <list>                      // for _List_iterator, list, list<>::it...
    3218
    3319#include "CodeGenerator.h"
    34 #include "OperatorTable.h"
    35 #include "GenType.h"
    36 
    37 #include "InitTweak/InitTweak.h"
     20#include "Common/SemanticError.h"    // for SemanticError
     21#include "Common/UniqueName.h"       // for UniqueName
     22#include "Common/utility.h"          // for CodeLocation, toString
     23#include "GenType.h"                 // for genType
     24#include "InitTweak/InitTweak.h"     // for getPointerBase
     25#include "OperatorTable.h"           // for OperatorInfo, operatorLookup
     26#include "Parser/LinkageSpec.h"      // for Spec, Intrinsic
     27#include "SynTree/Attribute.h"       // for Attribute
     28#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     29#include "SynTree/Constant.h"        // for Constant
     30#include "SynTree/Declaration.h"     // for DeclarationWithType, TypeDecl
     31#include "SynTree/Expression.h"      // for Expression, UntypedExpr, Applica...
     32#include "SynTree/Initializer.h"     // for Initializer, ListInit, Designation
     33#include "SynTree/Label.h"           // for Label, operator<<
     34#include "SynTree/Statement.h"       // for Statement, AsmStmt, BranchStmt
     35#include "SynTree/Type.h"            // for Type, Type::StorageClasses, Func...
    3836
    3937using namespace std;
     
    288286        }
    289287
    290         void CodeGenerator::printDesignators( std::list< Expression * > & designators ) {
    291                 typedef std::list< Expression * > DesignatorList;
     288        void CodeGenerator::visit( Designation * designation ) {
     289                std::list< Expression * > designators = designation->get_designators();
    292290                if ( designators.size() == 0 ) return;
    293                 for ( DesignatorList::iterator iter = designators.begin(); iter != designators.end(); ++iter ) {
    294                         if ( dynamic_cast< NameExpr * >( *iter ) ) {
    295                                 // if expression is a name, then initializing aggregate member
     291                for ( Expression * des : designators ) {
     292                        if ( dynamic_cast< NameExpr * >( des ) || dynamic_cast< VariableExpr * >( des ) ) {
     293                                // if expression is a NameExpr or VariableExpr, then initializing aggregate member
    296294                                output << ".";
    297                                 (*iter)->accept( *this );
     295                                des->accept( *this );
    298296                        } else {
    299                                 // if not a simple name, it has to be a constant expression, i.e. an array designator
     297                                // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt
    300298                                output << "[";
    301                                 (*iter)->accept( *this );
     299                                des->accept( *this );
    302300                                output << "]";
    303301                        } // if
     
    307305
    308306        void CodeGenerator::visit( SingleInit * init ) {
    309                 printDesignators( init->get_designators() );
    310307                init->get_value()->accept( *this );
    311308        }
    312309
    313310        void CodeGenerator::visit( ListInit * init ) {
    314                 printDesignators( init->get_designators() );
     311                auto initBegin = init->begin();
     312                auto initEnd = init->end();
     313                auto desigBegin = init->get_designations().begin();
     314                auto desigEnd = init->get_designations().end();
     315
    315316                output << "{ ";
    316                 genCommaList( init->begin(), init->end() );
     317                for ( ; initBegin != initEnd && desigBegin != desigEnd; ) {
     318                        (*desigBegin)->accept( *this );
     319                        (*initBegin)->accept( *this );
     320                        ++initBegin, ++desigBegin;
     321                        if ( initBegin != initEnd ) {
     322                                output << ", ";
     323                        }
     324                }
    317325                output << " }";
     326                assertf( initBegin == initEnd && desigBegin == desigEnd, "Initializers and designators not the same length. %s", toString( init ).c_str() );
    318327        }
    319328
     
    716725
    717726        void CodeGenerator::visit( TypeExpr * typeExpr ) {
    718                 assertf( ! genC, "TypeExpr should not reach code generation." );
    719                 output<< genType( typeExpr->get_type(), "", pretty, genC );
     727                // if ( genC ) std::cerr << "typeexpr still exists: " << typeExpr << std::endl;
     728                // assertf( ! genC, "TypeExpr should not reach code generation." );
     729                if ( ! genC ) {
     730                        output<< genType( typeExpr->get_type(), "", pretty, genC );
     731                }
    720732        }
    721733
  • src/CodeGen/CodeGenerator.h

    rfea3faa rb826e6b  
    1717#define CODEGENV_H
    1818
    19 #include <list>
     19#include <list>                   // for list
     20#include <ostream>                // for ostream, operator<<
     21#include <string>                 // for string
    2022
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Visitor.h"
    24 
    25 #include "SymTab/Indexer.h"
    26 
    27 #include "Common/utility.h"
     23#include "SynTree/Declaration.h"  // for DeclarationWithType (ptr only), Fun...
     24#include "SynTree/Visitor.h"      // for Visitor
     25#include "SynTree/SynTree.h"      // for Visitor Nodes
    2826
    2927namespace CodeGen {
     
    4745
    4846                //*** Initializer
     47                virtual void visit( Designation * );
    4948                virtual void visit( SingleInit * );
    5049                virtual void visit( ListInit * );
     
    137136                bool lineMarks = false;
    138137
    139                 void printDesignators( std::list< Expression * > & );
    140138                void handleStorageClass( DeclarationWithType *decl );
    141139                void handleAggregate( AggregateDecl *aggDecl, const std::string & kind );
  • src/CodeGen/FixMain.cc

    rfea3faa rb826e6b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixMain.cc -- 
     7// FixMain.cc --
    88//
    99// Author           : Thierry Delisle
    1010// Created On       : Thr Jan 12 14:11:09 2017
    11 // Last Modified By : 
    12 // Last Modified On : 
     11// Last Modified By :
     12// Last Modified On :
    1313// Update Count     : 0
    1414//
    1515
    1616
    17 #include "FixMain.h"   
     17#include "FixMain.h"
    1818
    19 #include <fstream>
    20 #include <iostream>
     19#include <cassert>                 // for assert, assertf
     20#include <fstream>                 // for operator<<, basic_ostream::operator<<
     21#include <list>                    // for list
     22#include <string>                  // for operator<<
    2123
    22 #include "Common/SemanticError.h"
    23 #include "SynTree/Declaration.h"
     24#include "Common/SemanticError.h"  // for SemanticError
     25#include "SynTree/Declaration.h"   // for FunctionDecl, operator<<
     26#include "SynTree/Type.h"          // for FunctionType
    2427
    2528namespace CodeGen {
    2629        bool FixMain::replace_main = false;
    2730        std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
    28        
    29         void FixMain::registerMain(FunctionDecl* functionDecl) 
     31
     32        void FixMain::registerMain(FunctionDecl* functionDecl)
    3033        {
    31                 if(main_signature) { 
    32                         throw SemanticError("Multiple definition of main routine\n", functionDecl); 
     34                if(main_signature) {
     35                        throw SemanticError("Multiple definition of main routine\n", functionDecl);
    3336                }
    3437                main_signature.reset( functionDecl->clone() );
  • src/CodeGen/FixNames.cc

    rfea3faa rb826e6b  
    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 : Wed Jun 21 14:22:59 2017
    13 // Update Count     : 19
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:26:00 2017
     13// Update Count     : 20
    1414//
    1515
    16 #include <memory>
     16#include "FixNames.h"
    1717
    18 #include "FixNames.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Visitor.h"
    22 #include "SymTab/Mangler.h"
    23 #include "OperatorTable.h"
    24 #include "FixMain.h"
     18#include <memory>                  // for unique_ptr
     19#include <string>                  // for string, operator!=, operator==
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "FixMain.h"               // for FixMain
     23#include "Parser/LinkageSpec.h"    // for Cforall, isMangled
     24#include "SymTab/Mangler.h"        // for Mangler
     25#include "SynTree/Constant.h"      // for Constant
     26#include "SynTree/Declaration.h"   // for FunctionDecl, ObjectDecl, Declarat...
     27#include "SynTree/Expression.h"    // for ConstantExpr
     28#include "SynTree/Label.h"         // for Label, noLabels
     29#include "SynTree/Statement.h"     // for ReturnStmt, CompoundStmt
     30#include "SynTree/Type.h"          // for Type, BasicType, Type::Qualifiers
     31#include "SynTree/Visitor.h"       // for Visitor, acceptAll
    2532
    2633namespace CodeGen {
     
    4249                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    4350                                };
    44                 main_type->get_returnVals().push_back( 
     51                main_type->get_returnVals().push_back(
    4552                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    4653                );
     
    5259        std::string mangle_main_args() {
    5360                FunctionType* main_type;
    54                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall, 
     61                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    5562                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    5663                                };
    57                 main_type->get_returnVals().push_back( 
     64                main_type->get_returnVals().push_back(
    5865                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5966                );
    6067
    61                 mainDecl->get_functionType()->get_parameters().push_back( 
     68                mainDecl->get_functionType()->get_parameters().push_back(
    6269                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6370                );
    6471
    65                 mainDecl->get_functionType()->get_parameters().push_back( 
    66                         new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, 
    67                         new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ), 
     72                mainDecl->get_functionType()->get_parameters().push_back(
     73                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
     74                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    6875                        nullptr )
    6976                );
     
    7582
    7683        bool is_main(const std::string& name) {
    77                 static std::string mains[] = { 
    78                         mangle_main(), 
     84                static std::string mains[] = {
     85                        mangle_main(),
    7986                        mangle_main_args()
    8087                };
     
    93100        void FixNames::fixDWT( DeclarationWithType *dwt ) {
    94101                if ( dwt->get_name() != "" ) {
    95                         if ( LinkageSpec::isDecoratable( dwt->get_linkage() ) ) {
     102                        if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
    96103                                dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) );
    97104                                dwt->set_scopeLevel( scopeLevel );
     
    112119                        int nargs = functionDecl->get_functionType()->get_parameters().size();
    113120                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    114                                 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 
     121                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    115122                        }
    116123                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
  • src/CodeGen/FixNames.h

    rfea3faa rb826e6b  
    1717#define FIXNAMES_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <list>  // for list
     20
     21class Declaration;
    2022
    2123namespace CodeGen {
  • src/CodeGen/GenType.cc

    rfea3faa rb826e6b  
    1414//
    1515
    16 #include <sstream>
    17 #include <cassert>
    18 
     16#include <cassert>                // for assert, assertf
     17#include <list>                   // for _List_iterator, _List_const_iterator
     18#include <sstream>                // for operator<<, ostringstream, basic_os...
     19
     20#include "CodeGenerator.h"        // for CodeGenerator
    1921#include "GenType.h"
    20 #include "CodeGenerator.h"
    21 
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Expression.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/Visitor.h"
     22#include "SynTree/Declaration.h"  // for DeclarationWithType
     23#include "SynTree/Expression.h"   // for Expression
     24#include "SynTree/Type.h"         // for PointerType, Type, FunctionType
     25#include "SynTree/Visitor.h"      // for Visitor
    2626
    2727namespace CodeGen {
  • src/CodeGen/GenType.h

    rfea3faa rb826e6b  
    1717#define _GENTYPE_H
    1818
    19 #include <string>
    20 #include "SynTree/SynTree.h"
     19#include <string>  // for string
     20
     21class Type;
    2122
    2223namespace CodeGen {
  • src/CodeGen/Generate.cc

    rfea3faa rb826e6b  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
     16#include <iostream>                  // for ostream, endl, operator<<
     17#include <list>                      // for list
     18#include <string>                    // for operator<<
    2019
     20#include "CodeGenerator.h"           // for CodeGenerator, doSemicolon, oper...
     21#include "GenType.h"                 // for genPrettyType
    2122#include "Generate.h"
    22 #include "SynTree/Declaration.h"
    23 #include "CodeGenerator.h"
    24 #include "GenType.h"
    25 #include "SynTree/SynTree.h"
    26 #include "SynTree/Type.h"
    27 #include "SynTree/BaseSyntaxNode.h"
    28 // #include "Tuples/Tuples.h"
     23#include "Parser/LinkageSpec.h"      // for isBuiltin, isGeneratable
     24#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     25#include "SynTree/Declaration.h"     // for Declaration
     26#include "SynTree/Type.h"            // for Type
    2927
    3028using namespace std;
  • src/CodeGen/Generate.h

    rfea3faa rb826e6b  
    1717#define GENERATE_H
    1818
    19 #include <list>
    20 #include <iostream>
     19#include <iostream>  // for ostream
     20#include <list>      // for list
    2121
    22 #include "SynTree/SynTree.h"
     22class BaseSyntaxNode;
     23class Declaration;
    2324
    2425namespace CodeGen {
  • src/CodeGen/OperatorTable.cc

    rfea3faa rb826e6b  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 14:33:05 2016
    13 // Update Count     : 10
     12// Last Modified On : Sat Jul 15 17:12:22 2017
     13// Update Count     : 15
    1414//
    1515
    16 #include <map>
     16#include <map>      // for map, _Rb_tree_const_iterator, map<>::const_iterator
     17#include <utility>  // for pair
     18
    1719#include "OperatorTable.h"
    1820
     
    3335                        {       "++?",          "++",   "_operator_preincr",                    OT_PREFIXASSIGN         },
    3436                        {       "--?",          "--",   "_operator_predecr",                    OT_PREFIXASSIGN         },
     37                        {       "?\\?",         "\\",   "_operator_exponential",                OT_INFIX                        },
    3538                        {       "?*?",          "*",    "_operator_multiply",                   OT_INFIX                        },
    3639                        {       "?/?",          "/",    "_operator_divide",                             OT_INFIX                        },
     
    5053                        {       "?|?",          "|",    "_operator_bitor",                              OT_INFIX                        },
    5154                        {       "?=?",          "=",    "_operator_assign",                             OT_INFIXASSIGN          },
     55                        {       "?\\=?",        "\\=",  "_operator_expassign",                  OT_INFIXASSIGN          },
    5256                        {       "?*=?",         "*=",   "_operator_multassign",                 OT_INFIXASSIGN          },
    5357                        {       "?/=?",         "/=",   "_operator_divassign",                  OT_INFIXASSIGN          },
  • src/CodeTools/DeclStats.cc

    rfea3faa rb826e6b  
    1616#include "DeclStats.h"
    1717
    18 #include <iostream>
    19 #include <map>
    20 #include <sstream>
    21 #include <string>
    22 #include <unordered_map>
    23 #include <unordered_set>
    24 
    25 #include "Common/VectorMap.h"
    26 #include "GenPoly/GenPoly.h"
    27 #include "Parser/LinkageSpec.h"
    28 #include "SynTree/Declaration.h"
    29 #include "SynTree/Visitor.h"
     18#include <iostream>                // for operator<<, basic_ostream, cout
     19#include <map>                     // for map
     20#include <string>                  // for string, operator+, operator<<, cha...
     21#include <unordered_map>           // for unordered_map
     22#include <unordered_set>           // for unordered_set
     23#include <utility>                 // for pair, make_pair
     24
     25#include "Common/SemanticError.h"  // for SemanticError
     26#include "Common/VectorMap.h"      // for VectorMap
     27#include "GenPoly/GenPoly.h"       // for hasPolyBase
     28#include "Parser/LinkageSpec.h"    // for ::NoOfSpecs, Spec
     29#include "SynTree/Declaration.h"   // for FunctionDecl, TypeDecl, Declaration
     30#include "SynTree/Expression.h"    // for UntypedExpr, Expression
     31#include "SynTree/Statement.h"     // for CompoundStmt
     32#include "SynTree/Type.h"          // for Type, FunctionType, PointerType
     33#include "SynTree/Visitor.h"       // for maybeAccept, Visitor, acceptAll
    3034
    3135namespace CodeTools {
    32        
     36
    3337        class DeclStats : public Visitor {
    3438                template<typename T>
     
    7579                                sum(n_types, o.n_types);
    7680                                sum(p_new, o.p_new);
    77                                
     81
    7882                                return *this;
    7983                        }
    8084                };
    81                
     85
    8286                struct Stats {
    8387                        unsigned n_decls;     ///< Total number of declarations
     
    98102                        /// Stats for the return list
    99103                        ArgPackStats returns;
    100                        
     104
    101105                        /// Count of declarations with each number of assertions
    102106                        std::map<unsigned, unsigned> n_assns;
     
    105109                        /// Stats for the assertions' return types
    106110                        ArgPackStats assn_returns;
    107                        
     111
    108112                        Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), basic_type_decls(), compound_type_decls(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
    109113
     
    122126                                sum( assn_params, o.assn_params );
    123127                                sum( assn_returns, o.assn_returns );
    124                                
     128
    125129                                return *this;
    126130                        }
     
    144148
    145149                                n += dt->size();
    146                                
     150
    147151                                std::stringstream ss;
    148152                                dt->print( ss );
     
    176180                        ++pstats.n_types.at( types.size() );
    177181                }
    178                
     182
    179183                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
    180184                        std::unordered_set<std::string> seen;
     
    186190                        auto& args = expr->get_args();
    187191                        unsigned fanout = args.size();
    188                        
     192
    189193                        ++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ];
    190194                        for ( Expression* arg : args ) {
     
    205209                                return;
    206210                        }
    207                        
     211
    208212                        Stats& stats = for_linkage[ decl->get_linkage() ];
    209213
     
    323327                }
    324328
    325                 void printPairMap( const std::string& name, 
     329                void printPairMap( const std::string& name,
    326330                                   const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) {
    327331                        for ( const auto& entry : map ) {
    328332                                const auto& key = entry.first;
    329                                 std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 
     333                                std::cout << "\"" << name << "\"," << key.first << "," << key.second << ","
    330334                                          << entry.second << std::endl;
    331335                        }
    332336                }
    333                
     337
    334338        public:
    335339                void print() {
     
    366370                stats.print();
    367371        }
    368        
     372
    369373} // namespace CodeTools
    370374
  • src/CodeTools/DeclStats.h

    rfea3faa rb826e6b  
    1717#define DECLSTATS_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <list>  // for list
     20
     21class Declaration;
    2022
    2123namespace CodeTools {
  • src/CodeTools/TrackLoc.cc

    rfea3faa rb826e6b  
    1616#include "TrackLoc.h"
    1717
    18 #include <cstdlib>
     18#include <cstdlib>                    // for size_t, exit, EXIT_FAILURE
     19#include <iostream>                   // for operator<<, ostream, basic_ostream
     20#include <iterator>                   // for back_inserter, inserter
     21#include <stack>                      // for stack
     22#include <string>                     // for operator<<, string
     23#include <typeindex>                  // for type_index
    1924
    20 #include <iostream>
    21 #include <sstream>
    22 #include <stack>
    23 #include <string>
    24 #include <typeindex>
     25#include "Common/PassVisitor.h"       // for PassVisitor
     26#include "Common/PassVisitor.impl.h"  // for acceptAll
     27#include "Common/SemanticError.h"     // for SemanticError
     28#include "Common/utility.h"           // for CodeLocation
     29#include "SynTree/BaseSyntaxNode.h"   // for BaseSyntaxNode
     30#include "SynTree/Mutator.h"          // for mutateAll
     31#include "SynTree/Visitor.h"          // for acceptAll
    2532
    26 #include "Common/utility.h"
    27 #include "Common/PassVisitor.h"
    28 #include "Common/VectorMap.h"
    29 #include "GenPoly/GenPoly.h"
    30 #include "Parser/LinkageSpec.h"
    31 #include "SynTree/Declaration.h"
    32 #include "SynTree/Initializer.h"
     33class Declaration;
    3334
    3435namespace CodeTools {
  • src/CodeTools/TrackLoc.h

    rfea3faa rb826e6b  
    1717#define TRACKLOC_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <cstddef>   // for size_t
     20#include <list>      // for list
     21
     22class Declaration;
    2023
    2124namespace CodeTools {
  • src/Common/Assert.cc

    rfea3faa rb826e6b  
    1414//
    1515
    16 #include <assert.h>
    17 #include <cstdarg>                                                                              // varargs
    18 #include <cstdio>                                                                               // fprintf
    19 #include <cstdlib>                                                                              // abort
     16#include <cstdarg>  // for va_end, va_list, va_start
     17#include <cstdio>   // for fprintf, stderr, vfprintf
     18#include <cstdlib>  // for abort
    2019
    2120extern const char * __progname;                                                 // global name of running executable (argv[0])
  • src/Common/PassVisitor.h

    rfea3faa rb826e6b  
    1212#include "SynTree/Expression.h"
    1313#include "SynTree/Constant.h"
     14#include "SynTree/TypeSubstitution.h"
    1415
    1516#include "PassVisitor.proto.h"
     
    2627//                          stmtsToAddBefore or stmtsToAddAfter respectively.
    2728// | WithShortCircuiting  - provides the ability to skip visiting child nodes; set visit_children to false in pre{visit,mutate} to skip visiting children
    28 // | WithScopes           - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable
     29// | WithGuards           - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable
    2930//                          will automatically be restored to its previous value after the corresponding postvisit/postmutate teminates.
    3031//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    3233class PassVisitor final : public Visitor, public Mutator {
    3334public:
    34         PassVisitor() = default;
    3535
    3636        template< typename... Args >
     
    257257
    258258        void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
    259 
    260         guard_value_impl init_guard() {
    261                 guard_value_impl guard;
    262                 auto at_cleanup = at_cleanup_impl(pass, 0);
    263                 if( at_cleanup ) {
    264                         *at_cleanup = [&guard]( cleanup_func_t && func, void* val ) {
    265                                 guard.push( std::move( func ), val );
    266                         };
    267                 }
    268                 return guard;
    269         }
    270259};
    271260
     
    283272
    284273public:
    285         TypeSubstitution * env;
     274        TypeSubstitution * env = nullptr;
    286275};
    287276
     
    295284        std::list< Statement* > stmtsToAddAfter;
    296285};
     286
     287class WithDeclsToAdd {
     288protected:
     289        WithDeclsToAdd() = default;
     290        ~WithDeclsToAdd() = default;
     291
     292public:
     293        std::list< Declaration* > declsToAddBefore;
     294        std::list< Declaration* > declsToAddAfter;
     295};
     296
    297297class WithShortCircuiting {
    298298protected:
     
    304304};
    305305
    306 class WithScopes {
    307 protected:
    308         WithScopes() = default;
    309         ~WithScopes() = default;
     306class WithGuards {
     307protected:
     308        WithGuards() = default;
     309        ~WithGuards() = default;
    310310
    311311public:
     
    318318                }, static_cast< void * >( & val ) );
    319319        }
     320
     321        template< typename T >
     322        void GuardScope( T& val ) {
     323                val.beginScope();
     324                at_cleanup( []( void * val ) {
     325                        static_cast< T * >( val )->endScope();
     326                }, static_cast< void * >( & val ) );
     327        }
     328
     329        template< typename Func >
     330        void GuardAction( Func func ) {
     331                at_cleanup( [func](__attribute__((unused)) void *) { func(); }, nullptr );
     332        }
    320333};
    321334
     
    323336class WithVisitorRef {
    324337protected:
    325         WithVisitorRef() = default;
    326         ~WithVisitorRef() = default;
    327 
    328 public:
    329         PassVisitor<pass_type> * const visitor;
     338        WithVisitorRef() {}
     339        ~WithVisitorRef() {}
     340
     341public:
     342        PassVisitor<pass_type> * const visitor = nullptr;
    330343};
    331344
  • src/Common/PassVisitor.impl.h

    rfea3faa rb826e6b  
    33#define VISIT_START( node )                     \
    44        __attribute__((unused))                   \
    5         const auto & guard = init_guard();        \
     5        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    66        bool visit_children = true;               \
    77        set_visit_children( visit_children );   \
     
    1515#define MUTATE_START( node )                    \
    1616        __attribute__((unused))                   \
    17         const auto & guard = init_guard();        \
     17        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    1818        bool visit_children = true;               \
    1919        set_visit_children( visit_children );   \
     
    6868        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    6969                // splice in new declarations after previous decl
    70                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
     70                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    7171
    7272                if ( i == decls.end() ) break;
     
    8888        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    8989                // splice in new declarations after previous decl
    90                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
     90                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    9191
    9292                if ( i == decls.end() ) break;
     
    104104void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
    105105        SemanticError errors;
     106
     107        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     108        ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
     109        ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
     110        ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
     111        ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
    106112
    107113        StmtList_t* beforeStmts = get_beforeStmts();
     
    181187Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
    182188        return handleStatement( stmt, [this]( Statement * stmt ) {
    183                 maybeAccept( stmt, *this ); 
     189                maybeAccept( stmt, *this );
    184190                return stmt;
    185191        });
     
    212218                expr->accept( *this );
    213219                return expr;
    214         });             
     220        });
    215221}
    216222
     
    565571        VISIT_START( node );
    566572
     573        // maybeAccept( node->get_env(), *this );
     574        maybeAccept( node->get_result(), *this );
     575
    567576        for ( auto expr : node->get_args() ) {
    568577                visitExpression( expr );
     
    575584Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    576585        MUTATE_START( node );
     586
     587        node->set_env( maybeMutate( node->get_env(), *this ) );
     588        node->set_result( maybeMutate( node->get_result(), *this ) );
    577589
    578590        for ( auto& expr : node->get_args() ) {
  • src/Common/PassVisitor.proto.h

    rfea3faa rb826e6b  
    55
    66typedef std::function<void( void * )> cleanup_func_t;
     7typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
    78
    89class guard_value_impl {
    910public:
    10         guard_value_impl() = default;
     11        guard_value_impl( at_cleanup_t * at_cleanup ) {
     12                if( at_cleanup ) {
     13                        *at_cleanup = [this]( cleanup_func_t && func, void* val ) {
     14                                push( std::move( func ), val );
     15                        };
     16                }
     17        }
    1118
    1219        ~guard_value_impl() {
     
    3340};
    3441
    35 typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
    3642
    3743class bool_ref {
     
    5662// Deep magic (a.k.a template meta programming) to make the templated visitor work
    5763// Basically the goal is to make 2 previsit_impl
    58 // 1 - Use when a pass implements a valid previsit. This uses overloading which means the any overload of 
     64// 1 - Use when a pass implements a valid previsit. This uses overloading which means the any overload of
    5965//     'pass.previsit( node )' that compiles will be used for that node for that type
    6066//     This requires that this option only compile for passes that actually define an appropriate visit.
  • src/Common/SemanticError.cc

    rfea3faa rb826e6b  
    1414//
    1515
    16 #include <iostream>
    17 #include <list>
    18 #include <string>
    19 #include <algorithm>
    20 #include <iterator>
     16#include <cstdio>            // for fileno, stderr
     17#include <unistd.h>          // for isatty
     18#include <iostream>          // for basic_ostream, operator<<, ostream
     19#include <list>              // for list, _List_iterator
     20#include <string>            // for string, operator<<, operator+, to_string
    2121
     22#include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
    2223#include "SemanticError.h"
    23 
    24 #include <unistd.h>
    2524
    2625inline const std::string& error_str() {
  • src/Common/SemanticError.h

    rfea3faa rb826e6b  
    1717#define SEMANTICERROR_H
    1818
    19 #include <exception>
    20 #include <string>
    21 #include <sstream>
    22 #include <list>
    23 #include <iostream>
     19#include <exception>  // for exception
     20#include <iostream>   // for ostream
     21#include <list>       // for list
     22#include <string>     // for string
    2423
    25 #include "utility.h"
     24#include "utility.h"  // for CodeLocation, toString
    2625
    2726struct error {
  • src/Common/utility.h

    rfea3faa rb826e6b  
    305305// for ( val : group_iterate( container1, container2, ... ) ) {}
    306306// syntax to have a for each that iterates multiple containers of the same length
    307 // TODO: update to use variadic arguments
     307// TODO: update to use variadic arguments, perfect forwarding
    308308
    309309template< typename T1, typename T2 >
  • src/Concurrency/Keywords.cc

    rfea3faa rb826e6b  
    1717#include "Concurrency/Keywords.h"
    1818
    19 #include "InitTweak/InitTweak.h"
    20 #include "SymTab/AddVisit.h"
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/Expression.h"
    23 #include "SynTree/Initializer.h"
    24 #include "SynTree/Statement.h"
    25 #include "SynTree/Type.h"
    26 #include "SynTree/Visitor.h"
     19#include <cassert>                 // for assert
     20#include <string>                  // for string, operator==
     21
     22#include "Common/SemanticError.h"  // for SemanticError
     23#include "Common/utility.h"        // for deleteAll, map_range
     24#include "InitTweak/InitTweak.h"   // for isConstructor
     25#include "Parser/LinkageSpec.h"    // for Cforall
     26#include "SymTab/AddVisit.h"       // for acceptAndAdd
     27#include "SynTree/Constant.h"      // for Constant
     28#include "SynTree/Declaration.h"   // for StructDecl, FunctionDecl, ObjectDecl
     29#include "SynTree/Expression.h"    // for VariableExpr, ConstantExpr, Untype...
     30#include "SynTree/Initializer.h"   // for SingleInit, ListInit, Initializer ...
     31#include "SynTree/Label.h"         // for Label
     32#include "SynTree/Statement.h"     // for CompoundStmt, DeclStmt, ExprStmt
     33#include "SynTree/Type.h"          // for StructInstType, Type, PointerType
     34#include "SynTree/Visitor.h"       // for Visitor, acceptAll
     35
     36class Attribute;
    2737
    2838namespace Concurrency {
     
    322332                if( needs_main ) {
    323333                        FunctionType * main_type = new FunctionType( noQualifiers, false );
    324                        
     334
    325335                        main_type->get_parameters().push_back( this_decl->clone() );
    326336
     
    361371        void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
    362372                CompoundStmt * statement = new CompoundStmt( noLabels );
    363                 statement->push_back( 
     373                statement->push_back(
    364374                        new ReturnStmt(
    365375                                noLabels,
     
    386396        //=============================================================================================
    387397        void MutexKeyword::visit(FunctionDecl* decl) {
    388                 Visitor::visit(decl);           
     398                Visitor::visit(decl);
    389399
    390400                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
     
    510520        void ThreadStarter::visit(FunctionDecl * decl) {
    511521                Visitor::visit(decl);
    512                
     522
    513523                if( ! InitTweak::isConstructor(decl->get_name()) ) return;
    514524
     
    528538                if( ! stmt ) return;
    529539
    530                 stmt->push_back( 
     540                stmt->push_back(
    531541                        new ExprStmt(
    532542                                noLabels,
  • src/Concurrency/Keywords.h

    rfea3faa rb826e6b  
    1818#define KEYWORDS_H
    1919
    20 #include <list>
     20#include <list>  // for list
    2121
    22 #include "SynTree/Declaration.h"
     22class Declaration;
    2323
    2424namespace Concurrency {
  • src/ControlStruct/ExceptTranslate.cc

    rfea3faa rb826e6b  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 15:57:00 2017
    13 // Update Count     : 0
     12// Last Modified On : Tus Jul 18 10:09:00 2017
     13// Update Count     : 4
    1414//
    1515
    1616#include "ExceptTranslate.h"
    1717#include "Common/PassVisitor.h"
    18 
    19 namespace ControlFlow {
     18#include "SynTree/Statement.h"
     19#include "SynTree/Declaration.h"
     20#include "SynTree/Expression.h"
     21#include "SynTree/Type.h"
     22#include "SynTree/Attribute.h"
     23
     24namespace ControlStruct {
    2025
    2126        // This (large) section could probably be moved out of the class
     
    2429        // Type(Qualifiers &, false, std::list<Attribute *> &)
    2530
    26         // void (*function)()
    27         static FunctionType void_func_t(Type::Qualifiers(), false);
     31        // void (*function)();
     32        static FunctionType try_func_t(Type::Qualifiers(), false);
    2833        // void (*function)(int, exception);
    2934        static FunctionType catch_func_t(Type::Qualifiers(), false);
     
    3237        // bool (*function)(exception);
    3338        static FunctionType handle_func_t(Type::Qualifiers(), false);
     39        // void (*function)(__attribute__((unused)) void *);
     40        static FunctionType finally_func_t(Type::Qualifiers(), false);
    3441
    3542        static void init_func_types() {
    36                 static init_complete = false;
     43                static bool init_complete = false;
    3744                if (init_complete) {
    3845                        return;
    3946                }
    4047                ObjectDecl index_obj(
    41                         "index_t",
     48                        "__handler_index",
    4249                        Type::StorageClasses(),
    4350                        LinkageSpec::Cforall,
    4451                        /*bitfieldWidth*/ NULL,
    45                         new BasicType(emptyQualifiers, BasicType::UnsignedInt),
     52                        new BasicType( noQualifiers, BasicType::SignedInt ),
    4653                        /*init*/ NULL
    47                 );
     54                        );
    4855                ObjectDecl exception_obj(
    49                         "exception_t",
     56                        "__exception_inst",
    5057                        Type::StorageClasses(),
    5158                        LinkageSpec::Cforall,
    5259                        /*bitfieldWidth*/ NULL,
    53                         new BasicType(emptyQualifiers, BasicType::UnsignedInt),
     60                        new PointerType(
     61                                noQualifiers,
     62                                new BasicType( noQualifiers, BasicType::SignedInt )
     63                                ),
    5464                        /*init*/ NULL
    55                 );
     65                        );
    5666                ObjectDecl bool_obj(
    57                         "bool_t",
     67                        "__ret_bool",
    5868                        Type::StorageClasses(),
    5969                        LinkageSpec::Cforall,
    6070                        /*bitfieldWidth*/ NULL,
    61                         new BasicType(emptyQualifiers, BasicType::Bool),
     71                        new BasicType(noQualifiers, BasicType::Bool),
    6272                        /*init*/ NULL
    63                 );
    64 
    65                 catch_func_t.get_parameters().push_back(index_obj.clone());
    66                 catch_func_t.get_parameters().push_back(exception_obj.clone());
    67                 match_func_t.get_returnVals().push_back(index_obj.clone());
    68                 match_func_t.get_parameters().push_back(exception_obj.clone());
    69                 handle_func_t.get_returnVals().push_back(bool_obj.clone());
    70                 handle_func_t.get_parameters().push_back(exception_obj.clone());
     73                        );
     74                ObjectDecl voidptr_obj(
     75                        "__hook",
     76                        Type::StorageClasses(),
     77                        LinkageSpec::Cforall,
     78                        NULL,
     79                        new PointerType(
     80                                noQualifiers,
     81                                new VoidType(
     82                                        noQualifiers
     83                                        ),
     84                                std::list<Attribute *>{new Attribute("unused")}
     85                                ),
     86                        NULL
     87                        );
     88
     89                catch_func_t.get_parameters().push_back( index_obj.clone() );
     90                catch_func_t.get_parameters().push_back( exception_obj.clone() );
     91                match_func_t.get_returnVals().push_back( index_obj.clone() );
     92                match_func_t.get_parameters().push_back( exception_obj.clone() );
     93                handle_func_t.get_returnVals().push_back( bool_obj.clone() );
     94                handle_func_t.get_parameters().push_back( exception_obj.clone() );
     95                finally_func_t.get_parameters().push_back( voidptr_obj.clone() );
    7196
    7297                init_complete = true;
     
    78103
    79104        void split( CatchList& allHandlers, CatchList& terHandlers,
    80                     CatchList& resHandlers ) {
     105                                CatchList& resHandlers ) {
    81106                while ( !allHandlers.empty() ) {
    82                         Statement * stmt = allHandlers.front();
     107                        CatchStmt * stmt = allHandlers.front();
    83108                        allHandlers.pop_front();
    84                         if (CaseStmt::Terminate == stmt->get_kind()) {
     109                        if (CatchStmt::Terminate == stmt->get_kind()) {
    85110                                terHandlers.push_back(stmt);
    86111                        } else {
     
    92117        template<typename T>
    93118        void free_all( std::list<T *> &list ) {
    94                 std::list<T *>::iterator it;
     119                typename std::list<T *>::iterator it;
    95120                for ( it = list.begin() ; it != list.end() ; ++it ) {
    96121                        delete *it;
     
    100125
    101126        void appendDeclStmt( CompoundStmt * block, Declaration * item ) {
    102                 block->push_back(new DeclStmt(no_labels, item));
    103         }
    104 
    105         Expression * nameOf( FunctionDecl * function ) {
    106                 return new VariableExpr( function );
     127                block->push_back(new DeclStmt(noLabels, item));
     128        }
     129
     130        Expression * nameOf( DeclarationWithType * decl ) {
     131                return new VariableExpr( decl );
    107132        }
    108133
    109134        // ThrowStmt Mutation Helpers
    110135
    111         Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
    112                 // __throw_terminate( EXPR );
    113                 ApplicationExpr * call = new ApplicationExpr( /* ... */ );
    114                 call->get_args.push_back( throwStmt->get_expr() );
    115                 Statement * result = new ExprStmt( throwStmt->get_labels(), call );
     136        Statement * create_given_throw(
     137                        const char * throwFunc, ThrowStmt * throwStmt ) {
     138                // { int NAME = EXPR; throwFunc( &NAME ); }
     139                CompoundStmt * result = new CompoundStmt( noLabels );
     140                ObjectDecl * local = new ObjectDecl(
     141                        "__local_exception_copy",
     142                        Type::StorageClasses(),
     143                        LinkageSpec::Cforall,
     144                        NULL,
     145                        new BasicType( noQualifiers, BasicType::SignedInt ),
     146                        new SingleInit( throwStmt->get_expr() )
     147                        );
     148                appendDeclStmt( result, local );
     149                UntypedExpr * call = new UntypedExpr( new NameExpr( throwFunc ) );
     150                call->get_args().push_back( new AddressExpr( nameOf( local ) ) );
     151                result->push_back( new ExprStmt( throwStmt->get_labels(), call ) );
    116152                throwStmt->set_expr( nullptr );
    117153                delete throwStmt;
    118154                return result;
    119155        }
     156
     157        Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
     158                // { int NAME = EXPR; __throw_terminate( &NAME ); }
     159                return create_given_throw( "__cfaehm__throw_terminate", throwStmt );
     160        }
    120161        Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) {
    121162                // __rethrow_terminate();
     163                assert( nullptr == throwStmt->get_expr() );
    122164                Statement * result = new ExprStmt(
    123165                        throwStmt->get_labels(),
    124                         new ApplicationExpr( /* ... */ );
     166                        new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) )
    125167                        );
    126168                delete throwStmt;
     
    129171        Statement * create_resume_throw( ThrowStmt *throwStmt ) {
    130172                // __throw_resume( EXPR );
    131                 ApplicationExpr * call = new ApplicationExpr( /* ... */ );
    132                 call->get_args.push_back( throwStmt->get_expr() );
    133                 Statement * result = new ExprStmt( throwStmt->get_labels(), call );
    134                 throwStmt->set_expr( nullptr );
    135                 delete throwStmt;
    136                 return result;
     173                return create_given_throw( "__cfaehm__throw_resume", throwStmt );
    137174        }
    138175        Statement * create_resume_rethrow( ThrowStmt *throwStmt ) {
     
    140177                Statement * result = new ReturnStmt(
    141178                        throwStmt->get_labels(),
    142                         new ConstantExpr(
    143                                 Constant(
    144                                         new BasicType(
    145                                                 Type::Qualifiers(),
    146                                                 BasicType::Bool
    147                                                 ),
    148                                         "0")
    149                                 )
     179                        new ConstantExpr( Constant::from_bool( false ) )
    150180                        );
    151181                delete throwStmt;
     
    160190                return block;
    161191        }
    162         FunctionDecl * create_try_wrapper( TryStmt *tryStmt ) {
    163                 CompoundStmt * body = base_try->get_block();
    164                 base_try->set_block(nullptr);
    165 
    166                 return new FunctionDecl("try", Type::StorageClasses(),
    167                         LinkageSpec::Cforall, void_func_t, body);
     192        FunctionDecl * create_try_wrapper( CompoundStmt *body ) {
     193
     194                return new FunctionDecl( "try", Type::StorageClasses(),
     195                        LinkageSpec::Cforall, try_func_t.clone(), body );
    168196        }
    169197
    170198        FunctionDecl * create_terminate_catch( CatchList &handlers ) {
    171199                std::list<CaseStmt *> handler_wrappers;
     200
     201                FunctionType *func_type = catch_func_t.clone();
     202                DeclarationWithType * index_obj = func_type->get_parameters().front();
     203        //      DeclarationWithType * except_obj = func_type->get_parameters().back();
    172204
    173205                // Index 1..{number of handlers}
     
    178210                        CatchStmt * handler = *it;
    179211
    180                         std::list<Statement *> core;
    181                         if ( /*the exception is named*/ ) {
    182                                 ObjectDecl * local_except = /* Dynamic case, same */;
    183                                 core->push_back( new DeclStmt( noLabel, local_except ) );
    184                         }
    185                         // Append the provided statement to the handler.
    186                         core->push_back( cur_handler->get_body() );
    187                         // Append return onto the inner block? case stmt list?
    188                         CaseStmt * wrapper = new CaseStmt(
     212                        // INTEGERconstant Version
     213                        // case `index`:
     214                        // {
     215                        //     `handler.body`
     216                        // }
     217                        // return;
     218                        std::list<Statement *> caseBody;
     219                        caseBody.push_back( handler->get_body() );
     220                        handler->set_body( nullptr );
     221                        caseBody.push_back( new ReturnStmt( noLabels, nullptr ) );
     222
     223                        handler_wrappers.push_back( new CaseStmt(
    189224                                noLabels,
    190225                                new ConstantExpr( Constant::from_int( index ) ),
    191                                 core
    192                                 );
    193                         handler_wrappers.push_back(wrapper);
     226                                caseBody
     227                                ) );
    194228                }
    195229                // TODO: Some sort of meaningful error on default perhaps?
     230
     231                std::list<Statement*> stmt_handlers;
     232                while ( !handler_wrappers.empty() ) {
     233                        stmt_handlers.push_back( handler_wrappers.front() );
     234                        handler_wrappers.pop_front();
     235                }
    196236
    197237                SwitchStmt * handler_lookup = new SwitchStmt(
    198238                        noLabels,
    199                         /*parameter 0: index*/,
    200                         handler_wrappers,
    201                         false
     239                        nameOf( index_obj ),
     240                        stmt_handlers
    202241                        );
    203242                CompoundStmt * body = new CompoundStmt( noLabels );
     
    205244
    206245                return new FunctionDecl("catch", Type::StorageClasses(),
    207                         LinkageSpec::Cforall, catch_func_t, body);
     246                        LinkageSpec::Cforall, func_type, body);
    208247        }
    209248
    210249        // Create a single check from a moddified handler.
    211         CompoundStmt *create_single_matcher( CatchStmt * modded_handler ) {
    212                 CompoundStmt * block = new CompoundStmt( noLables );
    213 
    214                 appendDeclStmt( block, modded_handler->get_decl() );
    215 
    216                 // TODO: This is not the actual check.
    217                 LogicalExpr * cond = new ConstantExpr( Constant::from_bool( false ) );
     250        // except_obj is referenced, modded_handler will be freed.
     251        CompoundStmt *create_single_matcher(
     252                        DeclarationWithType * except_obj, CatchStmt * modded_handler ) {
     253                CompoundStmt * block = new CompoundStmt( noLabels );
     254
     255                // INTEGERconstant Version
     256                assert( nullptr == modded_handler->get_decl() );
     257                ConstantExpr * number =
     258                        dynamic_cast<ConstantExpr*>( modded_handler->get_cond() );
     259                assert( number );
     260                modded_handler->set_cond( nullptr );
     261
     262                Expression * cond;
     263                {
     264                        std::list<Expression *> args;
     265                        args.push_back( number );
     266
     267                        std::list<Expression *> rhs_args;
     268                        rhs_args.push_back( nameOf( except_obj ) );
     269                        Expression * rhs = new UntypedExpr(
     270                                new NameExpr( "*?" ), rhs_args );
     271                        args.push_back( rhs );
     272
     273                        cond = new UntypedExpr( new NameExpr( "?==?" /*???*/), args );
     274                }
    218275
    219276                if ( modded_handler->get_cond() ) {
    220                         cond = new LogicalExpr( cond, modded_handler->get_cond() )q
     277                        cond = new LogicalExpr( cond, modded_handler->get_cond() );
    221278                }
    222279                block->push_back( new IfStmt( noLabels,
    223                         cond, modded_handler->get_body() );
     280                        cond, modded_handler->get_body(), nullptr ) );
    224281
    225282                modded_handler->set_decl( nullptr );
     
    232289        FunctionDecl * create_terminate_match( CatchList &handlers ) {
    233290                CompoundStmt * body = new CompoundStmt( noLabels );
     291
     292                FunctionType * func_type = match_func_t.clone();
     293                DeclarationWithType * except_obj = func_type->get_parameters().back();
    234294
    235295                // Index 1..{number of handlers}
     
    240300                        CatchStmt * handler = *it;
    241301
    242                         // body should have been taken by create_terminate_catch.
    243                         // assert( nullptr == handler->get_body() );
     302                        // Body should have been taken by create_terminate_catch.
     303                        assert( nullptr == handler->get_body() );
     304
     305                        // Create new body.
    244306                        handler->set_body( new ReturnStmt( noLabels,
    245307                                new ConstantExpr( Constant::from_int( index ) ) ) );
    246308
    247                         body->push_back( create_single_matcher( handler ) );
    248                 }
     309                        // Create the handler.
     310                        body->push_back( create_single_matcher( except_obj, handler ) );
     311                        *it = nullptr;
     312                }
     313
     314                body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
     315                        Constant::from_int( 0 ) ) ) );
    249316
    250317                return new FunctionDecl("match", Type::StorageClasses(),
    251                         LinkageSpec::Cforall, match_func_t, body);
    252         }
    253 
    254         Statement * create_terminate_caller(
     318                        LinkageSpec::Cforall, func_type, body);
     319        }
     320
     321        CompoundStmt * create_terminate_caller(
    255322                        FunctionDecl * try_wrapper,
    256323                        FunctionDecl * terminate_catch,
    257324                        FunctionDecl * terminate_match) {
    258325
    259                 ApplicationExpr * caller = new ApplicationExpr( /* ... */ );
    260                 std::list<Expression *>& args = caller.get_args();
     326                UntypedExpr * caller = new UntypedExpr( new NameExpr(
     327                        "__cfaehm__try_terminate" ) );
     328                std::list<Expression *>& args = caller->get_args();
    261329                args.push_back( nameOf( try_wrapper ) );
    262330                args.push_back( nameOf( terminate_catch ) );
    263331                args.push_back( nameOf( terminate_match ) );
    264332
    265                 return new ExprStmt( noLabels, caller );
     333                CompoundStmt * callStmt = new CompoundStmt( noLabels );
     334                callStmt->push_back( new ExprStmt( noLabels, caller ) );
     335                return callStmt;
    266336        }
    267337
    268338        FunctionDecl * create_resume_handler( CatchList &handlers ) {
    269                 CompoundStmt * body = new CompountStmt( noLabels );
     339                CompoundStmt * body = new CompoundStmt( noLabels );
     340
     341                FunctionType * func_type = match_func_t.clone();
     342                DeclarationWithType * except_obj = func_type->get_parameters().back();
    270343
    271344                CatchList::iterator it;
     
    280353                                handling_code->push_back( handler->get_body() );
    281354                        }
    282                         handling_code->push_back( new ReturnStmt( noLabel,
    283                                 new ConstantExpr( Constant::from_bool( false ) ) ) );
     355                        handling_code->push_back( new ReturnStmt( noLabels,
     356                                new ConstantExpr( Constant::from_bool( true ) ) ) );
    284357                        handler->set_body( handling_code );
    285358
    286359                        // Create the handler.
    287                         body->push_back( create_single_matcher( handler ) );
    288                 }
     360                        body->push_back( create_single_matcher( except_obj, handler ) );
     361                        *it = nullptr;
     362                }
     363
     364                body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
     365                        Constant::from_bool( false ) ) ) );
    289366
    290367                return new FunctionDecl("handle", Type::StorageClasses(),
    291                         LinkageSpec::Cforall, handle_func_t, body);
    292         }
    293 
    294         Statement * create_resume_wrapper(
     368                        LinkageSpec::Cforall, func_type, body);
     369        }
     370
     371        CompoundStmt * create_resume_wrapper(
     372                        StructDecl * node_decl,
    295373                        Statement * wraps,
    296374                        FunctionDecl * resume_handler ) {
    297375                CompoundStmt * body = new CompoundStmt( noLabels );
    298376
    299                 // struct node = {current top resume handler, call to resume_handler};
    300                 // __attribute__((cleanup( ... )));
    301                 // set top resume handler to node.
    302                 // The wrapped statement.
    303 
    304                 ListInit * node_init;
    305                 {
    306                         std::list<Initializer*> field_inits;
    307                         field_inits.push_back( new SingleInit( /* ... */ ) );
    308                         field_inits.push_back( new SingleInit( nameOf( resume_handler ) ) );
    309                         node_init = new ListInit( field_inits );
    310                 }
     377                // struct __try_resume_node __resume_node
     378                //      __attribute__((cleanup( __cfaehm__try_resume_cleanup )));
     379                // ** unwinding of the stack here could cause problems **
     380                // ** however I don't think that can happen currently **
     381                // __cfaehm__try_resume_setup( &__resume_node, resume_handler );
    311382
    312383                std::list< Attribute * > attributes;
    313384                {
    314385                        std::list< Expression * > attr_params;
    315                         attr_params.push_back( nameOf( /* ... deconstructor ... */ ) );
    316                         attrributes.push_back( new Attribute( "cleanup", attr_params ) );
    317                 }
    318 
    319                 appendDeclStmt( body,
    320                 /**/ ObjectDecl(
    321                         "resume_node",
     386                        attr_params.push_back( new NameExpr(
     387                                "__cfaehm__try_resume_cleanup" ) );
     388                        attributes.push_back( new Attribute( "cleanup", attr_params ) );
     389                }
     390
     391                ObjectDecl * obj = new ObjectDecl(
     392                        "__resume_node",
    322393                        Type::StorageClasses(),
    323394                        LinkageSpec::Cforall,
    324395                        nullptr,
    325                         /* Type* = resume_node */,
    326                         node_init,
     396                        new StructInstType(
     397                                Type::Qualifiers(),
     398                                node_decl
     399                                ),
     400                        nullptr,
    327401                        attributes
    328                         )
    329                 );
     402                        );
     403                appendDeclStmt( body, obj );
     404
     405                UntypedExpr *setup = new UntypedExpr( new NameExpr(
     406                        "__cfaehm__try_resume_setup" ) );
     407                setup->get_args().push_back( new AddressExpr( nameOf( obj ) ) );
     408                setup->get_args().push_back( nameOf( resume_handler ) );
     409
     410                body->push_back( new ExprStmt( noLabels, setup ) );
     411
    330412                body->push_back( wraps );
    331413                return body;
     
    333415
    334416        FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ) {
    335                 CompoundStmt * body = tryStmt->get_finally();
     417                FinallyStmt * finally = tryStmt->get_finally();
     418                CompoundStmt * body = finally->get_block();
     419                finally->set_block( nullptr );
     420                delete finally;
    336421                tryStmt->set_finally( nullptr );
    337422
    338423                return new FunctionDecl("finally", Type::StorageClasses(),
    339                         LinkageSpec::Cforall, void_func_t, body);
    340         }
    341 
    342         ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ) {
    343                 // struct _cleanup_hook NAME __attribute__((cleanup( ... )));
     424                        LinkageSpec::Cforall, finally_func_t.clone(), body);
     425        }
     426
     427        ObjectDecl * create_finally_hook(
     428                        StructDecl * hook_decl, FunctionDecl * finally_wrapper ) {
     429                // struct __cfaehm__cleanup_hook __finally_hook
     430                //      __attribute__((cleanup( finally_wrapper )));
    344431
    345432                // Make Cleanup Attribute.
     
    348435                        std::list< Expression * > attr_params;
    349436                        attr_params.push_back( nameOf( finally_wrapper ) );
    350                         attrributes.push_back( new Attribute( "cleanup", attr_params ) );
    351                 }
    352 
    353                 return ObjectDecl( /* ... */
    354                         const std::string &name "finally_hook",
     437                        attributes.push_back( new Attribute( "cleanup", attr_params ) );
     438                }
     439
     440                return new ObjectDecl(
     441                        "__finally_hook",
    355442                        Type::StorageClasses(),
    356443                        LinkageSpec::Cforall,
    357444                        nullptr,
    358                         /* ... Type * ... */,
     445                        new StructInstType(
     446                                noQualifiers,
     447                                hook_decl
     448                                ),
    359449                        nullptr,
    360450                        attributes
     
    363453
    364454
    365         class ExceptionMutatorCore : public WithScoping {
     455        class ExceptionMutatorCore : public WithGuards {
    366456                enum Context { NoHandler, TerHandler, ResHandler };
    367457
     
    370460                // loop, switch or the goto stays within the function.
    371461
    372                 Context curContext;
     462                Context cur_context;
    373463
    374464                // We might not need this, but a unique base for each try block's
     
    377467                //unsigned int try_count = 0;
    378468
     469                StructDecl *node_decl;
     470                StructDecl *hook_decl;
    379471
    380472        public:
    381473                ExceptionMutatorCore() :
    382                         curContext(NoHandler)
     474                        cur_context(NoHandler),
     475                        node_decl(nullptr), hook_decl(nullptr)
    383476                {}
    384477
    385                 void premutate( CatchStmt *tryStmt );
     478                void premutate( CatchStmt *catchStmt );
     479                void premutate( StructDecl *structDecl );
    386480                Statement * postmutate( ThrowStmt *throwStmt );
    387481                Statement * postmutate( TryStmt *tryStmt );
     
    393487                        if ( throwStmt->get_expr() ) {
    394488                                return create_terminate_throw( throwStmt );
    395                         } else if ( TerHandler == curContext ) {
     489                        } else if ( TerHandler == cur_context ) {
    396490                                return create_terminate_rethrow( throwStmt );
    397491                        } else {
    398492                                assertf(false, "Invalid throw in %s at %i\n",
    399                                         throwStmt->location.filename,
     493                                        throwStmt->location.filename.c_str(),
    400494                                        throwStmt->location.linenumber);
    401495                                return nullptr;
     
    404498                        if ( throwStmt->get_expr() ) {
    405499                                return create_resume_throw( throwStmt );
    406                         } else if ( ResHandler == curContext ) {
     500                        } else if ( ResHandler == cur_context ) {
    407501                                return create_resume_rethrow( throwStmt );
    408502                        } else {
    409503                                assertf(false, "Invalid throwResume in %s at %i\n",
    410                                         throwStmt->location.filename,
     504                                        throwStmt->location.filename.c_str(),
    411505                                        throwStmt->location.linenumber);
    412506                                return nullptr;
     
    416510
    417511        Statement * ExceptionMutatorCore::postmutate( TryStmt *tryStmt ) {
     512                assert( node_decl );
     513                assert( hook_decl );
     514
    418515                // Generate a prefix for the function names?
    419516
    420                 CompoundStmt * block = new CompoundStmt();
    421                 Statement * inner = take_try_block( tryStmt );
     517                CompoundStmt * block = new CompoundStmt( noLabels );
     518                CompoundStmt * inner = take_try_block( tryStmt );
    422519
    423520                if ( tryStmt->get_finally() ) {
     
    427524                        appendDeclStmt( block, finally_block );
    428525                        // Create and add the finally cleanup hook.
    429                         appendDeclStmt( block, create_finally_hook( finally_block ) );
    430                 }
    431 
    432                 StatementList termination_handlers;
    433                 StatementList resumption_handlers;
    434                 split( tryStmt->get_handlers(),
    435                        termination_handlers, resumption_handlers );
    436 
    437                 if ( resumeption_handlers.size() ) {
     526                        appendDeclStmt( block,
     527                                create_finally_hook( hook_decl, finally_block ) );
     528                }
     529
     530                CatchList termination_handlers;
     531                CatchList resumption_handlers;
     532                split( tryStmt->get_catchers(),
     533                           termination_handlers, resumption_handlers );
     534
     535                if ( resumption_handlers.size() ) {
    438536                        // Define the helper function.
    439537                        FunctionDecl * resume_handler =
     
    441539                        appendDeclStmt( block, resume_handler );
    442540                        // Prepare hooks
    443                         inner = create_resume_wrapper( inner, resume_handler );
     541                        inner = create_resume_wrapper( node_decl, inner, resume_handler );
    444542                }
    445543
     
    462560                block->push_back( inner );
    463561
    464                 free_all( termination_handlers );
    465                 free_all( resumption_handlers );
     562                //free_all( termination_handlers );
     563                //free_all( resumption_handlers );
    466564
    467565                return block;
     
    469567
    470568        void ExceptionMutatorCore::premutate( CatchStmt *catchStmt ) {
    471                 GuardValue( curContext );
    472                 if ( CatchStmt::Termination == catchStmt->get_kind() ) {
    473                         curContext = TerHandler;
     569                GuardValue( cur_context );
     570                if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
     571                        cur_context = TerHandler;
    474572                } else {
    475                         curContext = ResHandler;
    476                 }
    477         }
    478 
    479     void translateEHM( std::list< Declaration *> & translationUnit ) {
     573                        cur_context = ResHandler;
     574                }
     575        }
     576
     577        void ExceptionMutatorCore::premutate( StructDecl *structDecl ) {
     578                if ( !structDecl->has_body() ) {
     579                        // Skip children?
     580                        return;
     581                } else if ( structDecl->get_name() == "__cfaehm__try_resume_node" ) {
     582                        assert( nullptr == node_decl );
     583                        node_decl = structDecl;
     584                } else if ( structDecl->get_name() == "__cfaehm__cleanup_hook" ) {
     585                        assert( nullptr == hook_decl );
     586                        hook_decl = structDecl;
     587                }
     588                // Later we might get the exception type as well.
     589        }
     590
     591        void translateEHM( std::list< Declaration *> & translationUnit ) {
     592                init_func_types();
     593
    480594                PassVisitor<ExceptionMutatorCore> translator;
    481                 for ( Declaration * decl : translationUnit ) {
    482                         decl->mutate( translator );
    483                 }
     595                mutateAll( translationUnit, translator );
    484596        }
    485597}
  • src/ControlStruct/ExceptTranslate.h

    rfea3faa rb826e6b  
    1010// Created On       : Tus Jun 06 10:13:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 15:57:00 2017
    13 // Update Count     : 0
     12// Last Modified On : Fri Jun 30 10:20:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    1717#define EXCEPT_TRANSLATE_H
    1818
    19 namespace ControlFlow {
     19#include <list>
     20#include "SynTree/SynTree.h"
     21
     22namespace ControlStruct {
    2023        void translateEHM( std::list< Declaration *> & translationUnit );
    2124        /* Converts exception handling structures into their underlying C code.
  • src/ControlStruct/module.mk

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    506506                DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) {
    507507                        if ( functionDecl->get_statements() ) {         // empty routine body ?
     508                                // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;
    508509                                doBeginScope();
    509510                                scopeTyVars.beginScope();
     
    550551                                retval = oldRetval;
    551552                                doEndScope();
     553                                // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;
    552554                        } // if
    553555                        return functionDecl;
     
    11181120
    11191121                Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
    1120                         // std::cerr << "mutate appExpr: ";
     1122                        // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
    11211123                        // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
    11221124                        //      std::cerr << i->first << " ";
     
    11431145                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
    11441146
     1147                        // std::cerr << function << std::endl;
     1148                        // std::cerr << "scopeTyVars: ";
     1149                        // printTyVarMap( std::cerr, scopeTyVars );
     1150                        // std::cerr << "exprTyVars: ";
     1151                        // printTyVarMap( std::cerr, exprTyVars );
     1152                        // std::cerr << "env: " << *env << std::endl;
     1153                        // std::cerr << needsAdapter( function, scopeTyVars ) << ! needsAdapter( function, exprTyVars) << std::endl;
     1154
    11451155                        // 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
    11461156                        // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int))
    11471157                        // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome.
    11481158                        if ( dynRetType ) {
     1159                                // std::cerr << "dynRetType: " << dynRetType << std::endl;
    11491160                                Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result();
    11501161                                ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType
  • src/GenPoly/InstantiateGeneric.cc

    rfea3faa rb826e6b  
    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( __attribute__((unused)) 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;
     
    368349                                substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    369350                                insert( inst, typeSubs, concDecl ); // must insert before recursion
    370                                 concDecl->acceptMutator( *this ); // recursively instantiate members
    371                                 DeclMutator::addDeclaration( concDecl ); // must occur before declaration is added so that member instantiations appear first
     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;
     
    423399                                substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    424400                                insert( inst, typeSubs, concDecl ); // must insert before recursion
    425                                 concDecl->acceptMutator( *this ); // recursively instantiate members
    426                                 DeclMutator::addDeclaration( concDecl ); // must occur before declaration is added so that member instantiations appear first
     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/InitTweak/FixInit.cc

    rfea3faa rb826e6b  
    104104                        typedef AddStmtVisitor Parent;
    105105                        using Parent::visit;
    106                         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;
    107108                        virtual void visit( CompoundStmt *compoundStmt ) override;
    108109                        virtual void visit( DeclStmt *stmt ) override;
     
    116117
    117118                // debug
    118                 struct printSet {
    119                         typedef ObjDeclCollector::ObjectSet ObjectSet;
    120                         printSet( const ObjectSet & objs ) : objs( objs ) {}
     119                template<typename ObjectSet>
     120                struct PrintSet {
     121                        PrintSet( const ObjectSet & objs ) : objs( objs ) {}
    121122                        const ObjectSet & objs;
    122123                };
    123                 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) {
    124128                        out << "{ ";
    125129                        for ( ObjectDecl * obj : set.objs ) {
     
    724728                                                // static bool __objName_uninitialized = true
    725729                                                BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    726                                                 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ), noDesignators );
     730                                                SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ) );
    727731                                                ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
    728732                                                isUninitializedVar->fixUniqueId();
     
    745749
    746750                                                Statement * dtor = ctorInit->get_dtor();
    747                                                 objDecl->set_init( NULL );
    748                                                 ctorInit->set_ctor( NULL );
     751                                                objDecl->set_init( nullptr );
     752                                                ctorInit->set_ctor( nullptr );
    749753                                                ctorInit->set_dtor( nullptr );
    750754                                                if ( dtor ) {
     
    799803                                                } else {
    800804                                                        stmtsToAddAfter.push_back( ctor );
    801                                                         objDecl->set_init( NULL );
    802                                                         ctorInit->set_ctor( NULL );
     805                                                        objDecl->set_init( nullptr );
     806                                                        ctorInit->set_ctor( nullptr );
    803807                                                }
    804808                                        } // if
    805809                                } else if ( Initializer * init = ctorInit->get_init() ) {
    806810                                        objDecl->set_init( init );
    807                                         ctorInit->set_init( NULL );
     811                                        ctorInit->set_init( nullptr );
    808812                                } else {
    809813                                        // no constructor and no initializer, which is okay
    810                                         objDecl->set_init( NULL );
     814                                        objDecl->set_init( nullptr );
    811815                                } // if
    812816                                delete ctorInit;
     
    816820
    817821                void ObjDeclCollector::visit( CompoundStmt * compoundStmt ) {
    818                         std::set< ObjectDecl * > prevVars = curVars;
     822                        ObjectSet prevVars = curVars;
    819823                        Parent::visit( compoundStmt );
    820824                        curVars = prevVars;
     
    824828                        // keep track of all variables currently in scope
    825829                        if ( ObjectDecl * objDecl = dynamic_cast< ObjectDecl * > ( stmt->get_decl() ) ) {
    826                                 curVars.insert( objDecl );
     830                                curVars.push_back( objDecl );
    827831                        } // if
    828832                        Parent::visit( stmt );
     
    939943                        )
    940944                        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
    941948                                // go through decl ordered list of objectdecl. for each element that occurs in diff, output destructor
    942949                                OrderedDecls ordered;
    943950                                for ( OrderedDecls & rdo : reverseDeclOrder ) {
    944951                                        // add elements from reverseDeclOrder into ordered if they occur in diff - it is key that this happens in reverse declaration order.
    945                                         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 ); } );
    946953                                } // for
    947954                                insertDtors( ordered.begin(), ordered.end(), back_inserter( stmtsToAdd ) );
  • src/InitTweak/GenInit.cc

    rfea3faa rb826e6b  
    4444        }
    4545
    46         class ReturnFixer : public WithStmtsToAdd, public WithScopes {
    47           public:
     46        struct ReturnFixer : public WithStmtsToAdd, public WithGuards {
    4847                /// consistently allocates a temporary variable for the return value
    4948                /// of a function so that anything which the resolver decides can be constructed
     
    5958        };
    6059
    61         class CtorDtor final : public GenPoly::PolyMutator {
    62           public:
    63                 typedef GenPoly::PolyMutator Parent;
    64                 using Parent::mutate;
     60        struct CtorDtor : public WithGuards, public WithShortCircuiting  {
    6561                /// create constructor and destructor statements for object declarations.
    6662                /// the actual call statements will be added in after the resolver has run
     
    6965                static void generateCtorDtor( std::list< Declaration * > &translationUnit );
    7066
    71                 virtual DeclarationWithType * mutate( ObjectDecl * ) override;
    72                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
     67                void previsit( ObjectDecl * );
     68                void previsit( FunctionDecl *functionDecl );
     69
    7370                // should not traverse into any of these declarations to find objects
    7471                // that need to be constructed or destructed
    75                 virtual Declaration* mutate( StructDecl *aggregateDecl ) override;
    76                 virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
    77                 virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
    78                 virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
    79                 virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
    80                 virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
    81 
    82                 virtual Type * mutate( FunctionType *funcType ) override { return funcType; }
    83 
    84                 virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override;
     72                void previsit( StructDecl *aggregateDecl );
     73                void previsit( __attribute__((unused)) UnionDecl    * aggregateDecl ) { visit_children = false; }
     74                void previsit( __attribute__((unused)) EnumDecl     * aggregateDecl ) { visit_children = false; }
     75                void previsit( __attribute__((unused)) TraitDecl    * aggregateDecl ) { visit_children = false; }
     76                void previsit( __attribute__((unused)) TypeDecl     * typeDecl )      { visit_children = false; }
     77                void previsit( __attribute__((unused)) TypedefDecl  * typeDecl )      { visit_children = false; }
     78                void previsit( __attribute__((unused)) FunctionType * funcType )      { visit_children = false; }
     79
     80                void previsit( CompoundStmt * compoundStmt );
    8581
    8682          private:
     
    211207
    212208        void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) {
    213                 CtorDtor ctordtor;
    214                 mutateAll( translationUnit, ctordtor );
     209                PassVisitor<CtorDtor> ctordtor;
     210                acceptAll( translationUnit, ctordtor );
    215211        }
    216212
     
    289285        }
    290286
    291         DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {
     287        void CtorDtor::previsit( ObjectDecl * objDecl ) {
    292288                handleDWT( objDecl );
    293289                // hands off if @=, extern, builtin, etc.
     
    301297                        objDecl->set_init( genCtorInit( objDecl ) );
    302298                }
    303                 return Parent::mutate( objDecl );
    304         }
    305 
    306         DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) {
    307                 ValueGuard< bool > oldInFunc = inFunction;
     299        }
     300
     301        void CtorDtor::previsit( FunctionDecl *functionDecl ) {
     302                GuardValue( inFunction );
    308303                inFunction = true;
    309304
    310305                handleDWT( functionDecl );
    311306
    312                 managedTypes.beginScope();
     307                GuardScope( managedTypes );
    313308                // go through assertions and recursively add seen ctor/dtors
    314309                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
     
    317312                        }
    318313                }
    319                 // parameters should not be constructed and destructed, so don't mutate FunctionType
    320                 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
    321 
    322                 managedTypes.endScope();
    323                 return functionDecl;
    324         }
    325 
    326         Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) {
     314
     315                PassVisitor<CtorDtor> newCtorDtor;
     316                newCtorDtor.pass = *this;
     317                maybeAccept( functionDecl->get_statements(), newCtorDtor );
     318                visit_children = false;  // do not try and construct parameters or forall parameters - must happen after maybeAccept
     319        }
     320
     321        void CtorDtor::previsit( StructDecl *aggregateDecl ) {
     322                visit_children = false; // do not try to construct and destruct aggregate members
     323
    327324                // don't construct members, but need to take note if there is a managed member,
    328325                // because that means that this type is also managed
     
    336333                        }
    337334                }
    338                 return aggregateDecl;
    339         }
    340 
    341         CompoundStmt * CtorDtor::mutate( CompoundStmt * compoundStmt ) {
    342                 managedTypes.beginScope();
    343                 CompoundStmt * stmt = Parent::mutate( compoundStmt );
    344                 managedTypes.endScope();
    345                 return stmt;
    346         }
    347 
     335        }
     336
     337        void CtorDtor::previsit( __attribute__((unused)) CompoundStmt * compoundStmt ) {
     338                GuardScope( managedTypes );
     339        }
    348340} // namespace InitTweak
    349341
  • src/InitTweak/InitTweak.cc

    rfea3faa rb826e6b  
    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
  • src/MakeLibCfa.cc

    rfea3faa rb826e6b  
    1515
    1616#include "MakeLibCfa.h"
    17 #include "SynTree/Visitor.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Type.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Statement.h"
    22 #include "SynTree/Initializer.h"
    23 #include "CodeGen/OperatorTable.h"
    24 #include "Common/UniqueName.h"
     17
     18#include <cassert>                 // for assert
     19#include <string>                   // for operator==, string
     20
     21#include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup, Ope...
     22#include "Common/SemanticError.h"   // for SemanticError
     23#include "Common/UniqueName.h"      // for UniqueName
     24#include "Parser/LinkageSpec.h"     // for Spec, Intrinsic, C
     25#include "SynTree/Declaration.h"    // for FunctionDecl, ObjectDecl, Declara...
     26#include "SynTree/Expression.h"     // for NameExpr, UntypedExpr, VariableExpr
     27#include "SynTree/Initializer.h"    // for SingleInit
     28#include "SynTree/Label.h"          // for Label
     29#include "SynTree/Statement.h"      // for CompoundStmt, ReturnStmt
     30#include "SynTree/Type.h"           // for FunctionType
     31#include "SynTree/Visitor.h"        // for acceptAll, Visitor
    2532
    2633namespace LibCfa {
     
    9299                assert( ! objDecl->get_init() );
    93100                std::list< Expression* > noDesignators;
    94                 objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), noDesignators, false ) ); // cannot be constructed
     101                objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), false ) ); // cannot be constructed
    95102                newDecls.push_back( objDecl );
    96103        }
  • src/MakeLibCfa.h

    rfea3faa rb826e6b  
    1717#define LIBCFA_MAKELIBCFA_H
    1818
    19 #include <list>
    20 #include <SynTree/SynTree.h>
     19#include <list>  // for list
     20
     21class Declaration;
    2122
    2223namespace LibCfa {
  • src/Makefile.am

    rfea3faa rb826e6b  
    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 -g -std=c++14
     45driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -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

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    5958
    6059VPATH = @srcdir@
     60am__is_gnu_make = { \
     61  if test -z '$(MAKELEVEL)'; then \
     62    false; \
     63  elif test -n '$(MAKE_HOST)'; then \
     64    true; \
     65  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     66    true; \
     67  else \
     68    false; \
     69  fi; \
     70}
     71am__make_running_with_option = \
     72  case $${target_option-} in \
     73      ?) ;; \
     74      *) echo "am__make_running_with_option: internal error: invalid" \
     75              "target option '$${target_option-}' specified" >&2; \
     76         exit 1;; \
     77  esac; \
     78  has_opt=no; \
     79  sane_makeflags=$$MAKEFLAGS; \
     80  if $(am__is_gnu_make); then \
     81    sane_makeflags=$$MFLAGS; \
     82  else \
     83    case $$MAKEFLAGS in \
     84      *\\[\ \   ]*) \
     85        bs=\\; \
     86        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     87          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     88    esac; \
     89  fi; \
     90  skip_next=no; \
     91  strip_trailopt () \
     92  { \
     93    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     94  }; \
     95  for flg in $$sane_makeflags; do \
     96    test $$skip_next = yes && { skip_next=no; continue; }; \
     97    case $$flg in \
     98      *=*|--*) continue;; \
     99        -*I) strip_trailopt 'I'; skip_next=yes;; \
     100      -*I?*) strip_trailopt 'I';; \
     101        -*O) strip_trailopt 'O'; skip_next=yes;; \
     102      -*O?*) strip_trailopt 'O';; \
     103        -*l) strip_trailopt 'l'; skip_next=yes;; \
     104      -*l?*) strip_trailopt 'l';; \
     105      -[dEDm]) skip_next=yes;; \
     106      -[JT]) skip_next=yes;; \
     107    esac; \
     108    case $$flg in \
     109      *$$target_option*) has_opt=yes; break;; \
     110    esac; \
     111  done; \
     112  test $$has_opt = yes
     113am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     114am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    61115pkgdatadir = $(datadir)/@PACKAGE@
    62116pkgincludedir = $(includedir)/@PACKAGE@
     
    77131build_triplet = @build@
    78132host_triplet = @host@
    79 DIST_COMMON = $(srcdir)/CodeGen/module.mk \
    80         $(srcdir)/CodeTools/module.mk $(srcdir)/Common/module.mk \
    81         $(srcdir)/Concurrency/module.mk \
    82         $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk \
    83         $(srcdir)/InitTweak/module.mk $(srcdir)/Makefile.am \
    84         $(srcdir)/Makefile.in $(srcdir)/Parser/module.mk \
    85         $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk \
    86         $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk \
    87         Parser/lex.cc Parser/parser.cc Parser/parser.h
    88133cfa_cpplib_PROGRAMS = driver/cfa-cpp$(EXEEXT)
    89134subdir = src
     
    92137am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    93138        $(ACLOCAL_M4)
     139DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    94140mkinstalldirs = $(install_sh) -d
    95141CONFIG_HEADER = $(top_builddir)/config.h
     
    119165        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    120166        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
     167        ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \
    121168        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    122169        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    143190        Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \
    144191        Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \
    145         Parser/driver_cfa_cpp-parseutility.$(OBJEXT) \
     192        Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \
    146193        ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \
    147194        ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \
     
    161208        ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) \
    162209        ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT) \
     210        ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) \
    163211        SymTab/driver_cfa_cpp-Indexer.$(OBJEXT) \
    164212        SymTab/driver_cfa_cpp-Mangler.$(OBJEXT) \
     
    168216        SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \
    169217        SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \
     218        SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \
    170219        SynTree/driver_cfa_cpp-Type.$(OBJEXT) \
    171220        SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \
     
    213262driver_cfa_cpp_LINK = $(CXXLD) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) \
    214263        $(driver_cfa_cpp_LDFLAGS) $(LDFLAGS) -o $@
     264AM_V_P = $(am__v_P_@AM_V@)
     265am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     266am__v_P_0 = false
     267am__v_P_1 = :
     268AM_V_GEN = $(am__v_GEN_@AM_V@)
     269am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     270am__v_GEN_0 = @echo "  GEN     " $@;
     271am__v_GEN_1 =
     272AM_V_at = $(am__v_at_@AM_V@)
     273am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     274am__v_at_0 = @
     275am__v_at_1 =
    215276DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    216277depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    220281am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    221282am__v_lt_0 = --silent
     283am__v_lt_1 =
    222284CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    223285        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
    224286AM_V_CXX = $(am__v_CXX_@AM_V@)
    225287am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
    226 am__v_CXX_0 = @echo "  CXX   " $@;
    227 AM_V_at = $(am__v_at_@AM_V@)
    228 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    229 am__v_at_0 = @
     288am__v_CXX_0 = @echo "  CXX     " $@;
     289am__v_CXX_1 =
    230290CXXLD = $(CXX)
    231291CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
     
    233293AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
    234294am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
    235 am__v_CXXLD_0 = @echo "  CXXLD " $@;
     295am__v_CXXLD_0 = @echo "  CXXLD   " $@;
     296am__v_CXXLD_1 =
    236297@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
    237298LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
    238299AM_V_LEX = $(am__v_LEX_@AM_V@)
    239300am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@)
    240 am__v_LEX_0 = @echo "  LEX   " $@;
     301am__v_LEX_0 = @echo "  LEX     " $@;
     302am__v_LEX_1 =
    241303YLWRAP = $(top_srcdir)/automake/ylwrap
    242304@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
     305am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
     306                   -e s/c++$$/h++/ -e s/c$$/h/
    243307YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
    244308AM_V_YACC = $(am__v_YACC_@AM_V@)
    245309am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
    246 am__v_YACC_0 = @echo "  YACC  " $@;
     310am__v_YACC_0 = @echo "  YACC    " $@;
     311am__v_YACC_1 =
    247312COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    248313        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    249314AM_V_CC = $(am__v_CC_@AM_V@)
    250315am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    251 am__v_CC_0 = @echo "  CC    " $@;
     316am__v_CC_0 = @echo "  CC      " $@;
     317am__v_CC_1 =
    252318CCLD = $(CC)
    253319LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    254320AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    255321am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    256 am__v_CCLD_0 = @echo "  CCLD  " $@;
    257 AM_V_GEN = $(am__v_GEN_@AM_V@)
    258 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    259 am__v_GEN_0 = @echo "  GEN   " $@;
     322am__v_CCLD_0 = @echo "  CCLD    " $@;
     323am__v_CCLD_1 =
    260324SOURCES = $(driver_cfa_cpp_SOURCES)
    261325DIST_SOURCES = $(driver_cfa_cpp_SOURCES)
     326am__can_run_installinfo = \
     327  case $$AM_UPDATE_INFO_DIR in \
     328    n|no|NO) false;; \
     329    *) (install-info --version) >/dev/null 2>&1;; \
     330  esac
     331am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     332# Read a list of newline-separated strings from the standard input,
     333# and print each of them once, without duplicates.  Input order is
     334# *not* preserved.
     335am__uniquify_input = $(AWK) '\
     336  BEGIN { nonempty = 0; } \
     337  { items[$$0] = 1; nonempty = 1; } \
     338  END { if (nonempty) { for (i in items) print i; }; } \
     339'
     340# Make sure the list of sources is unique.  This is necessary because,
     341# e.g., the same source file might be shared among _SOURCES variables
     342# for different programs/libraries.
     343am__define_uniq_tagged_files = \
     344  list='$(am__tagged_files)'; \
     345  unique=`for i in $$list; do \
     346    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     347  done | $(am__uniquify_input)`
    262348ETAGS = etags
    263349CTAGS = ctags
     350am__DIST_COMMON = $(srcdir)/CodeGen/module.mk \
     351        $(srcdir)/CodeTools/module.mk $(srcdir)/Common/module.mk \
     352        $(srcdir)/Concurrency/module.mk \
     353        $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk \
     354        $(srcdir)/InitTweak/module.mk $(srcdir)/Makefile.in \
     355        $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk \
     356        $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk \
     357        $(srcdir)/Tuples/module.mk $(top_srcdir)/automake/depcomp \
     358        $(top_srcdir)/automake/ylwrap Parser/lex.cc Parser/parser.cc \
     359        Parser/parser.hh
    264360DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    265361ACLOCAL = @ACLOCAL@
     
    374470program_transform_name = @program_transform_name@
    375471psdir = @psdir@
     472runstatedir = @runstatedir@
    376473sbindir = @sbindir@
    377474sharedstatedir = @sharedstatedir@
     
    394491        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    395492        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    396         ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
     493        ControlStruct/ForExprMutator.cc \
     494        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    397495        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    398496        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    405503        Parser/ExpressionNode.cc Parser/StatementNode.cc \
    406504        Parser/InitializerNode.cc Parser/TypeData.cc \
    407         Parser/LinkageSpec.cc Parser/parseutility.cc \
     505        Parser/LinkageSpec.cc Parser/parserutility.cc \
    408506        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    409507        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    414512        ResolvExpr/RenameVars.cc ResolvExpr/FindOpenVars.cc \
    415513        ResolvExpr/PolyCost.cc ResolvExpr/Occurs.cc \
    416         ResolvExpr/TypeEnvironment.cc SymTab/Indexer.cc \
    417         SymTab/Mangler.cc SymTab/Validate.cc SymTab/FixFunction.cc \
    418         SymTab/ImplementationType.cc SymTab/TypeEquality.cc \
    419         SymTab/Autogen.cc SynTree/Type.cc SynTree/VoidType.cc \
    420         SynTree/BasicType.cc SynTree/PointerType.cc \
    421         SynTree/ArrayType.cc SynTree/FunctionType.cc \
    422         SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    423         SynTree/TypeofType.cc SynTree/AttrType.cc \
     514        ResolvExpr/TypeEnvironment.cc ResolvExpr/CurrentObject.cc \
     515        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
     516        SymTab/FixFunction.cc SymTab/ImplementationType.cc \
     517        SymTab/TypeEquality.cc SymTab/Autogen.cc SymTab/TreeStruct.cc \
     518        SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
     519        SynTree/PointerType.cc SynTree/ArrayType.cc \
     520        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
     521        SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \
    424522        SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    425523        SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     
    438536MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    439537        ${cfa_cpplib_PROGRAMS}}
    440 BUILT_SOURCES = Parser/parser.h
     538BUILT_SOURCES = Parser/parser.hh
    441539AM_YFLAGS = -d -t -v
    442540
     
    447545driver_cfa_cpp_SOURCES = ${SRC}
    448546driver_cfa_cpp_LDADD = ${LEXLIB} -ldl                   # yywrap
    449 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
     547driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    450548driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
    451549all: $(BUILT_SOURCES)
     
    466564        $(am__cd) $(top_srcdir) && \
    467565          $(AUTOMAKE) --foreign src/Makefile
    468 .PRECIOUS: Makefile
    469566Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    470567        @case '$?' in \
     
    475572            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
    476573        esac;
    477 $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk:
     574$(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(am__empty):
    478575
    479576$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
     
    487584install-cfa_cpplibPROGRAMS: $(cfa_cpplib_PROGRAMS)
    488585        @$(NORMAL_INSTALL)
    489         test -z "$(cfa_cpplibdir)" || $(MKDIR_P) "$(DESTDIR)$(cfa_cpplibdir)"
    490586        @list='$(cfa_cpplib_PROGRAMS)'; test -n "$(cfa_cpplibdir)" || list=; \
     587        if test -n "$$list"; then \
     588          echo " $(MKDIR_P) '$(DESTDIR)$(cfa_cpplibdir)'"; \
     589          $(MKDIR_P) "$(DESTDIR)$(cfa_cpplibdir)" || exit 1; \
     590        fi; \
    491591        for p in $$list; do echo "$$p $$p"; done | \
    492592        sed 's/$(EXEEXT)$$//' | \
    493         while read p p1; do if test -f $$p; \
    494           then echo "$$p"; echo "$$p"; else :; fi; \
     593        while read p p1; do if test -f $$p \
     594          ; then echo "$$p"; echo "$$p"; else :; fi; \
    495595        done | \
    496         sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
     596        sed -e 'p;s,.*/,,;n;h' \
     597            -e 's|.*|.|' \
    497598            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    498599        sed 'N;N;N;s,\n, ,g' | \
     
    515616        files=`for p in $$list; do echo "$$p"; done | \
    516617          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
    517               -e 's/$$/$(EXEEXT)/' `; \
     618              -e 's/$$/$(EXEEXT)/' \
     619        `; \
    518620        test -n "$$list" || exit 0; \
    519621        echo " ( cd '$(DESTDIR)$(cfa_cpplibdir)' && rm -f" $$files ")"; \
     
    594696        ControlStruct/$(am__dirstamp) \
    595697        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     698ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT):  \
     699        ControlStruct/$(am__dirstamp) \
     700        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    596701GenPoly/$(am__dirstamp):
    597702        @$(MKDIR_P) GenPoly
     
    634739InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT):  \
    635740        InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
    636 Parser/parser.h: Parser/parser.cc
     741Parser/parser.hh: Parser/parser.cc
    637742        @if test ! -f $@; then rm -f Parser/parser.cc; else :; fi
    638743        @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) Parser/parser.cc; else :; fi
     
    663768Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
    664769        Parser/$(DEPDIR)/$(am__dirstamp)
    665 Parser/driver_cfa_cpp-parseutility.$(OBJEXT): Parser/$(am__dirstamp) \
     770Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
    666771        Parser/$(DEPDIR)/$(am__dirstamp)
    667772ResolvExpr/$(am__dirstamp):
     
    721826        ResolvExpr/$(am__dirstamp) \
    722827        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     828ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT):  \
     829        ResolvExpr/$(am__dirstamp) \
     830        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    723831SymTab/$(am__dirstamp):
    724832        @$(MKDIR_P) SymTab
     
    740848        SymTab/$(DEPDIR)/$(am__dirstamp)
    741849SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
     850        SymTab/$(DEPDIR)/$(am__dirstamp)
     851SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \
    742852        SymTab/$(DEPDIR)/$(am__dirstamp)
    743853SynTree/$(am__dirstamp):
     
    834944        @$(MKDIR_P) driver
    835945        @: > driver/$(am__dirstamp)
     946
    836947driver/cfa-cpp$(EXEEXT): $(driver_cfa_cpp_OBJECTS) $(driver_cfa_cpp_DEPENDENCIES) $(EXTRA_driver_cfa_cpp_DEPENDENCIES) driver/$(am__dirstamp)
    837948        @rm -f driver/cfa-cpp$(EXEEXT)
     
    840951mostlyclean-compile:
    841952        -rm -f *.$(OBJEXT)
    842         -rm -f CodeGen/driver_cfa_cpp-CodeGenerator.$(OBJEXT)
    843         -rm -f CodeGen/driver_cfa_cpp-FixMain.$(OBJEXT)
    844         -rm -f CodeGen/driver_cfa_cpp-FixNames.$(OBJEXT)
    845         -rm -f CodeGen/driver_cfa_cpp-GenType.$(OBJEXT)
    846         -rm -f CodeGen/driver_cfa_cpp-Generate.$(OBJEXT)
    847         -rm -f CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT)
    848         -rm -f CodeTools/driver_cfa_cpp-DeclStats.$(OBJEXT)
    849         -rm -f CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT)
    850         -rm -f Common/driver_cfa_cpp-Assert.$(OBJEXT)
    851         -rm -f Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT)
    852         -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT)
    853         -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
    854         -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT)
    855         -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT)
    856         -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
    857         -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT)
    858         -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT)
    859         -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT)
    860         -rm -f GenPoly/driver_cfa_cpp-Box.$(OBJEXT)
    861         -rm -f GenPoly/driver_cfa_cpp-CopyParams.$(OBJEXT)
    862         -rm -f GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT)
    863         -rm -f GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT)
    864         -rm -f GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT)
    865         -rm -f GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT)
    866         -rm -f GenPoly/driver_cfa_cpp-Lvalue.$(OBJEXT)
    867         -rm -f GenPoly/driver_cfa_cpp-PolyMutator.$(OBJEXT)
    868         -rm -f GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT)
    869         -rm -f GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT)
    870         -rm -f InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT)
    871         -rm -f InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT)
    872         -rm -f InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT)
    873         -rm -f InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT)
    874         -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT)
    875         -rm -f Parser/driver_cfa_cpp-ExpressionNode.$(OBJEXT)
    876         -rm -f Parser/driver_cfa_cpp-InitializerNode.$(OBJEXT)
    877         -rm -f Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT)
    878         -rm -f Parser/driver_cfa_cpp-ParseNode.$(OBJEXT)
    879         -rm -f Parser/driver_cfa_cpp-StatementNode.$(OBJEXT)
    880         -rm -f Parser/driver_cfa_cpp-TypeData.$(OBJEXT)
    881         -rm -f Parser/driver_cfa_cpp-TypedefTable.$(OBJEXT)
    882         -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT)
    883         -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT)
    884         -rm -f Parser/driver_cfa_cpp-parseutility.$(OBJEXT)
    885         -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT)
    886         -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT)
    887         -rm -f ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT)
    888         -rm -f ResolvExpr/driver_cfa_cpp-AlternativePrinter.$(OBJEXT)
    889         -rm -f ResolvExpr/driver_cfa_cpp-CastCost.$(OBJEXT)
    890         -rm -f ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT)
    891         -rm -f ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT)
    892         -rm -f ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT)
    893         -rm -f ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT)
    894         -rm -f ResolvExpr/driver_cfa_cpp-PolyCost.$(OBJEXT)
    895         -rm -f ResolvExpr/driver_cfa_cpp-PtrsAssignable.$(OBJEXT)
    896         -rm -f ResolvExpr/driver_cfa_cpp-PtrsCastable.$(OBJEXT)
    897         -rm -f ResolvExpr/driver_cfa_cpp-RenameVars.$(OBJEXT)
    898         -rm -f ResolvExpr/driver_cfa_cpp-ResolveTypeof.$(OBJEXT)
    899         -rm -f ResolvExpr/driver_cfa_cpp-Resolver.$(OBJEXT)
    900         -rm -f ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT)
    901         -rm -f ResolvExpr/driver_cfa_cpp-Unify.$(OBJEXT)
    902         -rm -f SymTab/driver_cfa_cpp-Autogen.$(OBJEXT)
    903         -rm -f SymTab/driver_cfa_cpp-FixFunction.$(OBJEXT)
    904         -rm -f SymTab/driver_cfa_cpp-ImplementationType.$(OBJEXT)
    905         -rm -f SymTab/driver_cfa_cpp-Indexer.$(OBJEXT)
    906         -rm -f SymTab/driver_cfa_cpp-Mangler.$(OBJEXT)
    907         -rm -f SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT)
    908         -rm -f SymTab/driver_cfa_cpp-Validate.$(OBJEXT)
    909         -rm -f SynTree/driver_cfa_cpp-AddStmtVisitor.$(OBJEXT)
    910         -rm -f SynTree/driver_cfa_cpp-AddressExpr.$(OBJEXT)
    911         -rm -f SynTree/driver_cfa_cpp-AggregateDecl.$(OBJEXT)
    912         -rm -f SynTree/driver_cfa_cpp-ApplicationExpr.$(OBJEXT)
    913         -rm -f SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT)
    914         -rm -f SynTree/driver_cfa_cpp-AttrType.$(OBJEXT)
    915         -rm -f SynTree/driver_cfa_cpp-Attribute.$(OBJEXT)
    916         -rm -f SynTree/driver_cfa_cpp-BasicType.$(OBJEXT)
    917         -rm -f SynTree/driver_cfa_cpp-CommaExpr.$(OBJEXT)
    918         -rm -f SynTree/driver_cfa_cpp-CompoundStmt.$(OBJEXT)
    919         -rm -f SynTree/driver_cfa_cpp-Constant.$(OBJEXT)
    920         -rm -f SynTree/driver_cfa_cpp-DeclStmt.$(OBJEXT)
    921         -rm -f SynTree/driver_cfa_cpp-Declaration.$(OBJEXT)
    922         -rm -f SynTree/driver_cfa_cpp-DeclarationWithType.$(OBJEXT)
    923         -rm -f SynTree/driver_cfa_cpp-Expression.$(OBJEXT)
    924         -rm -f SynTree/driver_cfa_cpp-FunctionDecl.$(OBJEXT)
    925         -rm -f SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT)
    926         -rm -f SynTree/driver_cfa_cpp-Initializer.$(OBJEXT)
    927         -rm -f SynTree/driver_cfa_cpp-Mutator.$(OBJEXT)
    928         -rm -f SynTree/driver_cfa_cpp-NamedTypeDecl.$(OBJEXT)
    929         -rm -f SynTree/driver_cfa_cpp-ObjectDecl.$(OBJEXT)
    930         -rm -f SynTree/driver_cfa_cpp-PointerType.$(OBJEXT)
    931         -rm -f SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT)
    932         -rm -f SynTree/driver_cfa_cpp-Statement.$(OBJEXT)
    933         -rm -f SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT)
    934         -rm -f SynTree/driver_cfa_cpp-TupleType.$(OBJEXT)
    935         -rm -f SynTree/driver_cfa_cpp-Type.$(OBJEXT)
    936         -rm -f SynTree/driver_cfa_cpp-TypeDecl.$(OBJEXT)
    937         -rm -f SynTree/driver_cfa_cpp-TypeExpr.$(OBJEXT)
    938         -rm -f SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT)
    939         -rm -f SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT)
    940         -rm -f SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT)
    941         -rm -f SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT)
    942         -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
    943         -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
    944         -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)
    945         -rm -f Tuples/driver_cfa_cpp-Explode.$(OBJEXT)
    946         -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
    947         -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
     953        -rm -f CodeGen/*.$(OBJEXT)
     954        -rm -f CodeTools/*.$(OBJEXT)
     955        -rm -f Common/*.$(OBJEXT)
     956        -rm -f Concurrency/*.$(OBJEXT)
     957        -rm -f ControlStruct/*.$(OBJEXT)
     958        -rm -f GenPoly/*.$(OBJEXT)
     959        -rm -f InitTweak/*.$(OBJEXT)
     960        -rm -f Parser/*.$(OBJEXT)
     961        -rm -f ResolvExpr/*.$(OBJEXT)
     962        -rm -f SymTab/*.$(OBJEXT)
     963        -rm -f SynTree/*.$(OBJEXT)
     964        -rm -f Tuples/*.$(OBJEXT)
    948965
    949966distclean-compile:
     
    965982@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    966983@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
     984@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    967985@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    968986@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
     
    9941012@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@
    9951013@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@
    996 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po@am__quote@
     1014@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@
    9971015@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@
    9981016@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@
     
    10021020@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po@am__quote@
    10031021@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po@am__quote@
     1022@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po@am__quote@
    10041023@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po@am__quote@
    10051024@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po@am__quote@
     
    10171036@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@
    10181037@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@
     1038@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@
    10191039@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@
    10201040@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
     
    13551375@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`
    13561376
     1377ControlStruct/driver_cfa_cpp-ExceptTranslate.o: 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.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
     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.o' 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.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
     1383
     1384ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc
     1385@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`
     1386@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
     1387@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@
     1388@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1389@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`
     1390
    13571391GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    13581392@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
     
    16911725@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`
    16921726
    1693 Parser/driver_cfa_cpp-parseutility.o: Parser/parseutility.cc
    1694 @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
    1695 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
    1696 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.o' libtool=no @AMDEPBACKSLASH@
    1697 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1698 @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
    1699 
    1700 Parser/driver_cfa_cpp-parseutility.obj: Parser/parseutility.cc
    1701 @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`
    1702 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
    1703 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.obj' libtool=no @AMDEPBACKSLASH@
    1704 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1705 @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`
     1727Parser/driver_cfa_cpp-parserutility.o: 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.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
     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.o' 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.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
     1733
     1734Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc
     1735@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`
     1736@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
     1737@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@
     1738@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1739@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`
    17061740
    17071741ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc
     
    19431977@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`
    19441978
     1979ResolvExpr/driver_cfa_cpp-CurrentObject.o: 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.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
     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.o' 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.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc
     1985
     1986ResolvExpr/driver_cfa_cpp-CurrentObject.obj: ResolvExpr/CurrentObject.cc
     1987@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`
     1988@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po
     1989@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.obj' libtool=no @AMDEPBACKSLASH@
     1990@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1991@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`
     1992
    19451993SymTab/driver_cfa_cpp-Indexer.o: SymTab/Indexer.cc
    19461994@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
     
    20412089@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
    20422090
     2091SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc
     2092@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
     2093@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
     2094@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@
     2095@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2096@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
     2097
     2098SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc
     2099@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
     2100@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
     2101@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@
     2102@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2103@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
     2104
    20432105SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc
    20442106@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Type.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo -c -o SynTree/driver_cfa_cpp-Type.o `test -f 'SynTree/Type.cc' || echo '$(srcdir)/'`SynTree/Type.cc
     
    25912653
    25922654.yy.cc:
    2593         $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
    2594 
    2595 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    2596         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    2597         unique=`for i in $$list; do \
    2598             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    2599           done | \
    2600           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    2601               END { if (nonempty) { for (i in files) print i; }; }'`; \
    2602         mkid -fID $$unique
    2603 tags: TAGS
    2604 
    2605 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    2606                 $(TAGS_FILES) $(LISP)
     2655        $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
     2656
     2657ID: $(am__tagged_files)
     2658        $(am__define_uniq_tagged_files); mkid -fID $$unique
     2659tags: tags-am
     2660TAGS: tags
     2661
     2662tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    26072663        set x; \
    26082664        here=`pwd`; \
    2609         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    2610         unique=`for i in $$list; do \
    2611             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    2612           done | \
    2613           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    2614               END { if (nonempty) { for (i in files) print i; }; }'`; \
     2665        $(am__define_uniq_tagged_files); \
    26152666        shift; \
    26162667        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    26242675          fi; \
    26252676        fi
    2626 ctags: CTAGS
    2627 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    2628                 $(TAGS_FILES) $(LISP)
    2629         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    2630         unique=`for i in $$list; do \
    2631             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    2632           done | \
    2633           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    2634               END { if (nonempty) { for (i in files) print i; }; }'`; \
     2677ctags: ctags-am
     2678
     2679CTAGS: ctags
     2680ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     2681        $(am__define_uniq_tagged_files); \
    26352682        test -z "$(CTAGS_ARGS)$$unique" \
    26362683          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    26412688          && $(am__cd) $(top_srcdir) \
    26422689          && gtags -i $(GTAGS_ARGS) "$$here"
     2690cscopelist: cscopelist-am
     2691
     2692cscopelist-am: $(am__tagged_files)
     2693        list='$(am__tagged_files)'; \
     2694        case "$(srcdir)" in \
     2695          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     2696          *) sdir=$(subdir)/$(srcdir) ;; \
     2697        esac; \
     2698        for i in $$list; do \
     2699          if test -f "$$i"; then \
     2700            echo "$(subdir)/$$i"; \
     2701          else \
     2702            echo "$$sdir/$$i"; \
     2703          fi; \
     2704        done >> $(top_builddir)/cscope.files
    26432705
    26442706distclean-tags:
     
    27412803        -rm -f Parser/lex.cc
    27422804        -rm -f Parser/parser.cc
    2743         -rm -f Parser/parser.h
     2805        -rm -f Parser/parser.hh
    27442806        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
    27452807        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
     
    28152877.MAKE: all check install install-am install-strip
    28162878
    2817 .PHONY: CTAGS GTAGS all all-am check check-am clean \
    2818         clean-cfa_cpplibPROGRAMS clean-generic ctags distclean \
    2819         distclean-compile distclean-generic distclean-tags distdir dvi \
    2820         dvi-am html html-am info info-am install install-am \
    2821         install-cfa_cpplibPROGRAMS install-data install-data-am \
    2822         install-dvi install-dvi-am install-exec install-exec-am \
    2823         install-html install-html-am install-info install-info-am \
    2824         install-man install-pdf install-pdf-am install-ps \
    2825         install-ps-am install-strip installcheck installcheck-am \
    2826         installdirs maintainer-clean maintainer-clean-generic \
    2827         mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
    2828         ps ps-am tags uninstall uninstall-am \
    2829         uninstall-cfa_cpplibPROGRAMS
     2879.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
     2880        clean-cfa_cpplibPROGRAMS clean-generic cscopelist-am ctags \
     2881        ctags-am distclean distclean-compile distclean-generic \
     2882        distclean-tags distdir dvi dvi-am html html-am info info-am \
     2883        install install-am install-cfa_cpplibPROGRAMS install-data \
     2884        install-data-am install-dvi install-dvi-am install-exec \
     2885        install-exec-am install-html install-html-am install-info \
     2886        install-info-am install-man install-pdf install-pdf-am \
     2887        install-ps install-ps-am install-strip installcheck \
     2888        installcheck-am installdirs maintainer-clean \
     2889        maintainer-clean-generic mostlyclean mostlyclean-compile \
     2890        mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
     2891        uninstall-am uninstall-cfa_cpplibPROGRAMS
     2892
     2893.PRECIOUS: Makefile
    28302894
    28312895
  • src/Parser/DeclarationNode.cc

    rfea3faa rb826e6b  
    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 : Fri Jul 14 16:55:00 2017
     13// Update Count     : 1020
    1414//
    1515
     
    253253        newnode->type->aggregate.fields = fields;
    254254        newnode->type->aggregate.body = body;
     255        newnode->type->aggregate.tagged = false;
     256        newnode->type->aggregate.parent = nullptr;
    255257        return newnode;
    256258} // DeclarationNode::newAggregate
     
    273275        return newnode;
    274276} // DeclarationNode::newEnumConstant
     277
     278DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     279        assert( name );
     280        DeclarationNode * newnode = new DeclarationNode;
     281        newnode->type = new TypeData( TypeData::Aggregate );
     282        newnode->type->aggregate.kind = kind;
     283        newnode->type->aggregate.name = name;
     284        newnode->type->aggregate.actuals = actuals;
     285        newnode->type->aggregate.fields = fields;
     286        newnode->type->aggregate.body = body;
     287        newnode->type->aggregate.tagged = true;
     288        newnode->type->aggregate.parent = parent;
     289        return newnode;
     290} // DeclarationNode::newTreeStruct
    275291
    276292DeclarationNode * DeclarationNode::newName( string * name ) {
     
    10631079          case TypeData::Enum:
    10641080          case TypeData::Aggregate: {
    1065                   ReferenceToType * ret = buildComAggInst( type, attributes );
     1081                  ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
    10661082                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10671083                  return ret;
  • src/Parser/ExpressionNode.cc

    rfea3faa rb826e6b  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 16:44:46 2017
    13 // Update Count     : 541
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jul 18 10:08:00 2017
     13// Update Count     : 550
    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
     
    4646// type.
    4747
    48 Type::Qualifiers emptyQualifiers;                               // no qualifiers on constants
     48Type::Qualifiers noQualifiers;                          // no qualifiers on constants
    4949
    5050static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
     
    118118        } // if
    119119
    120         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) );
     120        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
    121121        delete &str;                                                                            // created by lex
    122122        return ret;
     
    153153        } // if
    154154
    155         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) );
     155        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
    156156        delete &str;                                                                            // created by lex
    157157        return ret;
     
    159159
    160160Expression *build_constantChar( const std::string & str ) {
    161         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
     161        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
    162162        delete &str;                                                                            // created by lex
    163163        return ret;
     
    166166ConstantExpr *build_constantStr( const std::string & str ) {
    167167        // string should probably be a primitive type
    168         ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
     168        ArrayType *at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
    169169                                                                   new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ),  // +1 for '\0' and -2 for '"'
    170170                                                                   false, false );
     
    176176
    177177Expression *build_constantZeroOne( const std::string & str ) {
    178         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( noQualifiers ) : (Type*)new OneType( noQualifiers ), str,
    179179                                                                                                   str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) );
    180180        delete &str;                                                                            // created by lex
     
    231231}
    232232
     233// Must harmonize with OperKinds.
    233234static const char *OperName[] = {
    234235        // diadic
    235         "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&",
     236        "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&",
    236237        "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
    237         "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
     238        "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
    238239        "?[?]", "...",
    239240        // monadic
  • src/Parser/InitializerNode.cc

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    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 : Fri Jul  7 11:11:00 2017
     13// Update Count     : 25
    1414//
    1515
     
    2222#include "Common/SemanticError.h"
    2323
    24 LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) {
     24namespace LinkageSpec {
     25
     26Spec linkageCheck( const string * spec ) {
     27        assert( spec );
    2528        unique_ptr<const string> guard( spec ); // allocated by lexer
    2629        if ( *spec == "\"Cforall\"" ) {
     
    2831        } else if ( *spec == "\"C\"" ) {
    2932                return C;
     33        } else if ( *spec == "\"BuiltinC\"" ) {
     34                return BuiltinC;
    3035        } else {
    3136                throw SemanticError( "Invalid linkage specifier " + *spec );
     
    3338}
    3439
    35 string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) {
    36         assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
    37         static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
    38                 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
    39         };
    40         return linkageKinds[linkage];
     40Spec linkageUpdate( Spec old_spec, const string * cmd ) {
     41        assert( cmd );
     42        unique_ptr<const string> guard( cmd ); // allocated by lexer
     43        if ( *cmd == "\"Cforall\"" ) {
     44                old_spec.is_mangled = true;
     45                return old_spec;
     46        } else if ( *cmd == "\"C\"" ) {
     47                old_spec.is_mangled = false;
     48                return old_spec;
     49        } else {
     50                throw SemanticError( "Invalid linkage specifier " + *cmd );
     51        } // if
    4152}
    4253
    43 bool LinkageSpec::isDecoratable( Spec spec ) {
    44         assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    45         static bool decoratable[LinkageSpec::NoOfSpecs] = {
    46                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    47                         true,           true,           false,  true,           false,
    48         };
    49         return decoratable[spec];
     54std::string linkageName( Spec linkage ) {
     55    switch ( linkage ) {
     56    case Intrinsic:
     57        return "intrinsic";
     58    case C:
     59        return "C";
     60    case Cforall:
     61        return "Cforall";
     62    case AutoGen:
     63        return "autogenerated cfa";
     64    case Compiler:
     65        return "compiler built-in";
     66    case BuiltinCFA:
     67        return "cfa built-in";
     68    case BuiltinC:
     69        return "c built-in";
     70    default:
     71        return "<unnamed linkage spec>";
     72    }
    5073}
    5174
    52 bool LinkageSpec::isGeneratable( Spec spec ) {
    53         assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    54         static bool generatable[LinkageSpec::NoOfSpecs] = {
    55                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    56                         true,           true,           true,   true,           false,
    57         };
    58         return generatable[spec];
    59 }
    60 
    61 bool LinkageSpec::isOverridable( Spec spec ) {
    62         assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    63         static bool overridable[LinkageSpec::NoOfSpecs] = {
    64                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    65                         true,           false,          false,  true,           false,
    66         };
    67         return overridable[spec];
    68 }
    69 
    70 bool LinkageSpec::isBuiltin( Spec spec ) {
    71         assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    72         static bool builtin[LinkageSpec::NoOfSpecs] = {
    73                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    74                         true,           false,          false,  false,          true,
    75         };
    76         return builtin[spec];
    77 }
     75} // LinkageSpec
    7876
    7977// Local Variables: //
  • src/Parser/LinkageSpec.h

    rfea3faa rb826e6b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LinkageSpec.h -- 
     7// LinkageSpec.h --
    88//
    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 : Fri Jul  7 11:03:00 2017
     13// Update Count     : 13
    1414//
    1515
     
    1919#include <string>
    2020
    21 struct LinkageSpec {
    22         enum Spec {
    23                 Intrinsic,                                                                              // C built-in defined in prelude
    24                 Cforall,                                                                                // ordinary
    25                 C,                                                                                              // not overloadable, not mangled
    26                 AutoGen,                                                                                // built by translator (struct assignment)
    27                 Compiler,                                                                               // gcc internal
    28                 NoOfSpecs
     21namespace LinkageSpec {
     22        // All linkage specs are some combination of these flags:
     23        enum {
     24                Mangle = 1 << 0,
     25                Generate = 1 << 1,
     26                Overrideable = 1 << 2,
     27                Builtin = 1 << 3,
     28
     29                NoOfSpecs = 1 << 4,
    2930        };
    30  
    31         static Spec linkageCheck( const std::string * );
    32         static std::string linkageName( Spec );
    33  
    34         static bool isDecoratable( Spec );
    35         static bool isGeneratable( Spec );
    36         static bool isOverridable( Spec );
    37         static bool isBuiltin( Spec );
     31
     32        union Spec {
     33                unsigned int val;
     34                struct {
     35                        bool is_mangled : 1;
     36                        bool is_generatable : 1;
     37                        bool is_overridable : 1;
     38                        bool is_builtin : 1;
     39                };
     40                constexpr Spec( unsigned int val ) : val( val ) {}
     41                constexpr Spec( Spec const &other ) : val( other.val ) {}
     42                // Operators may go here.
     43                // Supports == and !=
     44                constexpr operator unsigned int () const { return val; }
     45        };
     46
     47
     48        Spec linkageCheck( const std::string * );
     49        // Returns the Spec with the given name (limited to C, Cforall & BuiltinC)
     50        Spec linkageUpdate( Spec old_spec, const std::string * cmd );
     51        /* If cmd = "C" returns a Spec that is old_spec with is_mangled = false
     52         * If cmd = "Cforall" returns old_spec Spec with is_mangled = true
     53         */
     54
     55        std::string linkageName( Spec );
     56
     57        // To Update: LinkageSpec::isXyz( cur_spec ) -> cur_spec.is_xyz
     58        inline bool isMangled( Spec spec ) { return spec.is_mangled; }
     59        inline bool isGeneratable( Spec spec ) { return spec.is_generatable; }
     60        inline bool isOverridable( Spec spec ) { return spec.is_overridable; }
     61        inline bool isBuiltin( Spec spec ) { return spec.is_builtin; }
     62
     63        // Pre-defined flag combinations:
     64        // C built-in defined in prelude
     65        constexpr Spec const Intrinsic = { Mangle | Generate | Overrideable | Builtin };
     66        // ordinary
     67        constexpr Spec const Cforall = { Mangle | Generate };
     68        // not overloadable, not mangled
     69        constexpr Spec const C = { Generate };
     70        // built by translator (struct assignment)
     71        constexpr Spec const AutoGen = { Mangle | Generate | Overrideable };
     72        // gcc internal
     73        constexpr Spec const Compiler = { Builtin };
     74        // mangled builtins
     75        constexpr Spec const BuiltinCFA = { Mangle | Generate | Builtin };
     76        // non-mangled builtins
     77        constexpr Spec const BuiltinC = { Generate | Builtin };
    3878};
    3979
  • src/Parser/ParseNode.h

    rfea3faa rb826e6b  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:00:00 2017
    13 // Update Count     : 779
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 15 16:00:48 2017
     13// Update Count     : 785
    1414//
    1515
     
    141141};
    142142
     143// Must harmonize with OperName.
    143144enum class OperKinds {
    144145        // diadic
    145         SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,
     146        SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And,
    146147        BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
    147         Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
     148        Assign, AtAssn, ExpAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
    148149        Index, Range,
    149150        // monadic
     
    248249        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    249250
     251        // Perhaps this would best fold into newAggragate.
     252        static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     253
    250254        DeclarationNode();
    251255        ~DeclarationNode();
     
    332336
    333337        static UniqueName anonymous;
     338
     339        // Temp to test TreeStruct
     340        const std::string * parent_name;
    334341}; // DeclarationNode
    335342
  • src/Parser/ParserTypes.h

    rfea3faa rb826e6b  
    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/StatementNode.cc

    rfea3faa rb826e6b  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 14:59:41 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:03:00 2017
    13 // Update Count     : 329
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Jul 11 21:23:15 2017
     13// Update Count     : 331
    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
     
    9393        std::list< Statement * > branches;
    9494        buildMoveList< Statement, StatementNode >( stmt, branches );
    95         assert( branches.size() >= 0 );                                         // size == 0 for switch (...) {}, i.e., no declaration or statements
     95        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    9696        return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
    9797}
  • src/Parser/TypeData.cc

    rfea3faa rb826e6b  
    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 : Tus Jul 18 10:10:00 2017
     13// Update Count     : 566
    1414//
    1515
     
    6363                aggregate.fields = nullptr;
    6464                aggregate.body = false;
     65                aggregate.tagged = false;
     66                aggregate.parent = nullptr;
    6567                break;
    6668          case AggregateInst:
     
    121123                delete aggregate.actuals;
    122124                delete aggregate.fields;
     125                delete aggregate.parent;
    123126                // delete aggregate;
    124127                break;
     
    192195                newtype->aggregate.kind = aggregate.kind;
    193196                newtype->aggregate.body = aggregate.body;
     197                newtype->aggregate.tagged = aggregate.tagged;
     198                newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
    194199                break;
    195200          case AggregateInst:
     
    449454          case TypeData::Builtin:
    450455                if(td->builtintype == DeclarationNode::Zero) {
    451                         return new ZeroType( emptyQualifiers );
     456                        return new ZeroType( noQualifiers );
    452457                }
    453458                else if(td->builtintype == DeclarationNode::One) {
    454                         return new OneType( emptyQualifiers );
     459                        return new OneType( noQualifiers );
    455460                }
    456461                else {
     
    614619} // buildPointer
    615620
    616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {
     621AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    617622        assert( td->kind == TypeData::Aggregate );
    618623        AggregateDecl * at;
    619624        switch ( td->aggregate.kind ) {
    620625          case DeclarationNode::Struct:
     626                if ( td->aggregate.tagged ) {
     627                        at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );
     628                        buildForall( td->aggregate.params, at->get_parameters() );
     629                        break;
     630                }
    621631          case DeclarationNode::Coroutine:
    622632          case DeclarationNode::Monitor:
    623633          case DeclarationNode::Thread:
    624                 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );
     634                at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage );
    625635                buildForall( td->aggregate.params, at->get_parameters() );
    626636                break;
     
    643653} // buildAggregate
    644654
    645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
     655ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    646656        switch ( type->kind ) {
    647657          case TypeData::Enum: {
     
    656666                  ReferenceToType * ret;
    657667                  if ( type->aggregate.body ) {
    658                           AggregateDecl * typedecl = buildAggregate( type, attributes );
     668                          AggregateDecl * typedecl = buildAggregate( type, attributes, linkage );
    659669                          switch ( type->aggregate.kind ) {
    660670                                case DeclarationNode::Struct:
     
    760770                if ( cur->has_enumeratorValue() ) {
    761771                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
    762                         member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) );
     772                        member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ) ) );
    763773                } // if
    764774        } // for
     
    777787TupleType * buildTuple( const TypeData * td ) {
    778788        assert( td->kind == TypeData::Tuple );
    779         TupleType * ret = new TupleType( buildQualifiers( td ) );
    780         buildTypeList( td->tuple, ret->get_types() );
     789        std::list< Type * > types;
     790        buildTypeList( td->tuple, types );
     791        TupleType * ret = new TupleType( buildQualifiers( td ), types );
    781792        buildForall( td->forall, ret->get_forall() );
    782793        return ret;
     
    802813                return decl->set_asmName( asmName );
    803814        } else if ( td->kind == TypeData::Aggregate ) {
    804                 return buildAggregate( td, attributes );
     815                return buildAggregate( td, attributes, linkage );
    805816        } else if ( td->kind == TypeData::Enum ) {
    806817                return buildEnum( td, attributes );
  • src/Parser/TypeData.h

    rfea3faa rb826e6b  
    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 : Fri Jul 14 16:57:00 2017
     13// Update Count     : 187
    1414//
    1515
     
    3131                DeclarationNode * fields;
    3232                bool body;
     33
     34                bool tagged;
     35                const std::string * parent;
    3336        };
    3437
     
    102105ArrayType * buildArray( const TypeData * );
    103106AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
     107ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
    105108ReferenceToType * buildAggInst( const TypeData * );
    106109TypeDecl * buildVariable( const TypeData * );
  • src/Parser/TypedefTable.h

    rfea3faa rb826e6b  
    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"
    25 #include "parser.h"
     24#include "ParserTypes.h"
     25#include "parser.hh"
    2626
    2727class TypedefTable {
  • src/Parser/lex.ll

    rfea3faa rb826e6b  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Tue May 30 22:00:48 2017
    13  * Update Count     : 527
     12 * Last Modified On : Tue Jul 18 07:11:48 2017
     13 * Update Count     : 544
    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"
     
    6159}
    6260
     61// Stop warning due to incorrectly generated flex code.
     62#pragma GCC diagnostic ignored "-Wsign-compare"
    6363%}
    6464
     
    125125op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post}
    126126
    127 op_binary_only "/"|"%"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="
     127op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>="
    128128op_binary_over {op_unary_binary}|{op_binary_only}
    129129                                // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@="
     
    136136
    137137%%
    138                                    /* line directives */
     138                                /* line directives */
    139139^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" {
    140140        /* " stop highlighting */
     
    232232int                             { KEYWORD_RETURN(INT); }
    233233__int128                { KEYWORD_RETURN(INT); }                                // GCC
     234__int128_t              { KEYWORD_RETURN(INT); }                                // GCC
    234235__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    235236long                    { KEYWORD_RETURN(LONG); }
     
    266267__typeof                { KEYWORD_RETURN(TYPEOF); }                             // GCC
    267268__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
     269__uint128_t             { KEYWORD_RETURN(INT); }                                // GCC
    268270union                   { KEYWORD_RETURN(UNION); }
    269271unsigned                { KEYWORD_RETURN(UNSIGNED); }
     
    274276__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
    275277while                   { KEYWORD_RETURN(WHILE); }
     278with                    { KEYWORD_RETURN(WITH); }                               // CFA
    276279zero_t                  { NUMERIC_RETURN(ZERO_T); }                             // CFA
    277280
     
    336339"-"                             { ASCIIOP_RETURN(); }
    337340"*"                             { ASCIIOP_RETURN(); }
     341"\\"                    { ASCIIOP_RETURN(); }                                   // CFA, exponentiation
    338342"/"                             { ASCIIOP_RETURN(); }
    339343"%"                             { ASCIIOP_RETURN(); }
     
    360364"+="                    { NAMEDOP_RETURN(PLUSassign); }
    361365"-="                    { NAMEDOP_RETURN(MINUSassign); }
     366"\\="                   { NAMEDOP_RETURN(EXPassign); }                  // CFA, exponentiation
    362367"*="                    { NAMEDOP_RETURN(MULTassign); }
    363368"/="                    { NAMEDOP_RETURN(DIVassign); }
  • src/Parser/module.mk

    rfea3faa rb826e6b  
    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
    17 BUILT_SOURCES = Parser/parser.h
     17BUILT_SOURCES = Parser/parser.hh
    1818
    1919AM_YFLAGS = -d -t -v
     
    2929       Parser/TypeData.cc \
    3030       Parser/LinkageSpec.cc \
    31        Parser/parseutility.cc
     31       Parser/parserutility.cc
    3232
    3333MAINTAINERCLEANFILES += Parser/parser.output
  • src/Parser/parser.yy

    rfea3faa rb826e6b  
    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
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 12 12:59:00 2017
    13 // Update Count     : 2402
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 17 12:17:00 2017
     13// Update Count     : 2455
    1414//
    1515
     
    4848#include <cstdio>
    4949#include <stack>
    50 #include "lex.h"
    51 #include "parser.h"
    5250#include "ParseNode.h"
    5351#include "TypedefTable.h"
     
    8886bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8987%}
     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        CatchStmt::Kind catch_kind;
     107}
    90108
    91109//************************* TERMINAL TOKENS ********************************
     
    111129%token ATTRIBUTE EXTENSION                                                              // GCC
    112130%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    113 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT        // CFA
     131%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH   // CFA
    114132%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    115133%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    133151%token ELLIPSIS                                                                                 // ...
    134152
    135 %token MULTassign       DIVassign       MODassign                               // *=   /=      %=/
     153%token EXPassign        MULTassign      DIVassign       MODassign       // \=   *=      /=      %=
    136154%token PLUSassign       MINUSassign                                                     // +=   -=
    137155%token LSassign         RSassign                                                        // <<=  >>=
     
    139157
    140158%token ATassign                                                                                 // @=
    141 
    142 // Types declaration
    143 %union
    144 {
    145         Token tok;
    146         ParseNode * pn;
    147         ExpressionNode * en;
    148         DeclarationNode * decl;
    149         DeclarationNode::Aggregate aggKey;
    150         DeclarationNode::TypeClass tclass;
    151         StatementNode * sn;
    152         ConstantExpr * constant;
    153         ForCtl * fctl;
    154         LabelNode * label;
    155         InitializerNode * in;
    156         OperKinds op;
    157         std::string * str;
    158         bool flag;
    159 }
    160159
    161160%type<tok> identifier  no_attr_identifier  zero_one
     
    169168%type<op> ptrref_operator                               unary_operator                          assignment_operator
    170169%type<en> primary_expression                    postfix_expression                      unary_expression
    171 %type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
    172 %type<en> relational_expression                 equality_expression                     AND_expression                          exclusive_OR_expression
    173 %type<en> inclusive_OR_expression               logical_AND_expression          logical_OR_expression           conditional_expression
    174 %type<en> constant_expression                   assignment_expression           assignment_expression_opt
     170%type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
     171%type<en> shift_expression                              relational_expression           equality_expression
     172%type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
     173%type<en> logical_AND_expression                logical_OR_expression
     174%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    175175%type<en> comma_expression                              comma_expression_opt
    176 %type<en> argument_expression_list              argument_expression                     assignment_opt
     176%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    177177%type<fctl> for_control_expression
    178178%type<en> subrange
     
    185185// statements
    186186%type<sn> labeled_statement                             compound_statement                      expression_statement            selection_statement
    187 %type<sn> iteration_statement                   jump_statement                          exception_statement                     asm_statement
     187%type<sn> iteration_statement                   jump_statement
     188%type<sn> with_statement                                exception_statement                     asm_statement
    188189%type<sn> fall_through_opt                              fall_through
    189190%type<sn> statement                                             statement_list
    190191%type<sn> block_item_list                               block_item
    191 %type<sn> case_clause
     192%type<sn> with_clause_opt
    192193%type<en> case_value
    193 %type<sn> case_value_list                               case_label                                      case_label_list
     194%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
    194195%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    195196%type<sn> /* handler_list */                    handler_clause                          finally_clause
     197%type<catch_kind> handler_key
    196198
    197199// declarations
     
    572574        ;
    573575
     576exponential_expression:
     577        cast_expression
     578        | exponential_expression '\\' cast_expression
     579                { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); }
     580        ;
     581
    574582multiplicative_expression:
    575         cast_expression
    576         | multiplicative_expression '*' cast_expression
     583        exponential_expression
     584        | multiplicative_expression '*' exponential_expression
    577585                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); }
    578         | multiplicative_expression '/' cast_expression
     586        | multiplicative_expression '/' exponential_expression
    579587                { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); }
    580         | multiplicative_expression '%' cast_expression
     588        | multiplicative_expression '%' exponential_expression
    581589                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); }
    582590        ;
     
    677685        '='                                                                                     { $$ = OperKinds::Assign; }
    678686        | ATassign                                                                      { $$ = OperKinds::AtAssn; }
     687        | EXPassign                                                                     { $$ = OperKinds::ExpAssn; }
    679688        | MULTassign                                                            { $$ = OperKinds::MulAssn; }
    680689        | DIVassign                                                                     { $$ = OperKinds::DivAssn; }
     
    729738        | iteration_statement
    730739        | jump_statement
     740        | with_statement
    731741        | exception_statement
    732742        | asm_statement
     
    936946        ;
    937947
     948with_statement:
     949        WITH '(' tuple_expression_list ')' compound_statement
     950                { $$ = (StatementNode *)0; }                                    // FIX ME
     951        ;
     952
    938953exception_statement:
    939954        TRY compound_statement handler_clause
     
    959974
    960975handler_clause:
    961         CATCH '(' push push exception_declaration pop ')' compound_statement pop
    962                 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); }
    963         | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
    964                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, $6, nullptr, $9 ) ) ); }
    965         | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    966                 { $$ = new StatementNode( build_catch( CatchStmt::Resume, $5, nullptr, $8 ) ); }
    967         | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    968                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Resume, $6, nullptr, $9 ) ) ); }
     976        // TEMPORARY, TEST EXCEPTIONS
     977        handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
     978                { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
     979        | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
     980                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
     981
     982        | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     983                { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); }
     984        | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     985                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }
     986        ;
     987
     988handler_predicate_opt:
     989        //empty
     990        | ';' conditional_expression
     991        ;
     992
     993handler_key:
     994        CATCH
     995                { $$ = CatchStmt::Terminate; }
     996        | CATCHRESUME
     997                { $$ = CatchStmt::Resume; }
    969998        ;
    970999
     
    16511680        | aggregate_key attribute_list_opt typegen_name         // CFA
    16521681                { $$ = $3->addQualifiers( $2 ); }
     1682
     1683// Temp, testing TreeStruct
     1684    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
     1685        {
     1686            typedefTable.makeTypedef( *$4 );            // create typedef
     1687            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1688            forall = false;                             // reset
     1689        }
     1690      '{' field_declaration_list '}'
     1691        {
     1692            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1693                $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
     1694        }
     1695    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
     1696        {
     1697            typedefTable.makeTypedef( *$4 );            // create typedef
     1698            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1699            forall = false;                             // reset
     1700        }
     1701      '{' field_declaration_list '}'
     1702        {
     1703            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1704                $4, $5, nullptr, $8, true )->addQualifiers( $3 );
     1705        }
    16531706        ;
    16541707
     
    18291882cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    18301883        parameter_declaration
    1831         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt
     1884        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
    18321885                { $$ = $1->addName( $2 ); }
    1833         | cfa_abstract_tuple identifier_or_type_name assignment_opt
     1886        | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18341887                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    18351888                { $$ = $1->addName( $2 ); }
    1836         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt
     1889        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18371890                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    18381891        | cfa_function_specifier
     
    18511904parameter_declaration:
    18521905                // No SUE declaration in parameter list.
    1853         declaration_specifier_nobody identifier_parameter_declarator assignment_opt
     1906        declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
    18541907                {
    18551908                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    18561909                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    18571910                }
    1858         | declaration_specifier_nobody type_parameter_redeclarator assignment_opt
     1911        | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
    18591912                {
    18601913                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    18641917
    18651918abstract_parameter_declaration:
    1866         declaration_specifier_nobody assignment_opt
     1919        declaration_specifier_nobody default_initialize_opt
    18671920                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    1868         | declaration_specifier_nobody abstract_parameter_declarator assignment_opt
     1921        | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
    18691922                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    18701923        ;
     
    21672220                {
    21682221                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2169                         linkage = LinkageSpec::linkageCheck( $2 );
     2222                        linkage = LinkageSpec::linkageUpdate( linkage, $2 );
    21702223                }
    21712224          '{' external_definition_list_opt '}'
     
    22032256        ;
    22042257
     2258with_clause_opt:
     2259        // empty
     2260                { $$ = (StatementNode *)0; }                                    // FIX ME
     2261        | WITH '(' tuple_expression_list ')'
     2262                { $$ = (StatementNode *)0; }                                    // FIX ME
     2263        ;
     2264
    22052265function_definition:
    2206         cfa_function_declaration compound_statement                     // CFA
     2266        cfa_function_declaration with_clause_opt compound_statement     // CFA
    22072267                {
    22082268                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22092269                        typedefTable.leaveScope();
    2210                         $$ = $1->addFunctionBody( $2 );
    2211                 }
    2212         | declaration_specifier function_declarator compound_statement
     2270                        $$ = $1->addFunctionBody( $3 );
     2271                }
     2272        | declaration_specifier function_declarator with_clause_opt compound_statement
    22132273                {
    22142274                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22152275                        typedefTable.leaveScope();
    2216                         $$ = $2->addFunctionBody( $3 )->addType( $1 );
    2217                 }
    2218         | type_qualifier_list function_declarator compound_statement
     2276                        $$ = $2->addFunctionBody( $4 )->addType( $1 );
     2277                }
     2278        | type_qualifier_list function_declarator with_clause_opt compound_statement
    22192279                {
    22202280                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22212281                        typedefTable.leaveScope();
    2222                         $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 );
    2223                 }
    2224         | declaration_qualifier_list function_declarator compound_statement
     2282                        $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
     2283                }
     2284        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    22252285                {
    22262286                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22272287                        typedefTable.leaveScope();
    2228                         $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 );
    2229                 }
    2230         | declaration_qualifier_list type_qualifier_list function_declarator compound_statement
     2288                        $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
     2289                }
     2290        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    22312291                {
    22322292                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22332293                        typedefTable.leaveScope();
    2234                         $$ = $3->addFunctionBody( $4 )->addQualifiers( $2 )->addQualifiers( $1 );
     2294                        $$ = $3->addFunctionBody( $5 )->addQualifiers( $2 )->addQualifiers( $1 );
    22352295                }
    22362296
    22372297                // Old-style K&R function definition, OBSOLESCENT (see 4)
    2238         | declaration_specifier KR_function_declarator push KR_declaration_list_opt compound_statement
     2298        | declaration_specifier KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
    22392299                {
    22402300                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22412301                        typedefTable.leaveScope();
    2242                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addType( $1 );
    2243                 }
    2244         | type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
     2302                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addType( $1 );
     2303                }
     2304        | type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
    22452305                {
    22462306                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22472307                        typedefTable.leaveScope();
    2248                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 );
     2308                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
    22492309                }
    22502310
    22512311                // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4)
    2252         | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
     2312        | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
    22532313                {
    22542314                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22552315                        typedefTable.leaveScope();
    2256                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 );
    2257                 }
    2258         | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
     2316                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
     2317                }
     2318        | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
    22592319                {
    22602320                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22612321                        typedefTable.leaveScope();
    2262                         $$ = $3->addOldDeclList( $5 )->addFunctionBody( $6 )->addQualifiers( $2 )->addQualifiers( $1 );
     2322                        $$ = $3->addOldDeclList( $5 )->addFunctionBody( $7 )->addQualifiers( $2 )->addQualifiers( $1 );
    22632323                }
    22642324        ;
     
    23232383        | TYPEGENname
    23242384        | CONST
    2325                 { $$ = Token{ new string( "__const__" ) }; }
     2385                { $$ = Token{ new string( "__const__" ), { nullptr, -1 } }; }
    23262386        ;
    23272387
     
    30223082        ;
    30233083
    3024 assignment_opt:
     3084default_initialize_opt:
    30253085        // empty
    30263086                { $$ = nullptr; }
  • src/Parser/parserutility.cc

    rfea3faa rb826e6b  
    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
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 15:33:41 2017
    13 // Update Count     : 5
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jul 18 10:12:00 2017
     13// Update Count     : 8
    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", (unsigned long long int)0 ) ) );
     28        comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( noQualifiers ), "0", (unsigned long long int)0 ) ) );
    2929        return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    3030}
  • src/Parser/parserutility.h

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    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;
     
    809809        }
    810810
     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
    811837        void AlternativeFinder::visit( CastExpr *castExpr ) {
    812838                Type *& toType = castExpr->get_result();
     
    840866                                thisCost += Cost( 0, 0, discardedValues );
    841867
    842                                 Expression * argExpr = i->expr->clone();
    843                                 if ( argExpr->get_result()->size() > 1 && ! castExpr->get_result()->isVoid() ) {
    844                                         // Argument expression is a tuple and the target type is not void. Cast each member of the tuple
    845                                         // to its corresponding target type, producing the tuple of those cast expressions. If there are
    846                                         // more components of the tuple than components in the target type, then excess components do not
    847                                         // come out in the result expression (but UniqueExprs ensure that side effects will still be done).
    848                                         if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) {
    849                                                 // expressions which may contain side effects require a single unique instance of the expression.
    850                                                 argExpr = new UniqueExpr( argExpr );
    851                                         }
    852                                         std::list< Expression * > componentExprs;
    853                                         for ( unsigned int i = 0; i < castExpr->get_result()->size(); i++ ) {
    854                                                 // cast each component
    855                                                 TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i );
    856                                                 componentExprs.push_back( new CastExpr( idx, castExpr->get_result()->getComponent( i )->clone() ) );
    857                                         }
    858                                         delete argExpr;
    859                                         assert( componentExprs.size() > 0 );
    860                                         // produce the tuple of casts
    861                                         candidates.push_back( Alternative( new TupleExpr( componentExprs ), i->env, i->cost, thisCost ) );
    862                                 } else {
    863                                         // handle normally
    864                                         candidates.push_back( Alternative( new CastExpr( argExpr->clone(), toType->clone() ), i->env, i->cost, thisCost ) );
    865                                 }
     868                                candidates.push_back( Alternative( restructureCast( i->expr->clone(), toType ), i->env, i->cost, thisCost ) );
    866869                        } // if
    867870                } // for
     
    11821185        }
    11831186
     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        }
    11841234} // namespace ResolvExpr
    11851235
  • src/ResolvExpr/AlternativeFinder.h

    rfea3faa rb826e6b  
    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/Resolver.cc

    rfea3faa rb826e6b  
    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                        }
     
    6470                virtual void visit( BranchStmt *branchStmt ) override;
    6571                virtual void visit( ReturnStmt *returnStmt ) override;
     72                virtual void visit( ThrowStmt *throwStmt ) override;
    6673
    6774                virtual void visit( SingleInit *singleInit ) override;
     
    7986
    8087                Type * functionReturn = nullptr;
    81                 Type *initContext = nullptr;
     88                CurrentObject currentObject = nullptr;
    8289                bool inEnumDecl = false;
    8390        };
     
    186193                // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting
    187194                // the RHS.
    188                 Type *temp = initContext;
    189                 initContext = new_type;
    190                 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) {
     195                ValueGuard<CurrentObject> temp( currentObject );
     196                currentObject = CurrentObject( objectDecl->get_type() );
     197                if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) {
    191198                        // enumerator initializers should not use the enum type to initialize, since
    192199                        // the enum type is still incomplete at this point. Use signed int instead.
    193                         initContext = new BasicType( Type::Qualifiers(), BasicType::SignedInt );
     200                        currentObject = CurrentObject( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    194201                }
    195202                Parent::visit( objectDecl );
    196                 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) {
     203                if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) {
    197204                        // delete newly created signed int type
    198                         delete initContext;
    199                 }
    200                 initContext = temp;
     205                        // delete currentObject.getType();
     206                }
    201207        }
    202208
     
    315321
    316322        void Resolver::visit( SwitchStmt *switchStmt ) {
    317                 ValueGuard< Type * > oldInitContext( initContext );
     323                ValueGuard< CurrentObject > oldCurrentObject( currentObject );
    318324                Expression *newExpr;
    319325                newExpr = findIntegralExpression( switchStmt->get_condition(), *this );
     
    321327                switchStmt->set_condition( newExpr );
    322328
    323                 initContext = newExpr->get_result();
     329                currentObject = CurrentObject( newExpr->get_result() );
    324330                Parent::visit( switchStmt );
    325331        }
     
    327333        void Resolver::visit( CaseStmt *caseStmt ) {
    328334                if ( caseStmt->get_condition() ) {
    329                         assert( initContext );
    330                         CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initContext->clone() );
     335                        std::list< InitAlternative > initAlts = currentObject.getOptions();
     336                        assertf( initAlts.size() == 1, "SwitchStmt did not correctly resolve an integral expression." );
     337                        CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() );
    331338                        Expression * newExpr = findSingleExpression( castExpr, *this );
    332339                        castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
     
    360367        }
    361368
     369        void Resolver::visit( ThrowStmt *throwStmt ) {
     370                if ( throwStmt->get_expr() ) {
     371                        Expression * wrapped = new CastExpr( throwStmt->get_expr(), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     372                        Expression * newExpr = findSingleExpression( wrapped, *this );
     373                        throwStmt->set_expr( newExpr );
     374                }
     375        }
     376
    362377        template< typename T >
    363378        bool isCharType( T t ) {
     
    370385
    371386        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                                                 }
     387                // resolve initialization using the possibilities as determined by the currentObject cursor
     388                UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() );
     389                Expression * newExpr = findSingleExpression( untyped, *this );
     390                InitExpr * initExpr = safe_dynamic_cast< InitExpr * >( newExpr );
     391
     392                // move cursor to the object that is actually initialized
     393                currentObject.setNext( initExpr->get_designation() );
     394
     395                // discard InitExpr wrapper and retain relevant pieces
     396                newExpr = initExpr->get_expr();
     397                newExpr->set_env( initExpr->get_env() );
     398                initExpr->set_expr( nullptr );
     399                initExpr->set_env( nullptr );
     400                delete initExpr;
     401
     402                // get the actual object's type (may not exactly match what comes back from the resolver due to conversions)
     403                Type * initContext = currentObject.getCurrentType();
     404
     405                // check if actual object's type is char[]
     406                if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
     407                        if ( isCharType( at->get_base() ) ) {
     408                                // check if the resolved type is char *
     409                                if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
     410                                        if ( isCharType( pt->get_base() ) ) {
     411                                                // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
     412                                                CastExpr *ce = safe_dynamic_cast< CastExpr * >( newExpr );
     413                                                newExpr = ce->get_arg();
     414                                                ce->set_arg( nullptr );
     415                                                delete ce;
    419416                                        }
    420417                                }
    421418                        }
    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
     419                }
     420
     421                // set initializer expr to resolved express
     422                singleInit->set_value( newExpr );
     423
     424                // move cursor to next object in preparation for next initializer
     425                currentObject.increment();
    486426        }
    487427
    488428        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
     429                // move cursor into brace-enclosed initializer-list
     430                currentObject.enterListInit();
     431                // xxx - fix this so that the list isn't copied, iterator should be used to change current element
     432                std::list<Designation *> newDesignations;
     433                for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) {
     434                        // iterate designations and initializers in pairs, moving the cursor to the current designated object and resolving
     435                        // the initializer against that object.
     436                        Designation * des = std::get<0>(p);
     437                        Initializer * init = std::get<1>(p);
     438                        newDesignations.push_back( currentObject.findNext( des ) );
     439                        init->accept( *this );
     440                }
     441                // set the set of 'resolved' designations and leave the brace-enclosed initializer-list
     442                listInit->get_designations() = newDesignations; // xxx - memory management
     443                currentObject.exitListInit();
     444
     445                // xxx - this part has not be folded into CurrentObject yet
     446                // } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) {
     447                //      Type * base = tt->get_baseType()->get_base();
     448                //      if ( base ) {
     449                //              // know the implementation type, so try using that as the initContext
     450                //              ObjectDecl tmpObj( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, base->clone(), nullptr );
     451                //              currentObject = &tmpObj;
     452                //              visit( listInit );
     453                //      } else {
     454                //              // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context
     455                //              Parent::visit( listInit );
     456                //      }
     457                // } else {
    573458        }
    574459
  • src/ResolvExpr/Unify.cc

    rfea3faa rb826e6b  
    606606                        } else if ( tupleParam ) {
    607607                                // bundle other parameters into tuple to match
    608                                 TupleType* binder = new TupleType{ paramTy->get_qualifiers() };
     608                                std::list< Type * > binderTypes;
    609609
    610610                                do {
    611                                         binder->get_types().push_back( otherParam->get_type()->clone() );
     611                                        binderTypes.push_back( otherParam->get_type()->clone() );
    612612                                        ++jt;
    613613
     
    618618                                } while (true);
    619619
    620                                 otherParamTy = binder;
     620                                otherParamTy = new TupleType{ paramTy->get_qualifiers(), binderTypes };
    621621                                ++it;  // skip ttype parameter for break
    622622                        } else if ( otherTupleParam ) {
    623623                                // bundle parameters into tuple to match other
    624                                 TupleType* binder = new TupleType{ otherParamTy->get_qualifiers() };
     624                                std::list< Type * > binderTypes;
    625625
    626626                                do {
    627                                         binder->get_types().push_back( param->get_type()->clone() );
     627                                        binderTypes.push_back( param->get_type()->clone() );
    628628                                        ++it;
    629629
     
    634634                                } while (true);
    635635
    636                                 paramTy = binder;
     636                                paramTy = new TupleType{ otherParamTy->get_qualifiers(), binderTypes };
    637637                                ++jt;  // skip ttype parameter for break
    638638                        }
     
    756756                        return function->get_returnVals().front()->get_type()->clone();
    757757                } else {
    758                         TupleType * tupleType = new TupleType( Type::Qualifiers() );
     758                        std::list< Type * > types;
    759759                        for ( DeclarationWithType * decl : function->get_returnVals() ) {
    760                                 tupleType->get_types().push_back( decl->get_type()->clone() );
     760                                types.push_back( decl->get_type()->clone() );
    761761                        } // for
    762                         return tupleType;
     762                        return new TupleType( Type::Qualifiers(), types );
    763763                }
    764764        }
  • src/ResolvExpr/module.mk

    rfea3faa rb826e6b  
    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/SymTab/Autogen.cc

    rfea3faa rb826e6b  
    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 : Fri Jul 14 16:41:00 2017
     13// Update Count     : 62
    1414//
    1515
     
    400400        /// generates struct constructors, destructor, and assignment functions
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
     402                // Builtins do not use autogeneration.
     403                if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
     404                         aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
     405                        return;
     406                }
     407
    402408                // Make function polymorphic in same parameters as generic struct, if applicable
    403409                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
  • src/SymTab/Autogen.h

    rfea3faa rb826e6b  
    2525
    2626namespace SymTab {
    27     /// Generates assignment operators, constructors, and destructor for aggregate types as required
    28     void autogenerateRoutines( std::list< Declaration * > &translationUnit );
     27        /// Generates assignment operators, constructors, and destructor for aggregate types as required
     28        void autogenerateRoutines( std::list< Declaration * > &translationUnit );
    2929
    30     /// returns true if obj's name is the empty string and it has a bitfield width
    31     bool isUnnamedBitfield( ObjectDecl * obj );
     30        /// returns true if obj's name is the empty string and it has a bitfield width
     31        bool isUnnamedBitfield( ObjectDecl * obj );
    3232
    33     /// size_t type - set when size_t typedef is seen. Useful in a few places,
    34     /// such as in determining array dimension type
    35     extern Type * SizeType;
     33        /// size_t type - set when size_t typedef is seen. Useful in a few places,
     34        /// such as in determining array dimension type
     35        extern Type * SizeType;
    3636
    37     /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    38     template< typename OutputIterator >
     37        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
     38        template< typename OutputIterator >
    3939        Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false, bool forward = true );
    4040
    41     /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types.
    42     /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
    43     template< typename OutputIterator >
     41        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types.
     42        /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
     43        template< typename OutputIterator >
    4444        Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
    4545        // want to be able to generate assignment, ctor, and dtor generically,
     
    5050        dstParam = new AddressExpr( dstParam );
    5151        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 ) );
     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 ) );
    6463        }
    6564        fExpr->get_args().push_back( dstParam );
     
    7574
    7675        return listInit;
    77     }
    78 
    79     /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
    80     /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
    81     template< typename OutputIterator >
    82         void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) {
    83         static UniqueName indexName( "_index" );
    84 
    85         // for a flexible array member nothing is done -- user must define own assignment
    86         if ( ! array->get_dimension() ) return ;
    87 
    88         Expression * begin, * end, * update, * cmp;
    89         if ( forward ) {
    90             // generate: for ( int i = 0; i < N; ++i )
    91             begin = new ConstantExpr( Constant::from_int( 0 ) );
    92             end = array->get_dimension()->clone();
    93             cmp = new NameExpr( "?<?" );
    94             update = new NameExpr( "++?" );
    95         } else {
    96             // generate: for ( int i = N-1; i >= 0; --i )
    97             begin = new UntypedExpr( new NameExpr( "?-?" ) );
    98             ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
    99             ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
    100             end = new ConstantExpr( Constant::from_int( 0 ) );
    101             cmp = new NameExpr( "?>=?" );
    102             update = new NameExpr( "--?" );
    10376        }
    10477
    105         ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
     78        /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
     79        /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
     80        template< typename OutputIterator >
     81        void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) {
     82                static UniqueName indexName( "_index" );
    10683
    107         UntypedExpr *cond = new UntypedExpr( cmp );
    108         cond->get_args().push_back( new VariableExpr( index ) );
    109         cond->get_args().push_back( end );
     84                // for a flexible array member nothing is done -- user must define own assignment
     85                if ( ! array->get_dimension() ) return ;
    11086
    111         UntypedExpr *inc = new UntypedExpr( update );
    112         inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
     87                Expression * begin, * end, * update, * cmp;
     88                if ( forward ) {
     89                        // generate: for ( int i = 0; i < N; ++i )
     90                        begin = new ConstantExpr( Constant::from_int( 0 ) );
     91                        end = array->get_dimension()->clone();
     92                        cmp = new NameExpr( "?<?" );
     93                        update = new NameExpr( "++?" );
     94                } else {
     95                        // generate: for ( int i = N-1; i >= 0; --i )
     96                        begin = new UntypedExpr( new NameExpr( "?-?" ) );
     97                        ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
     98                        ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
     99                        end = new ConstantExpr( Constant::from_int( 0 ) );
     100                        cmp = new NameExpr( "?>=?" );
     101                        update = new NameExpr( "--?" );
     102                }
    113103
    114         UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
    115         dstIndex->get_args().push_back( dstParam );
    116         dstIndex->get_args().push_back( new VariableExpr( index ) );
    117         dstParam = dstIndex;
     104                ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin ) );
    118105
    119         // srcParam must keep track of the array indices to build the
    120         // source parameter and/or array list initializer
    121         srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
     106                UntypedExpr *cond = new UntypedExpr( cmp );
     107                cond->get_args().push_back( new VariableExpr( index ) );
     108                cond->get_args().push_back( end );
    122109
    123         // for stmt's body, eventually containing call
    124         CompoundStmt * body = new CompoundStmt( noLabels );
    125         Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
     110                UntypedExpr *inc = new UntypedExpr( update );
     111                inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
    126112
    127         // block containing for stmt and index variable
    128         std::list<Statement *> initList;
    129         CompoundStmt * block = new CompoundStmt( noLabels );
    130         block->get_kids().push_back( new DeclStmt( noLabels, index ) );
    131         if ( listInit ) block->get_kids().push_back( listInit );
    132         block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     113                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
     114                dstIndex->get_args().push_back( dstParam );
     115                dstIndex->get_args().push_back( new VariableExpr( index ) );
     116                dstParam = dstIndex;
    133117
    134         *out++ = block;
    135     }
     118                // srcParam must keep track of the array indices to build the
     119                // source parameter and/or array list initializer
     120                srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
    136121
    137     template< typename OutputIterator >
     122                // for stmt's body, eventually containing call
     123                CompoundStmt * body = new CompoundStmt( noLabels );
     124                Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
     125
     126                // block containing for stmt and index variable
     127                std::list<Statement *> initList;
     128                CompoundStmt * block = new CompoundStmt( noLabels );
     129                block->get_kids().push_back( new DeclStmt( noLabels, index ) );
     130                if ( listInit ) block->get_kids().push_back( listInit );
     131                block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     132
     133                *out++ = block;
     134        }
     135
     136        template< typename OutputIterator >
    138137        Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
    139         if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
    140             genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
    141             return 0;
    142         } else {
    143             return genScalarCall( srcParam, dstParam, fname, out, type, addCast );
     138                if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     139                        genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
     140                        return 0;
     141                } else {
     142                        return genScalarCall( srcParam, dstParam, fname, out, type, addCast );
     143                }
    144144        }
    145     }
    146145
    147     /// inserts into out a generated call expression to function fname with arguments dstParam
    148     /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the
    149     /// object being constructed. The function wraps constructor and destructor calls in an
    150     /// ImplicitCtorDtorStmt node.
    151     template< typename OutputIterator >
     146        /// inserts into out a generated call expression to function fname with arguments dstParam
     147        /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the
     148        /// object being constructed. The function wraps constructor and destructor calls in an
     149        /// ImplicitCtorDtorStmt node.
     150        template< typename OutputIterator >
    152151        void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
    153         ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
    154         assert( obj );
    155         // unnamed bit fields are not copied as they cannot be accessed
    156         if ( isUnnamedBitfield( obj ) ) return;
     152                ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
     153                assert( obj );
     154                // unnamed bit fields are not copied as they cannot be accessed
     155                if ( isUnnamedBitfield( obj ) ) return;
    157156
    158         bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );
    159         std::list< Statement * > stmts;
    160         genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
     157                bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );
     158                std::list< Statement * > stmts;
     159                genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
    161160
    162         // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
    163         assert( stmts.size() <= 1 );
    164         if ( stmts.size() == 1 ) {
    165             Statement * callStmt = stmts.front();
    166             if ( addCast ) {
    167                 // implicitly generated ctor/dtor calls should be wrapped
    168                 // so that later passes are aware they were generated.
    169                 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
    170                 // because this causes the address to be taken at codegen, which is illegal in C.
    171                 callStmt = new ImplicitCtorDtorStmt( callStmt );
    172             }
    173             *out++ = callStmt;
     161                // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
     162                assert( stmts.size() <= 1 );
     163                if ( stmts.size() == 1 ) {
     164                        Statement * callStmt = stmts.front();
     165                        if ( addCast ) {
     166                                // implicitly generated ctor/dtor calls should be wrapped
     167                                // so that later passes are aware they were generated.
     168                                // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
     169                                // because this causes the address to be taken at codegen, which is illegal in C.
     170                                callStmt = new ImplicitCtorDtorStmt( callStmt );
     171                        }
     172                        *out++ = callStmt;
     173                }
    174174        }
    175     }
    176175} // namespace SymTab
    177176#endif // AUTOGEN_H
  • src/SymTab/ImplementationType.cc

    rfea3faa rb826e6b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ImplementationType.cc -- 
     7// ImplementationType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    9292
    9393        void ImplementationType::visit(TupleType *tupleType) {
    94                 TupleType *newType = new TupleType( Type::Qualifiers() );
     94                std::list< Type * > types;
    9595                for ( std::list< Type* >::iterator i = tupleType->get_types().begin(); i != tupleType->get_types().end(); ++i ) {
    9696                        Type *implType = implementationType( *i, indexer );
    9797                        implType->get_qualifiers() |= tupleType->get_qualifiers();
    98                         newType->get_types().push_back( implType );
     98                        types.push_back( implType );
    9999                } // for
    100                 result = newType;
     100                result = new TupleType( Type::Qualifiers(), types );
    101101        }
    102102
  • src/SymTab/Indexer.cc

    rfea3faa rb826e6b  
    652652                        for ( MangleTable::const_iterator decl = mangleTable.begin(); decl != mangleTable.end(); ++decl ) {
    653653                                // check for C decls with the same name, skipping those with a compatible type (by mangleName)
    654                                 if ( decl->second->get_linkage() == LinkageSpec::C && decl->first != mangleName ) return true;
     654                                if ( ! LinkageSpec::isMangled( decl->second->get_linkage() ) && decl->first != mangleName ) return true;
    655655                        }
    656656                }
     
    669669                                // check for C decls with the same name, skipping
    670670                                // those with an incompatible type (by mangleName)
    671                                 if ( decl->second->get_linkage() == LinkageSpec::C && decl->first == mangleName ) return true;
     671                                if ( ! LinkageSpec::isMangled( decl->second->get_linkage() ) && decl->first == mangleName ) return true;
    672672                        }
    673673                }
     
    724724                        // new definition shadows the autogenerated one, even at the same scope
    725725                        return false;
    726                 } else if ( added->get_linkage() != LinkageSpec::C || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) {
     726                } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) {
    727727                        // typesCompatible doesn't really do the right thing here. When checking compatibility of function types,
    728728                        // we should ignore outermost pointer qualifiers, except _Atomic?
     
    765765
    766766                // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage
    767                 if ( decl->get_linkage() == LinkageSpec::C ) {
     767                if ( ! LinkageSpec::isMangled( decl->get_linkage() ) ) {
    768768                        // NOTE this is broken in Richard's original code in such a way that it never triggers (it
    769769                        // doesn't check decls that have the same manglename, and all C-linkage decls are defined to
  • src/SymTab/Mangler.cc

    rfea3faa rb826e6b  
    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                }
  • src/SymTab/Validate.cc

    rfea3faa rb826e6b  
    106106
    107107        /// Fix return types so that every function returns exactly one value
    108         class ReturnTypeFixer {
    109           public:
     108        struct ReturnTypeFixer {
    110109                static void fix( std::list< Declaration * > &translationUnit );
    111110
     
    115114
    116115        /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers.
    117         class EnumAndPointerDecay {
    118         public:
     116        struct EnumAndPointerDecay {
    119117                void previsit( EnumDecl *aggregateDecl );
    120118                void previsit( FunctionType *func );
     
    159157        };
    160158
    161         class ReturnChecker : public WithScopes {
    162           public:
     159        struct ReturnChecker : public WithGuards {
    163160                /// Checks that return statements return nothing if their return type is void
    164161                /// and return something if the return type is non-void.
    165162                static void checkFunctionReturns( std::list< Declaration * > & translationUnit );
    166           private:
     163
    167164                void previsit( FunctionDecl * functionDecl );
    168165                void previsit( ReturnStmt * returnStmt );
     
    205202        };
    206203
    207         class VerifyCtorDtorAssign {
    208         public:
     204        struct VerifyCtorDtorAssign {
    209205                /// ensure that constructors, destructors, and assignment have at least one
    210206                /// parameter, the first of which must be a pointer, and that ctor/dtors have no
     
    216212
    217213        /// ensure that generic types have the correct number of type arguments
    218         class ValidateGenericParameters {
    219         public:
     214        struct ValidateGenericParameters {
    220215                void previsit( StructInstType * inst );
    221216                void previsit( UnionInstType * inst );
    222217        };
    223218
    224         class ArrayLength {
    225         public:
     219        struct ArrayLength {
    226220                /// for array types without an explicit length, compute the length and store it so that it
    227221                /// is known to the rest of the phases. For example,
     
    236230        };
    237231
    238         class CompoundLiteral final : public GenPoly::DeclMutator {
     232        struct CompoundLiteral final : public WithDeclsToAdd, public WithVisitorRef<CompoundLiteral> {
    239233                Type::StorageClasses storageClasses;
    240234
    241                 using GenPoly::DeclMutator::mutate;
    242                 DeclarationWithType * mutate( ObjectDecl *objectDecl ) final;
    243                 Expression *mutate( CompoundLiteralExpr *compLitExpr ) final;
     235                void premutate( ObjectDecl *objectDecl );
     236                Expression * postmutate( CompoundLiteralExpr *compLitExpr );
    244237        };
    245238
     
    248241                LinkReferenceToTypes lrt( doDebug, 0 );
    249242                ForallPointerDecay fpd( 0 );
    250                 CompoundLiteral compoundliteral;
     243                PassVisitor<CompoundLiteral> compoundliteral;
    251244                PassVisitor<ValidateGenericParameters> genericParams;
    252245
     
    263256                Concurrency::implementThreadStarter( translationUnit );
    264257                ReturnChecker::checkFunctionReturns( translationUnit );
    265                 compoundliteral.mutateDeclarationList( translationUnit );
     258                mutateAll( translationUnit, compoundliteral );
    266259                acceptAll( translationUnit, fpd );
    267260                ArrayLength::computeLength( translationUnit );
     
    883876        }
    884877
    885         DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
     878        void CompoundLiteral::premutate( ObjectDecl *objectDecl ) {
    886879                storageClasses = objectDecl->get_storageClasses();
    887                 DeclarationWithType * temp = Mutator::mutate( objectDecl );
    888                 return temp;
    889         }
    890 
    891         Expression *CompoundLiteral::mutate( CompoundLiteralExpr *compLitExpr ) {
     880        }
     881
     882        Expression *CompoundLiteral::postmutate( CompoundLiteralExpr *compLitExpr ) {
    892883                // transform [storage_class] ... (struct S){ 3, ... };
    893884                // into [storage_class] struct S temp =  { 3, ... };
    894885                static UniqueName indexName( "_compLit" );
    895886
    896                 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_result(), compLitExpr->get_initializer() );
    897                 compLitExpr->set_result( 0 );
    898                 compLitExpr->set_initializer( 0 );
     887                ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() );
     888                compLitExpr->set_result( nullptr );
     889                compLitExpr->set_initializer( nullptr );
    899890                delete compLitExpr;
    900                 DeclarationWithType * newtempvar = mutate( tempvar );
    901                 addDeclaration( newtempvar );                                   // add modified temporary to current block
    902                 return new VariableExpr( newtempvar );
     891                declsToAddBefore.push_back( tempvar );                                  // add modified temporary to current block
     892                return new VariableExpr( tempvar );
    903893        }
    904894
  • src/SymTab/module.mk

    rfea3faa rb826e6b  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Rob Schluntz
    13 ## Last Modified On : Tue Jul 07 16:22:23 2015
    14 ## Update Count     : 2
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jul 12 13:06:00 2017
     14## Update Count     : 3
    1515###############################################################################
    1616
     
    2121       SymTab/ImplementationType.cc \
    2222       SymTab/TypeEquality.cc \
    23        SymTab/Autogen.cc
     23       SymTab/Autogen.cc \
     24       SymTab/TreeStruct.cc
  • src/SynTree/AggregateDecl.cc

    rfea3faa rb826e6b  
    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/Constant.cc

    rfea3faa rb826e6b  
    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
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:11:00 2017
    13 // Update Count     : 28
     12// Last Modified On : Fri Jul 14 14:50:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    4646}
    4747
     48Constant Constant::null( Type * ptrtype ) {
     49        if ( nullptr == ptrtype ) {
     50                ptrtype = new PointerType(
     51                        Type::Qualifiers(),
     52                        new VoidType( Type::Qualifiers() )
     53                        );
     54        }
     55
     56        return Constant( ptrtype, "0", (unsigned long long int)0 );
     57}
     58
     59unsigned long long Constant::get_ival() const {
     60        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
     61        return val.ival;
     62}
     63
     64double Constant::get_dval() const {
     65        assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     66        return val.dval;
     67}
     68
    4869void Constant::print( std::ostream &os ) const {
    4970        os << "(" << rep << " " << val.ival;
  • src/SynTree/Constant.h

    rfea3faa rb826e6b  
    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
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:13:00 2017
    13 // Update Count     : 15
     12// Last Modified On : Fri Jul 14 13:33:00 2017
     13// Update Count     : 16
    1414//
    1515
     
    3232        std::string & get_value() { return rep; }
    3333        void set_value( std::string newValue ) { rep = newValue; }
     34        unsigned long long get_ival() const;
     35        double get_dval() const;
    3436
    3537        /// generates a boolean constant of the given bool
     
    4143        /// generates a floating point constant of the given double
    4244        static Constant from_double( double d );
     45
     46        /// generates a null pointer value for the given type. void * if omitted.
     47        static Constant null( Type * ptrtype = nullptr );
    4348
    4449        virtual void accept( Visitor & v ) { v.visit( this ); }
  • src/SynTree/Declaration.h

    rfea3faa rb826e6b  
    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 : Fri Jul 14 16:59:00 2017
     13// Update Count     : 123
    1414//
    1515
     
    238238        typedef Declaration Parent;
    239239  public:
    240         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 );
    241241        AggregateDecl( const AggregateDecl &other );
    242242        virtual ~AggregateDecl();
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         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 ), tagged( false ), parent_name( "" ) {}
     269        StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {}
    269270        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270271
     
    273274        bool is_thread() { return kind == DeclarationNode::Thread; }
    274275
     276        // Tagged/Tree Structure Excetion
     277        bool get_tagged() { return tagged; }
     278        void set_tagged( bool newValue ) { tagged = newValue; }
     279        bool has_parent() { return parent_name != ""; }
     280        std::string get_parentName() { return parent_name; }
     281
    275282        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    276283        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    279286        DeclarationNode::Aggregate kind;
    280287        virtual std::string typeString() const;
     288
     289        bool tagged;
     290        std::string parent_name;
    281291};
    282292
     
    284294        typedef AggregateDecl Parent;
    285295  public:
    286         UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
     296        UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
    287297        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    288298
     
    297307        typedef AggregateDecl Parent;
    298308  public:
    299         EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
     309        EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
    300310        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    301311
  • src/SynTree/Expression.cc

    rfea3faa rb826e6b  
    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;
     
    657660}
    658661
     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
    659704std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    660705        if ( expr ) {
  • src/SynTree/Expression.h

    rfea3faa rb826e6b  
    744744};
    745745
     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
    746798std::ostream & operator<<( std::ostream & out, const Expression * expr );
    747799
  • src/SynTree/Initializer.cc

    rfea3faa rb826e6b  
    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( __attribute__((unused)) std::ostream &os, __attribute__((unused)) 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

    rfea3faa rb826e6b  
    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 ) = 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

    rfea3faa rb826e6b  
    433433}
    434434
     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
    435451
    436452Type *Mutator::mutate( VoidType *voidType ) {
     
    499515        mutateAll( tupleType->get_forall(), *this );
    500516        mutateAll( tupleType->get_types(), *this );
     517        mutateAll( tupleType->get_members(), *this );
    501518        return tupleType;
    502519}
     
    535552
    536553
     554Designation *Mutator::mutate( Designation * designation ) {
     555        mutateAll( designation->get_designators(), *this );
     556        return designation;
     557}
     558
    537559Initializer *Mutator::mutate( SingleInit *singleInit ) {
    538560        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
     
    541563
    542564Initializer *Mutator::mutate( ListInit *listInit ) {
    543         mutateAll( listInit->get_designators(), *this );
     565        mutateAll( listInit->get_designations(), *this );
    544566        mutateAll( listInit->get_initializers(), *this );
    545567        return listInit;
  • src/SynTree/Mutator.h

    rfea3faa rb826e6b  
    8585        virtual Expression* mutate( StmtExpr * stmtExpr );
    8686        virtual Expression* mutate( UniqueExpr * uniqueExpr );
     87        virtual Expression* mutate( UntypedInitExpr * initExpr );
     88        virtual Expression* mutate( InitExpr * initExpr );
    8789
    8890        virtual Type* mutate( VoidType *basicType );
     
    103105        virtual Type* mutate( OneType *oneType );
    104106
     107        virtual Designation* mutate( Designation *designation );
    105108        virtual Initializer* mutate( SingleInit *singleInit );
    106109        virtual Initializer* mutate( ListInit *listInit );
  • src/SynTree/SynTree.h

    rfea3faa rb826e6b  
    9393class StmtExpr;
    9494class UniqueExpr;
     95class UntypedInitExpr;
     96class InitExpr;
    9597
    9698class Type;
     
    113115class OneType;
    114116
     117class Designation;
    115118class Initializer;
    116119class SingleInit;
  • src/SynTree/TupleType.cc

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    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 23 16:16:36 2017
    13 // Update Count     : 149
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jul 18 10:06:00 2017
     13// Update Count     : 150
    1414//
    1515
     
    172172};
    173173
    174 extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
     174extern Type::Qualifiers noQualifiers;                           // no qualifiers on constants
    175175
    176176class VoidType : public Type {
     
    481481class TupleType : public Type {
    482482  public:
    483         TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     483        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    484484        TupleType( const TupleType& );
    485485        virtual ~TupleType();
     
    488488        typedef value_type::iterator iterator;
    489489
    490         std::list<Type*>& get_types() { return types; }
     490        std::list<Type *> & get_types() { return types; }
    491491        virtual unsigned size() const { return types.size(); };
     492
     493        // For now, this is entirely synthetic -- tuple types always have unnamed members.
     494        // Eventually, we may allow named tuples, in which case members should subsume types
     495        std::list<Declaration *> & get_members() { return members; }
    492496
    493497        iterator begin() { return types.begin(); }
     
    506510        virtual void print( std::ostream & os, int indent = 0 ) const;
    507511  private:
    508         std::list<Type*> types;
     512        std::list<Type *> types;
     513        std::list<Declaration *> members;
    509514};
    510515
  • src/SynTree/VarExprReplacer.cc

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    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

    rfea3faa rb826e6b  
    340340}
    341341
     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
    342354
    343355void Visitor::visit( VoidType *voidType ) {
     
    395407        acceptAll( tupleType->get_forall(), *this );
    396408        acceptAll( tupleType->get_types(), *this );
     409        acceptAll( tupleType->get_members(), *this );
    397410}
    398411
     
    424437}
    425438
     439void Visitor::visit( Designation * designation ) {
     440        acceptAll( designation->get_designators(), *this );
     441}
    426442
    427443void Visitor::visit( SingleInit *singleInit ) {
     
    430446
    431447void Visitor::visit( ListInit *listInit ) {
    432         acceptAll( listInit->get_designators(), *this );
     448        acceptAll( listInit->get_designations(), *this );
    433449        acceptAll( listInit->get_initializers(), *this );
    434450}
  • src/SynTree/Visitor.h

    rfea3faa rb826e6b  
    8888        virtual void visit( StmtExpr * stmtExpr );
    8989        virtual void visit( UniqueExpr * uniqueExpr );
     90        virtual void visit( UntypedInitExpr * initExpr );
     91        virtual void visit( InitExpr * initExpr );
    9092
    9193        virtual void visit( VoidType *basicType );
     
    106108        virtual void visit( OneType *oneType );
    107109
     110        virtual void visit( Designation *designation );
    108111        virtual void visit( SingleInit *singleInit );
    109112        virtual void visit( ListInit *listInit );
  • src/Tuples/TupleExpansion.cc

    rfea3faa rb826e6b  
    192192                        }
    193193                        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 ) ), noDesignators ) );
     194                                                                                                        new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) );
    195195                        addDeclaration( finished );
    196196                        // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N))
     
    310310        Type * makeTupleType( const std::list< Expression * > & exprs ) {
    311311                // produce the TupleType which aggregates the types of the exprs
    312                 TupleType *tupleType = new TupleType( Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ) );
    313                 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 );
    314314                for ( Expression * expr : exprs ) {
    315315                        assert( expr->get_result() );
    316316                        if ( expr->get_result()->isVoid() ) {
    317317                                // if the type of any expr is void, the type of the entire tuple is void
    318                                 delete tupleType;
    319318                                return new VoidType( Type::Qualifiers() );
    320319                        }
    321320                        Type * type = expr->get_result()->clone();
    322                         tupleType->get_types().push_back( type );
     321                        types.push_back( type );
    323322                        // the qualifiers on the tuple type are the qualifiers that exist on all component types
    324323                        qualifiers &= type->get_qualifiers();
    325324                } // for
    326325                if ( exprs.empty() ) qualifiers = Type::Qualifiers();
    327                 return tupleType;
     326                return new TupleType( qualifiers, types );
    328327        }
    329328
  • src/benchmark/CorCtxSwitch.c

    rfea3faa rb826e6b  
    3131
    3232        StartTime = Time();
    33         // for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
    34         //      resume( this_coroutine() );
    35         //      // resume( &s );       
    36         // }
    3733        resumer( &s, NoOfTimes );
    3834        EndTime = Time();
  • src/benchmark/Makefile.am

    rfea3faa rb826e6b  
    2020CC = @CFA_BINDIR@/@CFA_NAME@
    2121
    22 noinst_PROGRAMS = bench ctxswitch-coroutine ctxswitch-thread
     22noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
    2323
    24 bench :
     24bench$(EXEEXT) :
    2525        @for ccflags in "-debug" "-nodebug"; do \
    2626                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    3030        rm -f ./a.out ;
    3131
    32 ctxswitch-coroutine:
     32ctxswitch-coroutine$(EXEEXT):
    3333        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    3434        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    3737        @rm -f ./a.out
    3838
    39 ctxswitch-thread:
     39ctxswitch-thread$(EXEEXT):
    4040        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    4141        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    4444        @rm -f ./a.out
    4545
    46 sched-int:
     46sched-int$(EXEEXT):
    4747        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    4848        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5151        @rm -f ./a.out
    5252
    53 monitor:
     53monitor$(EXEEXT):
    5454        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    5555        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5858        @rm -f ./a.out
    5959
    60 csv-data:
     60csv-data$(EXEEXT):
    6161        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    6262        @./a.out
  • src/benchmark/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    2019
    2120VPATH = @srcdir@
     21am__is_gnu_make = { \
     22  if test -z '$(MAKELEVEL)'; then \
     23    false; \
     24  elif test -n '$(MAKE_HOST)'; then \
     25    true; \
     26  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     27    true; \
     28  else \
     29    false; \
     30  fi; \
     31}
     32am__make_running_with_option = \
     33  case $${target_option-} in \
     34      ?) ;; \
     35      *) echo "am__make_running_with_option: internal error: invalid" \
     36              "target option '$${target_option-}' specified" >&2; \
     37         exit 1;; \
     38  esac; \
     39  has_opt=no; \
     40  sane_makeflags=$$MAKEFLAGS; \
     41  if $(am__is_gnu_make); then \
     42    sane_makeflags=$$MFLAGS; \
     43  else \
     44    case $$MAKEFLAGS in \
     45      *\\[\ \   ]*) \
     46        bs=\\; \
     47        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     48          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     49    esac; \
     50  fi; \
     51  skip_next=no; \
     52  strip_trailopt () \
     53  { \
     54    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     55  }; \
     56  for flg in $$sane_makeflags; do \
     57    test $$skip_next = yes && { skip_next=no; continue; }; \
     58    case $$flg in \
     59      *=*|--*) continue;; \
     60        -*I) strip_trailopt 'I'; skip_next=yes;; \
     61      -*I?*) strip_trailopt 'I';; \
     62        -*O) strip_trailopt 'O'; skip_next=yes;; \
     63      -*O?*) strip_trailopt 'O';; \
     64        -*l) strip_trailopt 'l'; skip_next=yes;; \
     65      -*l?*) strip_trailopt 'l';; \
     66      -[dEDm]) skip_next=yes;; \
     67      -[JT]) skip_next=yes;; \
     68    esac; \
     69    case $$flg in \
     70      *$$target_option*) has_opt=yes; break;; \
     71    esac; \
     72  done; \
     73  test $$has_opt = yes
     74am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     75am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2276pkgdatadir = $(datadir)/@PACKAGE@
    2377pkgincludedir = $(includedir)/@PACKAGE@
     
    3892build_triplet = @build@
    3993host_triplet = @host@
    40 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) \
    41         ctxswitch-thread$(EXEEXT)
    4294subdir = src/benchmark
    43 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    4495ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4596am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    4697am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    4798        $(ACLOCAL_M4)
     99DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    48100mkinstalldirs = $(install_sh) -d
    49101CONFIG_HEADER = $(top_builddir)/config.h
     
    54106bench_OBJECTS = bench.$(OBJEXT)
    55107bench_LDADD = $(LDADD)
     108csv_data_SOURCES = csv-data.c
     109csv_data_OBJECTS = csv-data.$(OBJEXT)
     110csv_data_LDADD = $(LDADD)
    56111ctxswitch_coroutine_SOURCES = ctxswitch-coroutine.c
    57112ctxswitch_coroutine_OBJECTS = ctxswitch-coroutine.$(OBJEXT)
     
    60115ctxswitch_thread_OBJECTS = ctxswitch-thread.$(OBJEXT)
    61116ctxswitch_thread_LDADD = $(LDADD)
     117monitor_SOURCES = monitor.c
     118monitor_OBJECTS = monitor.$(OBJEXT)
     119monitor_LDADD = $(LDADD)
     120sched_int_SOURCES = sched-int.c
     121sched_int_OBJECTS = sched-int.$(OBJEXT)
     122sched_int_LDADD = $(LDADD)
     123AM_V_P = $(am__v_P_@AM_V@)
     124am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     125am__v_P_0 = false
     126am__v_P_1 = :
     127AM_V_GEN = $(am__v_GEN_@AM_V@)
     128am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     129am__v_GEN_0 = @echo "  GEN     " $@;
     130am__v_GEN_1 =
     131AM_V_at = $(am__v_at_@AM_V@)
     132am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     133am__v_at_0 = @
     134am__v_at_1 =
    62135DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    63136depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    68141AM_V_CC = $(am__v_CC_@AM_V@)
    69142am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    70 am__v_CC_0 = @echo "  CC    " $@;
    71 AM_V_at = $(am__v_at_@AM_V@)
    72 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    73 am__v_at_0 = @
     143am__v_CC_0 = @echo "  CC      " $@;
     144am__v_CC_1 =
    74145CCLD = $(CC)
    75146LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    76147AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    77148am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    78 am__v_CCLD_0 = @echo "  CCLD  " $@;
    79 AM_V_GEN = $(am__v_GEN_@AM_V@)
    80 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    81 am__v_GEN_0 = @echo "  GEN   " $@;
    82 SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
    83 DIST_SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
     149am__v_CCLD_0 = @echo "  CCLD    " $@;
     150am__v_CCLD_1 =
     151SOURCES = bench.c csv-data.c ctxswitch-coroutine.c ctxswitch-thread.c \
     152        monitor.c sched-int.c
     153DIST_SOURCES = bench.c csv-data.c ctxswitch-coroutine.c \
     154        ctxswitch-thread.c monitor.c sched-int.c
     155am__can_run_installinfo = \
     156  case $$AM_UPDATE_INFO_DIR in \
     157    n|no|NO) false;; \
     158    *) (install-info --version) >/dev/null 2>&1;; \
     159  esac
     160am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     161# Read a list of newline-separated strings from the standard input,
     162# and print each of them once, without duplicates.  Input order is
     163# *not* preserved.
     164am__uniquify_input = $(AWK) '\
     165  BEGIN { nonempty = 0; } \
     166  { items[$$0] = 1; nonempty = 1; } \
     167  END { if (nonempty) { for (i in items) print i; }; } \
     168'
     169# Make sure the list of sources is unique.  This is necessary because,
     170# e.g., the same source file might be shared among _SOURCES variables
     171# for different programs/libraries.
     172am__define_uniq_tagged_files = \
     173  list='$(am__tagged_files)'; \
     174  unique=`for i in $$list; do \
     175    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     176  done | $(am__uniquify_input)`
    84177ETAGS = etags
    85178CTAGS = ctags
     179am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    86180DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    87181ACLOCAL = @ACLOCAL@
     
    198292program_transform_name = @program_transform_name@
    199293psdir = @psdir@
     294runstatedir = @runstatedir@
    200295sbindir = @sbindir@
    201296sharedstatedir = @sharedstatedir@
     
    207302top_srcdir = @top_srcdir@
    208303AM_CFLAGS = -g -Wall -Wno-unused-function -O2
     304noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
    209305all: all-am
    210306
     
    223319        $(am__cd) $(top_srcdir) && \
    224320          $(AUTOMAKE) --foreign src/benchmark/Makefile
    225 .PRECIOUS: Makefile
    226321Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    227322        @case '$?' in \
     
    252347
    253348@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@
     349@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csv-data.Po@am__quote@
    254350@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-coroutine.Po@am__quote@
    255351@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-thread.Po@am__quote@
     352@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
     353@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched-int.Po@am__quote@
    256354
    257355.c.o:
    258 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    259 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     356@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     357@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     358@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    260359@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    261360@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    262 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
     361@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    263362
    264363.c.obj:
    265 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    266 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     364@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     365@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     366@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    267367@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    268368@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    269 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
    270 
    271 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    272         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    273         unique=`for i in $$list; do \
    274             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    275           done | \
    276           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    277               END { if (nonempty) { for (i in files) print i; }; }'`; \
    278         mkid -fID $$unique
    279 tags: TAGS
    280 
    281 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    282                 $(TAGS_FILES) $(LISP)
     369@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     370
     371ID: $(am__tagged_files)
     372        $(am__define_uniq_tagged_files); mkid -fID $$unique
     373tags: tags-am
     374TAGS: tags
     375
     376tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    283377        set x; \
    284378        here=`pwd`; \
    285         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    286         unique=`for i in $$list; do \
    287             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    288           done | \
    289           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    290               END { if (nonempty) { for (i in files) print i; }; }'`; \
     379        $(am__define_uniq_tagged_files); \
    291380        shift; \
    292381        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    300389          fi; \
    301390        fi
    302 ctags: CTAGS
    303 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    304                 $(TAGS_FILES) $(LISP)
    305         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    306         unique=`for i in $$list; do \
    307             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    308           done | \
    309           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    310               END { if (nonempty) { for (i in files) print i; }; }'`; \
     391ctags: ctags-am
     392
     393CTAGS: ctags
     394ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     395        $(am__define_uniq_tagged_files); \
    311396        test -z "$(CTAGS_ARGS)$$unique" \
    312397          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    317402          && $(am__cd) $(top_srcdir) \
    318403          && gtags -i $(GTAGS_ARGS) "$$here"
     404cscopelist: cscopelist-am
     405
     406cscopelist-am: $(am__tagged_files)
     407        list='$(am__tagged_files)'; \
     408        case "$(srcdir)" in \
     409          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     410          *) sdir=$(subdir)/$(srcdir) ;; \
     411        esac; \
     412        for i in $$list; do \
     413          if test -f "$$i"; then \
     414            echo "$(subdir)/$$i"; \
     415          else \
     416            echo "$$sdir/$$i"; \
     417          fi; \
     418        done >> $(top_builddir)/cscope.files
    319419
    320420distclean-tags:
     
    456556.MAKE: install-am install-strip
    457557
    458 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    459         clean-noinstPROGRAMS ctags distclean distclean-compile \
    460         distclean-generic distclean-tags distdir dvi dvi-am html \
    461         html-am info info-am install install-am install-data \
    462         install-data-am install-dvi install-dvi-am install-exec \
    463         install-exec-am install-html install-html-am install-info \
    464         install-info-am install-man install-pdf install-pdf-am \
    465         install-ps install-ps-am install-strip installcheck \
    466         installcheck-am installdirs maintainer-clean \
     558.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
     559        clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
     560        distclean-compile distclean-generic distclean-tags distdir dvi \
     561        dvi-am html html-am info info-am install install-am \
     562        install-data install-data-am install-dvi install-dvi-am \
     563        install-exec install-exec-am install-html install-html-am \
     564        install-info install-info-am install-man install-pdf \
     565        install-pdf-am install-ps install-ps-am install-strip \
     566        installcheck installcheck-am installdirs maintainer-clean \
    467567        maintainer-clean-generic mostlyclean mostlyclean-compile \
    468         mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
     568        mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    469569        uninstall-am
    470570
    471 
    472 bench :
     571.PRECIOUS: Makefile
     572
     573
     574bench$(EXEEXT) :
    473575        @for ccflags in "-debug" "-nodebug"; do \
    474576                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    478580        rm -f ./a.out ;
    479581
    480 ctxswitch-coroutine:
     582ctxswitch-coroutine$(EXEEXT):
    481583        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    482584        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    485587        @rm -f ./a.out
    486588
    487 ctxswitch-thread:
     589ctxswitch-thread$(EXEEXT):
    488590        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    489591        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    492594        @rm -f ./a.out
    493595
    494 sched-int:
     596sched-int$(EXEEXT):
    495597        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    496598        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    499601        @rm -f ./a.out
    500602
    501 monitor:
     603monitor$(EXEEXT):
    502604        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    503605        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    506608        @rm -f ./a.out
    507609
    508 csv-data:
     610csv-data$(EXEEXT):
    509611        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    510612        @./a.out
  • src/benchmark/bench.h

    rfea3faa rb826e6b  
    2626#define N 10000000
    2727#endif
     28
     29unsigned int default_preemption() {
     30        return 0;
     31}
  • src/benchmark/create_pthrd.c

    rfea3faa rb826e6b  
    1414                n = atoi(argv[1]);
    1515        }
    16         printf("%lu\n", n);
     16        printf("create %lu pthreads ... ", n);
    1717
    1818        for (size_t i = 0; i < n; i++) {
    19                 pthread_attr_t attr;
    20                 if (pthread_attr_init(&attr) < 0) {
     19                pthread_t thread;
     20                if (pthread_create(&thread, NULL, foo, NULL) < 0) {
     21                        perror( "failure" );
    2122                        return 1;
    2223                }
    23                 if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) < 0) {
    24                         return 1;
    25                 }
    26                 pthread_t thread;
    27                 if (pthread_create(&thread, &attr, foo, NULL) < 0) {
     24
     25                if (pthread_join( thread, NULL) < 0) {
     26                        perror( "failure" );
    2827                        return 1;
    2928                }
    3029        }
    31         pthread_exit(NULL);
    32         return 0;
     30        printf("finish\n");
    3331}
  • src/benchmark/csv-data.c

    rfea3faa rb826e6b  
    2525}
    2626
    27 #ifndef N
    28 #define N 100000000
    29 #endif
    30 
    3127//-----------------------------------------------------------------------------
    3228// coroutine context switch
     
    3834
    3935        StartTime = Time();
    40         // for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
    41         //      resume( this_coroutine() );
    42         //      // resume( &s );
    43         // }
    4436        resumer( &s, NoOfTimes );
    4537        EndTime = Time();
     
    10496mon_t mon1;
    10597
    106 condition cond1a; 
     98condition cond1a;
    10799condition cond1b;
    108100
     
    152144mon_t mon2;
    153145
    154 condition cond2a; 
     146condition cond2a;
    155147condition cond2b;
    156148
  • src/driver/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    2019
    2120VPATH = @srcdir@
     21am__is_gnu_make = { \
     22  if test -z '$(MAKELEVEL)'; then \
     23    false; \
     24  elif test -n '$(MAKE_HOST)'; then \
     25    true; \
     26  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     27    true; \
     28  else \
     29    false; \
     30  fi; \
     31}
     32am__make_running_with_option = \
     33  case $${target_option-} in \
     34      ?) ;; \
     35      *) echo "am__make_running_with_option: internal error: invalid" \
     36              "target option '$${target_option-}' specified" >&2; \
     37         exit 1;; \
     38  esac; \
     39  has_opt=no; \
     40  sane_makeflags=$$MAKEFLAGS; \
     41  if $(am__is_gnu_make); then \
     42    sane_makeflags=$$MFLAGS; \
     43  else \
     44    case $$MAKEFLAGS in \
     45      *\\[\ \   ]*) \
     46        bs=\\; \
     47        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     48          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     49    esac; \
     50  fi; \
     51  skip_next=no; \
     52  strip_trailopt () \
     53  { \
     54    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     55  }; \
     56  for flg in $$sane_makeflags; do \
     57    test $$skip_next = yes && { skip_next=no; continue; }; \
     58    case $$flg in \
     59      *=*|--*) continue;; \
     60        -*I) strip_trailopt 'I'; skip_next=yes;; \
     61      -*I?*) strip_trailopt 'I';; \
     62        -*O) strip_trailopt 'O'; skip_next=yes;; \
     63      -*O?*) strip_trailopt 'O';; \
     64        -*l) strip_trailopt 'l'; skip_next=yes;; \
     65      -*l?*) strip_trailopt 'l';; \
     66      -[dEDm]) skip_next=yes;; \
     67      -[JT]) skip_next=yes;; \
     68    esac; \
     69    case $$flg in \
     70      *$$target_option*) has_opt=yes; break;; \
     71    esac; \
     72  done; \
     73  test $$has_opt = yes
     74am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     75am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2276pkgdatadir = $(datadir)/@PACKAGE@
    2377pkgincludedir = $(includedir)/@PACKAGE@
     
    4498cc1lib_PROGRAMS = cc1$(EXEEXT)
    4599subdir = src/driver
    46 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    47100ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    48101am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    49102am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    50103        $(ACLOCAL_M4)
     104DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    51105mkinstalldirs = $(install_sh) -d
    52106CONFIG_HEADER = $(top_builddir)/config.h
     
    61115cfa_OBJECTS = $(am_cfa_OBJECTS)
    62116cfa_LDADD = $(LDADD)
     117AM_V_P = $(am__v_P_@AM_V@)
     118am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     119am__v_P_0 = false
     120am__v_P_1 = :
     121AM_V_GEN = $(am__v_GEN_@AM_V@)
     122am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     123am__v_GEN_0 = @echo "  GEN     " $@;
     124am__v_GEN_1 =
     125AM_V_at = $(am__v_at_@AM_V@)
     126am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     127am__v_at_0 = @
     128am__v_at_1 =
    63129DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    64130depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    69135AM_V_CXX = $(am__v_CXX_@AM_V@)
    70136am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
    71 am__v_CXX_0 = @echo "  CXX   " $@;
    72 AM_V_at = $(am__v_at_@AM_V@)
    73 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    74 am__v_at_0 = @
     137am__v_CXX_0 = @echo "  CXX     " $@;
     138am__v_CXX_1 =
    75139CXXLD = $(CXX)
    76140CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
     
    78142AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
    79143am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
    80 am__v_CXXLD_0 = @echo "  CXXLD " $@;
    81 AM_V_GEN = $(am__v_GEN_@AM_V@)
    82 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    83 am__v_GEN_0 = @echo "  GEN   " $@;
     144am__v_CXXLD_0 = @echo "  CXXLD   " $@;
     145am__v_CXXLD_1 =
    84146SOURCES = $(cc1_SOURCES) $(cfa_SOURCES)
    85147DIST_SOURCES = $(cc1_SOURCES) $(cfa_SOURCES)
     148am__can_run_installinfo = \
     149  case $$AM_UPDATE_INFO_DIR in \
     150    n|no|NO) false;; \
     151    *) (install-info --version) >/dev/null 2>&1;; \
     152  esac
     153am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     154# Read a list of newline-separated strings from the standard input,
     155# and print each of them once, without duplicates.  Input order is
     156# *not* preserved.
     157am__uniquify_input = $(AWK) '\
     158  BEGIN { nonempty = 0; } \
     159  { items[$$0] = 1; nonempty = 1; } \
     160  END { if (nonempty) { for (i in items) print i; }; } \
     161'
     162# Make sure the list of sources is unique.  This is necessary because,
     163# e.g., the same source file might be shared among _SOURCES variables
     164# for different programs/libraries.
     165am__define_uniq_tagged_files = \
     166  list='$(am__tagged_files)'; \
     167  unique=`for i in $$list; do \
     168    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     169  done | $(am__uniquify_input)`
    86170ETAGS = etags
    87171CTAGS = ctags
     172am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    88173DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    89174ACLOCAL = @ACLOCAL@
     
    198283program_transform_name = @program_transform_name@
    199284psdir = @psdir@
     285runstatedir = @runstatedir@
    200286sbindir = @sbindir@
    201287sharedstatedir = @sharedstatedir@
     
    232318        $(am__cd) $(top_srcdir) && \
    233319          $(AUTOMAKE) --foreign src/driver/Makefile
    234 .PRECIOUS: Makefile
    235320Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    236321        @case '$?' in \
     
    252337install-cc1libPROGRAMS: $(cc1lib_PROGRAMS)
    253338        @$(NORMAL_INSTALL)
    254         test -z "$(cc1libdir)" || $(MKDIR_P) "$(DESTDIR)$(cc1libdir)"
    255339        @list='$(cc1lib_PROGRAMS)'; test -n "$(cc1libdir)" || list=; \
     340        if test -n "$$list"; then \
     341          echo " $(MKDIR_P) '$(DESTDIR)$(cc1libdir)'"; \
     342          $(MKDIR_P) "$(DESTDIR)$(cc1libdir)" || exit 1; \
     343        fi; \
    256344        for p in $$list; do echo "$$p $$p"; done | \
    257345        sed 's/$(EXEEXT)$$//' | \
    258         while read p p1; do if test -f $$p; \
    259           then echo "$$p"; echo "$$p"; else :; fi; \
     346        while read p p1; do if test -f $$p \
     347          ; then echo "$$p"; echo "$$p"; else :; fi; \
    260348        done | \
    261         sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
     349        sed -e 'p;s,.*/,,;n;h' \
     350            -e 's|.*|.|' \
    262351            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    263352        sed 'N;N;N;s,\n, ,g' | \
     
    280369        files=`for p in $$list; do echo "$$p"; done | \
    281370          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
    282               -e 's/$$/$(EXEEXT)/' `; \
     371              -e 's/$$/$(EXEEXT)/' \
     372        `; \
    283373        test -n "$$list" || exit 0; \
    284374        echo " ( cd '$(DESTDIR)$(cc1libdir)' && rm -f" $$files ")"; \
     
    290380clean-noinstPROGRAMS:
    291381        -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
     382
    292383cc1$(EXEEXT): $(cc1_OBJECTS) $(cc1_DEPENDENCIES) $(EXTRA_cc1_DEPENDENCIES)
    293384        @rm -f cc1$(EXEEXT)
    294385        $(AM_V_CXXLD)$(CXXLINK) $(cc1_OBJECTS) $(cc1_LDADD) $(LIBS)
     386
    295387cfa$(EXEEXT): $(cfa_OBJECTS) $(cfa_DEPENDENCIES) $(EXTRA_cfa_DEPENDENCIES)
    296388        @rm -f cfa$(EXEEXT)
     
    307399
    308400.cc.o:
    309 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    310 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     401@am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     402@am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     403@am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
    311404@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    312405@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     
    314407
    315408.cc.obj:
    316 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    317 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     409@am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     410@am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     411@am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
    318412@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    319413@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    320414@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    321415
    322 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    323         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    324         unique=`for i in $$list; do \
    325             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    326           done | \
    327           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    328               END { if (nonempty) { for (i in files) print i; }; }'`; \
    329         mkid -fID $$unique
    330 tags: TAGS
    331 
    332 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    333                 $(TAGS_FILES) $(LISP)
     416ID: $(am__tagged_files)
     417        $(am__define_uniq_tagged_files); mkid -fID $$unique
     418tags: tags-am
     419TAGS: tags
     420
     421tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    334422        set x; \
    335423        here=`pwd`; \
    336         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    337         unique=`for i in $$list; do \
    338             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    339           done | \
    340           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    341               END { if (nonempty) { for (i in files) print i; }; }'`; \
     424        $(am__define_uniq_tagged_files); \
    342425        shift; \
    343426        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    351434          fi; \
    352435        fi
    353 ctags: CTAGS
    354 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    355                 $(TAGS_FILES) $(LISP)
    356         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    357         unique=`for i in $$list; do \
    358             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    359           done | \
    360           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    361               END { if (nonempty) { for (i in files) print i; }; }'`; \
     436ctags: ctags-am
     437
     438CTAGS: ctags
     439ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     440        $(am__define_uniq_tagged_files); \
    362441        test -z "$(CTAGS_ARGS)$$unique" \
    363442          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    368447          && $(am__cd) $(top_srcdir) \
    369448          && gtags -i $(GTAGS_ARGS) "$$here"
     449cscopelist: cscopelist-am
     450
     451cscopelist-am: $(am__tagged_files)
     452        list='$(am__tagged_files)'; \
     453        case "$(srcdir)" in \
     454          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     455          *) sdir=$(subdir)/$(srcdir) ;; \
     456        esac; \
     457        for i in $$list; do \
     458          if test -f "$$i"; then \
     459            echo "$(subdir)/$$i"; \
     460          else \
     461            echo "$$sdir/$$i"; \
     462          fi; \
     463        done >> $(top_builddir)/cscope.files
    370464
    371465distclean-tags:
     
    514608.MAKE: install-am install-exec-am install-strip uninstall-am
    515609
    516 .PHONY: CTAGS GTAGS all all-am check check-am clean \
    517         clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS ctags \
    518         distclean distclean-compile distclean-generic distclean-tags \
    519         distdir dvi dvi-am html html-am info info-am install \
    520         install-am install-cc1libPROGRAMS install-data install-data-am \
    521         install-dvi install-dvi-am install-exec install-exec-am \
    522         install-exec-hook install-html install-html-am install-info \
    523         install-info-am install-man install-pdf install-pdf-am \
    524         install-ps install-ps-am install-strip installcheck \
    525         installcheck-am installdirs maintainer-clean \
    526         maintainer-clean-generic mostlyclean mostlyclean-compile \
    527         mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
    528         uninstall-am uninstall-cc1libPROGRAMS uninstall-hook
     610.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
     611        clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS \
     612        cscopelist-am ctags ctags-am distclean distclean-compile \
     613        distclean-generic distclean-tags distdir dvi dvi-am html \
     614        html-am info info-am install install-am install-cc1libPROGRAMS \
     615        install-data install-data-am install-dvi install-dvi-am \
     616        install-exec install-exec-am install-exec-hook install-html \
     617        install-html-am install-info install-info-am install-man \
     618        install-pdf install-pdf-am install-ps install-ps-am \
     619        install-strip installcheck installcheck-am installdirs \
     620        maintainer-clean maintainer-clean-generic mostlyclean \
     621        mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
     622        tags tags-am uninstall uninstall-am uninstall-cc1libPROGRAMS \
     623        uninstall-hook
     624
     625.PRECIOUS: Makefile
    529626
    530627
  • src/examples/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    2019
    2120VPATH = @srcdir@
     21am__is_gnu_make = { \
     22  if test -z '$(MAKELEVEL)'; then \
     23    false; \
     24  elif test -n '$(MAKE_HOST)'; then \
     25    true; \
     26  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     27    true; \
     28  else \
     29    false; \
     30  fi; \
     31}
     32am__make_running_with_option = \
     33  case $${target_option-} in \
     34      ?) ;; \
     35      *) echo "am__make_running_with_option: internal error: invalid" \
     36              "target option '$${target_option-}' specified" >&2; \
     37         exit 1;; \
     38  esac; \
     39  has_opt=no; \
     40  sane_makeflags=$$MAKEFLAGS; \
     41  if $(am__is_gnu_make); then \
     42    sane_makeflags=$$MFLAGS; \
     43  else \
     44    case $$MAKEFLAGS in \
     45      *\\[\ \   ]*) \
     46        bs=\\; \
     47        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     48          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     49    esac; \
     50  fi; \
     51  skip_next=no; \
     52  strip_trailopt () \
     53  { \
     54    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     55  }; \
     56  for flg in $$sane_makeflags; do \
     57    test $$skip_next = yes && { skip_next=no; continue; }; \
     58    case $$flg in \
     59      *=*|--*) continue;; \
     60        -*I) strip_trailopt 'I'; skip_next=yes;; \
     61      -*I?*) strip_trailopt 'I';; \
     62        -*O) strip_trailopt 'O'; skip_next=yes;; \
     63      -*O?*) strip_trailopt 'O';; \
     64        -*l) strip_trailopt 'l'; skip_next=yes;; \
     65      -*l?*) strip_trailopt 'l';; \
     66      -[dEDm]) skip_next=yes;; \
     67      -[JT]) skip_next=yes;; \
     68    esac; \
     69    case $$flg in \
     70      *$$target_option*) has_opt=yes; break;; \
     71    esac; \
     72  done; \
     73  test $$has_opt = yes
     74am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     75am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2276pkgdatadir = $(datadir)/@PACKAGE@
    2377pkgincludedir = $(includedir)/@PACKAGE@
     
    4195        avl_test$(EXEEXT) Bench$(EXEEXT)
    4296subdir = src/examples
    43 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    4497ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4598am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    4699am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    47100        $(ACLOCAL_M4)
     101DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    48102mkinstalldirs = $(install_sh) -d
    49103CONFIG_HEADER = $(top_builddir)/config.h
     
    54108Bench_OBJECTS = Bench.$(OBJEXT)
    55109Bench_LDADD = $(LDADD)
    56 am_avl_test_OBJECTS = avl_test.$(OBJEXT) avl0.$(OBJEXT) avl1.$(OBJEXT) \
    57         avl2.$(OBJEXT) avl3.$(OBJEXT) avl4.$(OBJEXT) \
    58         avl-private.$(OBJEXT)
     110am__dirstamp = $(am__leading_dot)dirstamp
     111am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \
     112        avltree/avl0.$(OBJEXT) avltree/avl1.$(OBJEXT) \
     113        avltree/avl2.$(OBJEXT) avltree/avl3.$(OBJEXT) \
     114        avltree/avl4.$(OBJEXT) avltree/avl-private.$(OBJEXT)
    59115avl_test_OBJECTS = $(am_avl_test_OBJECTS)
    60116avl_test_LDADD = $(LDADD)
     
    66122vector_test_OBJECTS = $(am_vector_test_OBJECTS)
    67123vector_test_LDADD = $(LDADD)
     124AM_V_P = $(am__v_P_@AM_V@)
     125am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     126am__v_P_0 = false
     127am__v_P_1 = :
     128AM_V_GEN = $(am__v_GEN_@AM_V@)
     129am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     130am__v_GEN_0 = @echo "  GEN     " $@;
     131am__v_GEN_1 =
     132AM_V_at = $(am__v_at_@AM_V@)
     133am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     134am__v_at_0 = @
     135am__v_at_1 =
    68136DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    69137depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
    70138am__depfiles_maybe = depfiles
    71139am__mv = mv -f
    72 AM_V_lt = $(am__v_lt_@AM_V@)
    73 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    74 am__v_lt_0 = --silent
    75140COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    76141        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    77142AM_V_CC = $(am__v_CC_@AM_V@)
    78143am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    79 am__v_CC_0 = @echo "  CC    " $@;
    80 AM_V_at = $(am__v_at_@AM_V@)
    81 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    82 am__v_at_0 = @
     144am__v_CC_0 = @echo "  CC      " $@;
     145am__v_CC_1 =
    83146CCLD = $(CC)
    84147LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    85148AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    86149am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    87 am__v_CCLD_0 = @echo "  CCLD  " $@;
    88 AM_V_GEN = $(am__v_GEN_@AM_V@)
    89 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    90 am__v_GEN_0 = @echo "  GEN   " $@;
     150am__v_CCLD_0 = @echo "  CCLD    " $@;
     151am__v_CCLD_1 =
    91152SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    92153        $(vector_test_SOURCES)
    93154DIST_SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    94155        $(vector_test_SOURCES)
     156am__can_run_installinfo = \
     157  case $$AM_UPDATE_INFO_DIR in \
     158    n|no|NO) false;; \
     159    *) (install-info --version) >/dev/null 2>&1;; \
     160  esac
     161am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     162# Read a list of newline-separated strings from the standard input,
     163# and print each of them once, without duplicates.  Input order is
     164# *not* preserved.
     165am__uniquify_input = $(AWK) '\
     166  BEGIN { nonempty = 0; } \
     167  { items[$$0] = 1; nonempty = 1; } \
     168  END { if (nonempty) { for (i in items) print i; }; } \
     169'
     170# Make sure the list of sources is unique.  This is necessary because,
     171# e.g., the same source file might be shared among _SOURCES variables
     172# for different programs/libraries.
     173am__define_uniq_tagged_files = \
     174  list='$(am__tagged_files)'; \
     175  unique=`for i in $$list; do \
     176    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     177  done | $(am__uniquify_input)`
    95178ETAGS = etags
    96179CTAGS = ctags
     180am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    97181DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    98182ACLOCAL = @ACLOCAL@
     
    209293program_transform_name = @program_transform_name@
    210294psdir = @psdir@
     295runstatedir = @runstatedir@
    211296sbindir = @sbindir@
    212297sharedstatedir = @sharedstatedir@
     
    237322        $(am__cd) $(top_srcdir) && \
    238323          $(AUTOMAKE) --foreign src/examples/Makefile
    239 .PRECIOUS: Makefile
    240324Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    241325        @case '$?' in \
     
    258342clean-noinstPROGRAMS:
    259343        -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
     344avltree/$(am__dirstamp):
     345        @$(MKDIR_P) avltree
     346        @: > avltree/$(am__dirstamp)
     347avltree/$(DEPDIR)/$(am__dirstamp):
     348        @$(MKDIR_P) avltree/$(DEPDIR)
     349        @: > avltree/$(DEPDIR)/$(am__dirstamp)
     350avltree/avl_test.$(OBJEXT): avltree/$(am__dirstamp) \
     351        avltree/$(DEPDIR)/$(am__dirstamp)
     352avltree/avl0.$(OBJEXT): avltree/$(am__dirstamp) \
     353        avltree/$(DEPDIR)/$(am__dirstamp)
     354avltree/avl1.$(OBJEXT): avltree/$(am__dirstamp) \
     355        avltree/$(DEPDIR)/$(am__dirstamp)
     356avltree/avl2.$(OBJEXT): avltree/$(am__dirstamp) \
     357        avltree/$(DEPDIR)/$(am__dirstamp)
     358avltree/avl3.$(OBJEXT): avltree/$(am__dirstamp) \
     359        avltree/$(DEPDIR)/$(am__dirstamp)
     360avltree/avl4.$(OBJEXT): avltree/$(am__dirstamp) \
     361        avltree/$(DEPDIR)/$(am__dirstamp)
     362avltree/avl-private.$(OBJEXT): avltree/$(am__dirstamp) \
     363        avltree/$(DEPDIR)/$(am__dirstamp)
     364
    260365avl_test$(EXEEXT): $(avl_test_OBJECTS) $(avl_test_DEPENDENCIES) $(EXTRA_avl_test_DEPENDENCIES)
    261366        @rm -f avl_test$(EXEEXT)
    262367        $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
     368
    263369fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)
    264370        @rm -f fstream_test$(EXEEXT)
    265371        $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
     372
    266373vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES)
    267374        @rm -f vector_test$(EXEEXT)
     
    270377mostlyclean-compile:
    271378        -rm -f *.$(OBJEXT)
     379        -rm -f avltree/*.$(OBJEXT)
    272380
    273381distclean-compile:
     
    276384@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bench.Po@am__quote@
    277385@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    278 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl-private.Po@am__quote@
    279 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl0.Po@am__quote@
    280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl1.Po@am__quote@
    281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl2.Po@am__quote@
    282 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl3.Po@am__quote@
    283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@
    284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_test.Po@am__quote@
    285386@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@
    286387@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@
    287388@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@
     389@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@
     390@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@
     391@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl1.Po@am__quote@
     392@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl2.Po@am__quote@
     393@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl3.Po@am__quote@
     394@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl4.Po@am__quote@
     395@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test.Po@am__quote@
    288396
    289397.c.o:
    290 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    291 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     398@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     399@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     400@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    292401@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    293402@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    294 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
     403@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    295404
    296405.c.obj:
    297 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    298 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     406@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     407@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     408@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    299409@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    300410@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    301 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
    302 
    303 avl_test.o: avltree/avl_test.c
    304 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.o -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    305 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
    306 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.o' libtool=no @AMDEPBACKSLASH@
    307 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    308 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    309 
    310 avl_test.obj: avltree/avl_test.c
    311 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.obj -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    312 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
    313 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.obj' libtool=no @AMDEPBACKSLASH@
    314 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    315 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    316 
    317 avl0.o: avltree/avl0.c
    318 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.o -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    319 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
    320 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.o' libtool=no @AMDEPBACKSLASH@
    321 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    322 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    323 
    324 avl0.obj: avltree/avl0.c
    325 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.obj -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    326 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
    327 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.obj' libtool=no @AMDEPBACKSLASH@
    328 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    329 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    330 
    331 avl1.o: avltree/avl1.c
    332 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.o -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    333 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
    334 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.o' libtool=no @AMDEPBACKSLASH@
    335 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    336 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    337 
    338 avl1.obj: avltree/avl1.c
    339 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.obj -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    340 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
    341 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.obj' libtool=no @AMDEPBACKSLASH@
    342 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    343 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    344 
    345 avl2.o: avltree/avl2.c
    346 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.o -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    347 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
    348 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.o' libtool=no @AMDEPBACKSLASH@
    349 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    350 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    351 
    352 avl2.obj: avltree/avl2.c
    353 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.obj -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    354 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
    355 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.obj' libtool=no @AMDEPBACKSLASH@
    356 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    357 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    358 
    359 avl3.o: avltree/avl3.c
    360 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.o -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    361 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
    362 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.o' libtool=no @AMDEPBACKSLASH@
    363 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    364 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    365 
    366 avl3.obj: avltree/avl3.c
    367 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.obj -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    368 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
    369 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.obj' libtool=no @AMDEPBACKSLASH@
    370 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    371 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    372 
    373 avl4.o: avltree/avl4.c
    374 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.o -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    375 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
    376 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.o' libtool=no @AMDEPBACKSLASH@
    377 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    378 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    379 
    380 avl4.obj: avltree/avl4.c
    381 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.obj -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    382 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
    383 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.obj' libtool=no @AMDEPBACKSLASH@
    384 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    385 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    386 
    387 avl-private.o: avltree/avl-private.c
    388 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.o -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    389 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
    390 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.o' libtool=no @AMDEPBACKSLASH@
    391 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    392 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    393 
    394 avl-private.obj: avltree/avl-private.c
    395 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.obj -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    396 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
    397 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.obj' libtool=no @AMDEPBACKSLASH@
    398 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    399 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    400 
    401 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    402         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    403         unique=`for i in $$list; do \
    404             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    405           done | \
    406           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    407               END { if (nonempty) { for (i in files) print i; }; }'`; \
    408         mkid -fID $$unique
    409 tags: TAGS
    410 
    411 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    412                 $(TAGS_FILES) $(LISP)
     411@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     412
     413ID: $(am__tagged_files)
     414        $(am__define_uniq_tagged_files); mkid -fID $$unique
     415tags: tags-am
     416TAGS: tags
     417
     418tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    413419        set x; \
    414420        here=`pwd`; \
    415         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    416         unique=`for i in $$list; do \
    417             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    418           done | \
    419           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    420               END { if (nonempty) { for (i in files) print i; }; }'`; \
     421        $(am__define_uniq_tagged_files); \
    421422        shift; \
    422423        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    430431          fi; \
    431432        fi
    432 ctags: CTAGS
    433 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    434                 $(TAGS_FILES) $(LISP)
    435         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    436         unique=`for i in $$list; do \
    437             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    438           done | \
    439           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    440               END { if (nonempty) { for (i in files) print i; }; }'`; \
     433ctags: ctags-am
     434
     435CTAGS: ctags
     436ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     437        $(am__define_uniq_tagged_files); \
    441438        test -z "$(CTAGS_ARGS)$$unique" \
    442439          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    447444          && $(am__cd) $(top_srcdir) \
    448445          && gtags -i $(GTAGS_ARGS) "$$here"
     446cscopelist: cscopelist-am
     447
     448cscopelist-am: $(am__tagged_files)
     449        list='$(am__tagged_files)'; \
     450        case "$(srcdir)" in \
     451          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     452          *) sdir=$(subdir)/$(srcdir) ;; \
     453        esac; \
     454        for i in $$list; do \
     455          if test -f "$$i"; then \
     456            echo "$(subdir)/$$i"; \
     457          else \
     458            echo "$$sdir/$$i"; \
     459          fi; \
     460        done >> $(top_builddir)/cscope.files
    449461
    450462distclean-tags:
     
    511523        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    512524        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
     525        -rm -f avltree/$(DEPDIR)/$(am__dirstamp)
     526        -rm -f avltree/$(am__dirstamp)
    513527
    514528maintainer-clean-generic:
     
    520534
    521535distclean: distclean-am
    522         -rm -rf ./$(DEPDIR)
     536        -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)
    523537        -rm -f Makefile
    524538distclean-am: clean-am distclean-compile distclean-generic \
     
    566580
    567581maintainer-clean: maintainer-clean-am
    568         -rm -rf ./$(DEPDIR)
     582        -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)
    569583        -rm -f Makefile
    570584maintainer-clean-am: distclean-am maintainer-clean-generic
     
    586600.MAKE: install-am install-strip
    587601
    588 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    589         clean-noinstPROGRAMS ctags distclean distclean-compile \
    590         distclean-generic distclean-tags distdir dvi dvi-am html \
    591         html-am info info-am install install-am install-data \
    592         install-data-am install-dvi install-dvi-am install-exec \
    593         install-exec-am install-html install-html-am install-info \
    594         install-info-am install-man install-pdf install-pdf-am \
    595         install-ps install-ps-am install-strip installcheck \
    596         installcheck-am installdirs maintainer-clean \
     602.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
     603        clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
     604        distclean-compile distclean-generic distclean-tags distdir dvi \
     605        dvi-am html html-am info info-am install install-am \
     606        install-data install-data-am install-dvi install-dvi-am \
     607        install-exec install-exec-am install-html install-html-am \
     608        install-info install-info-am install-man install-pdf \
     609        install-pdf-am install-ps install-ps-am install-strip \
     610        installcheck installcheck-am installdirs maintainer-clean \
    597611        maintainer-clean-generic mostlyclean mostlyclean-compile \
    598         mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
     612        mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    599613        uninstall-am
     614
     615.PRECIOUS: Makefile
    600616
    601617
  • src/include/assert.h

    rfea3faa rb826e6b  
    1515
    1616#pragma once
     17// Pragmas for header cleanup tool
     18// IWYU pragma: private, include <cassert>
    1719
    1820#include_next <assert.h>
  • src/libcfa/Makefile.am

    rfea3faa rb826e6b  
    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 : Fri Jun 14 17:00:00 2017
     14## Update Count     : 216
    1515###############################################################################
    1616
    1717# create object files in directory with source files
    1818AUTOMAKE_OPTIONS = subdir-objects
     19ARFLAGS = cr
    1920
    2021libdir = ${CFA_LIBDIR}
     
    5051
    5152libobjs = ${headers:=.o}
    52 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c}
     53libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     54        exception.c typeobject.c
    5355
    5456# not all platforms support concurrency, add option do disable it
     
    6466        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6567
     68libcfa_a-exception.o : exception.c
     69        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     70
     71libcfa_a-typeobject.o : typeobject.c
     72        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     73
    6674concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
     75        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     76
     77libcfa_d_a-exception.o : exception.c
     78        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     79
     80libcfa_d_a-typeobject.o : typeobject.c
    6781        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    6882
  • src/libcfa/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    2120
    2221VPATH = @srcdir@
     22am__is_gnu_make = { \
     23  if test -z '$(MAKELEVEL)'; then \
     24    false; \
     25  elif test -n '$(MAKE_HOST)'; then \
     26    true; \
     27  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     28    true; \
     29  else \
     30    false; \
     31  fi; \
     32}
     33am__make_running_with_option = \
     34  case $${target_option-} in \
     35      ?) ;; \
     36      *) echo "am__make_running_with_option: internal error: invalid" \
     37              "target option '$${target_option-}' specified" >&2; \
     38         exit 1;; \
     39  esac; \
     40  has_opt=no; \
     41  sane_makeflags=$$MAKEFLAGS; \
     42  if $(am__is_gnu_make); then \
     43    sane_makeflags=$$MFLAGS; \
     44  else \
     45    case $$MAKEFLAGS in \
     46      *\\[\ \   ]*) \
     47        bs=\\; \
     48        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     49          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     50    esac; \
     51  fi; \
     52  skip_next=no; \
     53  strip_trailopt () \
     54  { \
     55    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     56  }; \
     57  for flg in $$sane_makeflags; do \
     58    test $$skip_next = yes && { skip_next=no; continue; }; \
     59    case $$flg in \
     60      *=*|--*) continue;; \
     61        -*I) strip_trailopt 'I'; skip_next=yes;; \
     62      -*I?*) strip_trailopt 'I';; \
     63        -*O) strip_trailopt 'O'; skip_next=yes;; \
     64      -*O?*) strip_trailopt 'O';; \
     65        -*l) strip_trailopt 'l'; skip_next=yes;; \
     66      -*l?*) strip_trailopt 'l';; \
     67      -[dEDm]) skip_next=yes;; \
     68      -[JT]) skip_next=yes;; \
     69    esac; \
     70    case $$flg in \
     71      *$$target_option*) has_opt=yes; break;; \
     72    esac; \
     73  done; \
     74  test $$has_opt = yes
     75am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     76am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2377pkgdatadir = $(datadir)/@PACKAGE@
    2478pkgincludedir = $(includedir)/@PACKAGE@
     
    48102@BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c
    49103subdir = src/libcfa
    50 DIST_COMMON = $(am__nobase_cfa_include_HEADERS_DIST) \
    51         $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    52104ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    53105am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    54106am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    55107        $(ACLOCAL_M4)
     108DIST_COMMON = $(srcdir)/Makefile.am \
     109        $(am__nobase_cfa_include_HEADERS_DIST) $(am__DIST_COMMON)
    56110mkinstalldirs = $(install_sh) -d
    57111CONFIG_HEADER = $(top_builddir)/config.h
     
    88142LIBRARIES = $(lib_LIBRARIES)
    89143AR = ar
    90 ARFLAGS = cru
    91144AM_V_AR = $(am__v_AR_@AM_V@)
    92145am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
    93 am__v_AR_0 = @echo "  AR    " $@;
    94 AM_V_at = $(am__v_at_@AM_V@)
    95 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    96 am__v_at_0 = @
     146am__v_AR_0 = @echo "  AR      " $@;
     147am__v_AR_1 =
    97148libcfa_d_a_AR = $(AR) $(ARFLAGS)
    98149libcfa_d_a_LIBADD =
     
    102153        containers/pair.c containers/result.c containers/vector.c \
    103154        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
     155        concurrency/kernel.c concurrency/monitor.c exception.c \
     156        typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     157        concurrency/alarm.c concurrency/invoke.c \
     158        concurrency/preemption.c
    107159am__dirstamp = $(am__leading_dot)dirstamp
    108160@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    126178        libcfa_d_a-interpose.$(OBJEXT) \
    127179        libhdr/libcfa_d_a-libdebug.$(OBJEXT) $(am__objects_2) \
     180        libcfa_d_a-exception.$(OBJEXT) libcfa_d_a-typeobject.$(OBJEXT) \
    128181        $(am__objects_3)
    129182am_libcfa_d_a_OBJECTS = $(am__objects_4)
     
    136189        containers/pair.c containers/result.c containers/vector.c \
    137190        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
     191        concurrency/kernel.c concurrency/monitor.c exception.c \
     192        typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     193        concurrency/alarm.c concurrency/invoke.c \
     194        concurrency/preemption.c
    141195@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    142196@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    158212        libcfa_a-interpose.$(OBJEXT) \
    159213        libhdr/libcfa_a-libdebug.$(OBJEXT) $(am__objects_6) \
     214        libcfa_a-exception.$(OBJEXT) libcfa_a-typeobject.$(OBJEXT) \
    160215        $(am__objects_7)
    161216am_libcfa_a_OBJECTS = $(am__objects_8)
    162217libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     218AM_V_P = $(am__v_P_@AM_V@)
     219am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     220am__v_P_0 = false
     221am__v_P_1 = :
     222AM_V_GEN = $(am__v_GEN_@AM_V@)
     223am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     224am__v_GEN_0 = @echo "  GEN     " $@;
     225am__v_GEN_1 =
     226AM_V_at = $(am__v_at_@AM_V@)
     227am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     228am__v_at_0 = @
     229am__v_at_1 =
    163230DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    164231depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    169236AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
    170237am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
    171 am__v_CPPAS_0 = @echo "  CPPAS " $@;
     238am__v_CPPAS_0 = @echo "  CPPAS   " $@;
     239am__v_CPPAS_1 =
    172240AM_V_lt = $(am__v_lt_@AM_V@)
    173241am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    174242am__v_lt_0 = --silent
     243am__v_lt_1 =
    175244COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    176245        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    177246AM_V_CC = $(am__v_CC_@AM_V@)
    178247am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    179 am__v_CC_0 = @echo "  CC    " $@;
     248am__v_CC_0 = @echo "  CC      " $@;
     249am__v_CC_1 =
    180250CCLD = $(CC)
    181251LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    182252AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    183253am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    184 am__v_CCLD_0 = @echo "  CCLD  " $@;
    185 AM_V_GEN = $(am__v_GEN_@AM_V@)
    186 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    187 am__v_GEN_0 = @echo "  GEN   " $@;
     254am__v_CCLD_0 = @echo "  CCLD    " $@;
     255am__v_CCLD_1 =
    188256SOURCES = $(libcfa_d_a_SOURCES) $(libcfa_a_SOURCES)
    189257DIST_SOURCES = $(am__libcfa_d_a_SOURCES_DIST) \
    190258        $(am__libcfa_a_SOURCES_DIST)
     259am__can_run_installinfo = \
     260  case $$AM_UPDATE_INFO_DIR in \
     261    n|no|NO) false;; \
     262    *) (install-info --version) >/dev/null 2>&1;; \
     263  esac
    191264am__nobase_cfa_include_HEADERS_DIST = assert fstream iostream iterator \
    192265        limits math rational stdlib containers/maybe containers/pair \
     
    195268        ${shell echo stdhdr/*} gmp concurrency/invoke.h
    196269HEADERS = $(nobase_cfa_include_HEADERS)
     270am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     271# Read a list of newline-separated strings from the standard input,
     272# and print each of them once, without duplicates.  Input order is
     273# *not* preserved.
     274am__uniquify_input = $(AWK) '\
     275  BEGIN { nonempty = 0; } \
     276  { items[$$0] = 1; nonempty = 1; } \
     277  END { if (nonempty) { for (i in items) print i; }; } \
     278'
     279# Make sure the list of sources is unique.  This is necessary because,
     280# e.g., the same source file might be shared among _SOURCES variables
     281# for different programs/libraries.
     282am__define_uniq_tagged_files = \
     283  list='$(am__tagged_files)'; \
     284  unique=`for i in $$list; do \
     285    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     286  done | $(am__uniquify_input)`
    197287ETAGS = etags
    198288CTAGS = ctags
     289am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    199290DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    200291ACLOCAL = @ACLOCAL@
     
    309400program_transform_name = @program_transform_name@
    310401psdir = @psdir@
     402runstatedir = @runstatedir@
    311403sbindir = @sbindir@
    312404sharedstatedir = @sharedstatedir@
     
    320412# create object files in directory with source files
    321413AUTOMAKE_OPTIONS = subdir-objects
     414ARFLAGS = cr
    322415lib_LIBRARIES = $(am__append_1) $(am__append_2)
    323416EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@
     
    328421libobjs = ${headers:=.o}
    329422libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
    330         $(am__append_4)
     423        exception.c typeobject.c $(am__append_4)
    331424libcfa_a_SOURCES = ${libsrc}
    332425libcfa_a_CFLAGS = -nodebug -O2
     
    353446        $(am__cd) $(top_srcdir) && \
    354447          $(AUTOMAKE) --foreign src/libcfa/Makefile
    355 .PRECIOUS: Makefile
    356448Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    357449        @case '$?' in \
     
    373465install-libLIBRARIES: $(lib_LIBRARIES)
    374466        @$(NORMAL_INSTALL)
    375         test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
    376467        @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
    377468        list2=; for p in $$list; do \
     
    381472        done; \
    382473        test -z "$$list2" || { \
     474          echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
     475          $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
    383476          echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
    384477          $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
     
    448541        concurrency/$(am__dirstamp) \
    449542        concurrency/$(DEPDIR)/$(am__dirstamp)
     543
    450544libcfa-d.a: $(libcfa_d_a_OBJECTS) $(libcfa_d_a_DEPENDENCIES) $(EXTRA_libcfa_d_a_DEPENDENCIES)
    451545        $(AM_V_at)-rm -f libcfa-d.a
     
    477571        concurrency/$(am__dirstamp) \
    478572        concurrency/$(DEPDIR)/$(am__dirstamp)
     573
    479574libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES)
    480575        $(AM_V_at)-rm -f libcfa.a
     
    484579mostlyclean-compile:
    485580        -rm -f *.$(OBJEXT)
    486         -rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT)
    487         -rm -f concurrency/libcfa_a-alarm.$(OBJEXT)
    488         -rm -f concurrency/libcfa_a-coroutine.$(OBJEXT)
    489         -rm -f concurrency/libcfa_a-invoke.$(OBJEXT)
    490         -rm -f concurrency/libcfa_a-kernel.$(OBJEXT)
    491         -rm -f concurrency/libcfa_a-monitor.$(OBJEXT)
    492         -rm -f concurrency/libcfa_a-preemption.$(OBJEXT)
    493         -rm -f concurrency/libcfa_a-thread.$(OBJEXT)
    494         -rm -f concurrency/libcfa_d_a-alarm.$(OBJEXT)
    495         -rm -f concurrency/libcfa_d_a-coroutine.$(OBJEXT)
    496         -rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT)
    497         -rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT)
    498         -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
    499         -rm -f concurrency/libcfa_d_a-preemption.$(OBJEXT)
    500         -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
    501         -rm -f containers/libcfa_a-maybe.$(OBJEXT)
    502         -rm -f containers/libcfa_a-pair.$(OBJEXT)
    503         -rm -f containers/libcfa_a-result.$(OBJEXT)
    504         -rm -f containers/libcfa_a-vector.$(OBJEXT)
    505         -rm -f containers/libcfa_d_a-maybe.$(OBJEXT)
    506         -rm -f containers/libcfa_d_a-pair.$(OBJEXT)
    507         -rm -f containers/libcfa_d_a-result.$(OBJEXT)
    508         -rm -f containers/libcfa_d_a-vector.$(OBJEXT)
    509         -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT)
    510         -rm -f libhdr/libcfa_d_a-libdebug.$(OBJEXT)
     581        -rm -f concurrency/*.$(OBJEXT)
     582        -rm -f containers/*.$(OBJEXT)
     583        -rm -f libhdr/*.$(OBJEXT)
    511584
    512585distclean-compile:
     
    514587
    515588@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-assert.Po@am__quote@
     589@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-exception.Po@am__quote@
    516590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-fstream.Po@am__quote@
    517591@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-interpose.Po@am__quote@
     
    523597@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@
    524598@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@
     599@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-typeobject.Po@am__quote@
    525600@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@
     601@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@
    526602@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-fstream.Po@am__quote@
    527603@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-interpose.Po@am__quote@
     
    533609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@
    534610@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
     611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-typeobject.Po@am__quote@
    535612@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@
    536613@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@
     
    850927@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`
    851928
     929libcfa_d_a-exception.obj: exception.c
     930@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-exception.Tpo -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
     931@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-exception.Tpo $(DEPDIR)/libcfa_d_a-exception.Po
     932@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='exception.c' object='libcfa_d_a-exception.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_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
     935
     936libcfa_d_a-typeobject.obj: typeobject.c
     937@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-typeobject.Tpo -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     938@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-typeobject.Tpo $(DEPDIR)/libcfa_d_a-typeobject.Po
     939@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_d_a-typeobject.obj' 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_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     942
    852943concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c
    853944@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
     
    11441235@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`
    11451236
     1237libcfa_a-exception.obj: exception.c
     1238@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_a-exception.Tpo -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
     1239@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-exception.Tpo $(DEPDIR)/libcfa_a-exception.Po
     1240@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='exception.c' object='libcfa_a-exception.obj' libtool=no @AMDEPBACKSLASH@
     1241@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1242@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
     1243
     1244libcfa_a-typeobject.obj: typeobject.c
     1245@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_a-typeobject.Tpo -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     1246@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-typeobject.Tpo $(DEPDIR)/libcfa_a-typeobject.Po
     1247@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@
     1248@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1249@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     1250
    11461251concurrency/libcfa_a-alarm.o: concurrency/alarm.c
    11471252@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
     
    11801285install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS)
    11811286        @$(NORMAL_INSTALL)
    1182         test -z "$(cfa_includedir)" || $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)"
    11831287        @list='$(nobase_cfa_include_HEADERS)'; test -n "$(cfa_includedir)" || list=; \
     1288        if test -n "$$list"; then \
     1289          echo " $(MKDIR_P) '$(DESTDIR)$(cfa_includedir)'"; \
     1290          $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)" || exit 1; \
     1291        fi; \
    11841292        $(am__nobase_list) | while read dir files; do \
    11851293          xfiles=; for file in $$files; do \
     
    11881296          test -z "$$xfiles" || { \
    11891297            test "x$$dir" = x. || { \
    1190               echo "$(MKDIR_P) '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
     1298              echo " $(MKDIR_P) '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
    11911299              $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)/$$dir"; }; \
    11921300            echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
     
    12001308        dir='$(DESTDIR)$(cfa_includedir)'; $(am__uninstall_files_from_dir)
    12011309
    1202 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    1203         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    1204         unique=`for i in $$list; do \
    1205             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    1206           done | \
    1207           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    1208               END { if (nonempty) { for (i in files) print i; }; }'`; \
    1209         mkid -fID $$unique
    1210 tags: TAGS
    1211 
    1212 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    1213                 $(TAGS_FILES) $(LISP)
     1310ID: $(am__tagged_files)
     1311        $(am__define_uniq_tagged_files); mkid -fID $$unique
     1312tags: tags-am
     1313TAGS: tags
     1314
     1315tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    12141316        set x; \
    12151317        here=`pwd`; \
    1216         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    1217         unique=`for i in $$list; do \
    1218             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    1219           done | \
    1220           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    1221               END { if (nonempty) { for (i in files) print i; }; }'`; \
     1318        $(am__define_uniq_tagged_files); \
    12221319        shift; \
    12231320        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    12311328          fi; \
    12321329        fi
    1233 ctags: CTAGS
    1234 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    1235                 $(TAGS_FILES) $(LISP)
    1236         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    1237         unique=`for i in $$list; do \
    1238             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    1239           done | \
    1240           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    1241               END { if (nonempty) { for (i in files) print i; }; }'`; \
     1330ctags: ctags-am
     1331
     1332CTAGS: ctags
     1333ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     1334        $(am__define_uniq_tagged_files); \
    12421335        test -z "$(CTAGS_ARGS)$$unique" \
    12431336          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    12481341          && $(am__cd) $(top_srcdir) \
    12491342          && gtags -i $(GTAGS_ARGS) "$$here"
     1343cscopelist: cscopelist-am
     1344
     1345cscopelist-am: $(am__tagged_files)
     1346        list='$(am__tagged_files)'; \
     1347        case "$(srcdir)" in \
     1348          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     1349          *) sdir=$(subdir)/$(srcdir) ;; \
     1350        esac; \
     1351        for i in $$list; do \
     1352          if test -f "$$i"; then \
     1353            echo "$(subdir)/$$i"; \
     1354          else \
     1355            echo "$$sdir/$$i"; \
     1356          fi; \
     1357        done >> $(top_builddir)/cscope.files
    12501358
    12511359distclean-tags:
     
    13991507.MAKE: install-am install-strip
    14001508
    1401 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    1402         clean-libLIBRARIES ctags distclean distclean-compile \
    1403         distclean-generic distclean-tags distdir dvi dvi-am html \
    1404         html-am info info-am install install-am install-data \
    1405         install-data-am install-dvi install-dvi-am install-exec \
    1406         install-exec-am install-html install-html-am install-info \
    1407         install-info-am install-libLIBRARIES install-man \
     1509.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
     1510        clean-libLIBRARIES cscopelist-am ctags ctags-am distclean \
     1511        distclean-compile distclean-generic distclean-tags distdir dvi \
     1512        dvi-am html html-am info info-am install install-am \
     1513        install-data install-data-am install-dvi install-dvi-am \
     1514        install-exec install-exec-am install-html install-html-am \
     1515        install-info install-info-am install-libLIBRARIES install-man \
    14081516        install-nobase_cfa_includeHEADERS install-pdf install-pdf-am \
    14091517        install-ps install-ps-am install-strip installcheck \
     
    14111519        maintainer-clean-generic maintainer-clean-local mostlyclean \
    14121520        mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
    1413         tags uninstall uninstall-am uninstall-libLIBRARIES \
     1521        tags tags-am uninstall uninstall-am uninstall-libLIBRARIES \
    14141522        uninstall-nobase_cfa_includeHEADERS
     1523
     1524.PRECIOUS: Makefile
    14151525
    14161526
     
    14281538        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    14291539
     1540libcfa_a-exception.o : exception.c
     1541        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     1542
     1543libcfa_a-typeobject.o : typeobject.c
     1544        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     1545
    14301546concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
     1547        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     1548
     1549libcfa_d_a-exception.o : exception.c
     1550        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     1551
     1552libcfa_d_a-typeobject.o : typeobject.c
    14311553        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    14321554
  • src/libcfa/concurrency/CtxSwitch-i386.S

    rfea3faa rb826e6b  
    9898        ret
    9999
    100 .text
    101         .align 2
    102 .globl  CtxGet
    103 CtxGet:
    104         movl %esp,SP_OFFSET(%eax)
    105         movl %ebp,FP_OFFSET(%eax)
    106 
    107         ret
    108 
    109100// Local Variables: //
    110101// compile-command: "make install" //
  • src/libcfa/concurrency/CtxSwitch-x86_64.S

    rfea3faa rb826e6b  
    1 //                               -*- Mode: Asm -*- 
     1//                               -*- Mode: Asm -*-
    22//
    33// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1818// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    1919// option) any later version.
    20 // 
     20//
    2121// This library is distributed in the  hope that it will be useful, but WITHOUT
    2222// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    2323// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    2424// for more details.
    25 // 
     25//
    2626// You should  have received a  copy of the  GNU Lesser General  Public License
    2727// along  with this library.
    28 // 
     28//
    2929
    3030// This context switch routine depends on the fact that the stack of a new
     
    9393.globl  CtxInvokeStub
    9494CtxInvokeStub:
    95         movq %rbx, %rdi 
     95        movq %rbx, %rdi
    9696        jmp *%r12
    97 
    98 .text
    99         .align 2
    100 .globl  CtxGet
    101 CtxGet:
    102         movq %rsp,SP_OFFSET(%rdi)
    103         movq %rbp,FP_OFFSET(%rdi)
    104 
    105         ret
    10697
    10798// Local Variables: //
  • src/libcfa/concurrency/alarm.c

    rfea3faa rb826e6b  
    1616
    1717extern "C" {
     18#include <errno.h>
     19#include <stdio.h>
     20#include <string.h>
    1821#include <time.h>
     22#include <unistd.h>
    1923#include <sys/time.h>
    2024}
     25
     26#include "libhdr.h"
    2127
    2228#include "alarm.h"
     
    2531
    2632//=============================================================================================
     33// time type
     34//=============================================================================================
     35
     36#define one_second         1_000_000_000ul
     37#define one_milisecond         1_000_000ul
     38#define one_microsecond            1_000ul
     39#define one_nanosecond                 1ul
     40
     41__cfa_time_t zero_time = { 0 };
     42
     43void ?{}( __cfa_time_t * this ) { this->val = 0; }
     44void ?{}( __cfa_time_t * this, zero_t zero ) { this->val = 0; }
     45
     46void ?{}( itimerval * this, __cfa_time_t * alarm ) {
     47        this->it_value.tv_sec = alarm->val / one_second;                        // seconds
     48        this->it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds
     49        this->it_interval.tv_sec = 0;
     50        this->it_interval.tv_usec = 0;
     51}
     52
     53
     54void ?{}( __cfa_time_t * this, timespec * curr ) {
     55        uint64_t secs  = curr->tv_sec;
     56        uint64_t nsecs = curr->tv_nsec;
     57        this->val = (secs * one_second) + nsecs;
     58}
     59
     60__cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs ) {
     61        this->val = 0;
     62        return *this;
     63}
     64
     65__cfa_time_t from_s ( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000_000_000ul; return ret; }
     66__cfa_time_t from_ms( uint64_t val ) { __cfa_time_t ret; ret.val = val *     1_000_000ul; return ret; }
     67__cfa_time_t from_us( uint64_t val ) { __cfa_time_t ret; ret.val = val *         1_000ul; return ret; }
     68__cfa_time_t from_ns( uint64_t val ) { __cfa_time_t ret; ret.val = val *             1ul; return ret; }
     69
     70//=============================================================================================
    2771// Clock logic
    2872//=============================================================================================
     
    3175        timespec curr;
    3276        clock_gettime( CLOCK_REALTIME, &curr );
    33         return ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec;
     77        return (__cfa_time_t){ &curr };
    3478}
    3579
    3680void __kernel_set_timer( __cfa_time_t alarm ) {
    37         itimerval val;
    38         val.it_value.tv_sec = alarm / TIMEGRAN;                 // seconds
    39         val.it_value.tv_usec = (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ); // microseconds
    40         val.it_interval.tv_sec = 0;
    41         val.it_interval.tv_usec = 0;
     81        itimerval val = { &alarm };
    4282        setitimer( ITIMER_REAL, &val, NULL );
    4383}
     
    4787//=============================================================================================
    4888
    49 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
     89void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
    5090        this->thrd = thrd;
    5191        this->alarm = alarm;
     
    5696}
    5797
    58 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
     98void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
    5999        this->proc = proc;
    60100        this->alarm = alarm;
     
    71111}
    72112
     113LIB_DEBUG_DO( bool validate( alarm_list_t * this ) {
     114        alarm_node_t ** it = &this->head;
     115        while( (*it) ) {
     116                it = &(*it)->next;
     117        }
     118
     119        return it == this->tail;
     120})
     121
    73122static inline void insert_at( alarm_list_t * this, alarm_node_t * n, __alarm_it_t p ) {
    74         assert( !n->next );
     123        verify( !n->next );
    75124        if( p == this->tail ) {
    76125                this->tail = &n->next;
     
    80129        }
    81130        *p = n;
     131
     132        verify( validate( this ) );
    82133}
    83134
     
    89140
    90141        insert_at( this, n, it );
     142
     143        verify( validate( this ) );
    91144}
    92145
     
    100153                head->next = NULL;
    101154        }
     155        verify( validate( this ) );
    102156        return head;
    103157}
     
    105159static inline void remove_at( alarm_list_t * this, alarm_node_t * n, __alarm_it_t it ) {
    106160        verify( it );
    107         verify( (*it)->next == n );
    108 
    109         (*it)->next = n->next;
     161        verify( (*it) == n );
     162
     163        (*it) = n->next;
    110164        if( !n-> next ) {
    111165                this->tail = it;
    112166        }
    113167        n->next = NULL;
     168
     169        verify( validate( this ) );
    114170}
    115171
    116172static inline void remove( alarm_list_t * this, alarm_node_t * n ) {
    117173        alarm_node_t ** it = &this->head;
    118         while( (*it) && (*it)->next != n ) {
     174        while( (*it) && (*it) != n ) {
    119175                it = &(*it)->next;
    120176        }
    121177
     178        verify( validate( this ) );
     179
    122180        if( *it ) { remove_at( this, n, it ); }
     181
     182        verify( validate( this ) );
    123183}
    124184
    125185void register_self( alarm_node_t * this ) {
     186        alarm_list_t * alarms = &event_kernel->alarms;
     187
    126188        disable_interrupts();
    127         assert( !systemProcessor->pending_alarm );
    128         lock( &systemProcessor->alarm_lock );
     189        lock( &event_kernel->lock DEBUG_CTX2 );
    129190        {
    130                 insert( &systemProcessor->alarms, this );
    131                 if( systemProcessor->pending_alarm ) {
    132                         tick_preemption();
     191                verify( validate( alarms ) );
     192                bool first = !alarms->head;
     193
     194                insert( alarms, this );
     195                if( first ) {
     196                        __kernel_set_timer( alarms->head->alarm - __kernel_get_time() );
    133197                }
    134198        }
    135         unlock( &systemProcessor->alarm_lock );
     199        unlock( &event_kernel->lock );
    136200        this->set = true;
    137         enable_interrupts();
     201        enable_interrupts( DEBUG_CTX );
    138202}
    139203
    140204void unregister_self( alarm_node_t * this ) {
    141205        disable_interrupts();
    142         lock( &systemProcessor->alarm_lock );
    143         remove( &systemProcessor->alarms, this );
    144         unlock( &systemProcessor->alarm_lock );
    145         disable_interrupts();
     206        lock( &event_kernel->lock DEBUG_CTX2 );
     207        {
     208                verify( validate( &event_kernel->alarms ) );
     209                remove( &event_kernel->alarms, this );
     210        }
     211        unlock( &event_kernel->lock );
     212        enable_interrupts( DEBUG_CTX );
    146213        this->set = false;
    147214}
  • src/libcfa/concurrency/alarm.h

    rfea3faa rb826e6b  
    1919
    2020#include <stdbool.h>
     21#include <stdint.h>
    2122
    2223#include "assert"
    23 
    24 typedef unsigned long int __cfa_time_t;
    2524
    2625struct thread_desc;
    2726struct processor;
    2827
     28struct timespec;
     29struct itimerval;
     30
     31//=============================================================================================
     32// time type
     33//=============================================================================================
     34
     35struct __cfa_time_t {
     36        uint64_t val;
     37};
     38
     39// ctors
     40void ?{}( __cfa_time_t * this );
     41void ?{}( __cfa_time_t * this, zero_t zero );
     42void ?{}( __cfa_time_t * this, timespec * curr );
     43void ?{}( itimerval * this, __cfa_time_t * alarm );
     44
     45__cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs );
     46
     47// logical ops
     48static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }
     49static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }
     50static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >  rhs.val; }
     51static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <  rhs.val; }
     52static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }
     53static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }
     54
     55static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }
     56static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }
     57static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >  rhs; }
     58static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <  rhs; }
     59static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }
     60static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }
     61
     62// addition/substract
     63static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {
     64        __cfa_time_t ret;
     65        ret.val = lhs.val + rhs.val;
     66        return ret;
     67}
     68
     69static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {
     70        __cfa_time_t ret;
     71        ret.val = lhs.val - rhs.val;
     72        return ret;
     73}
     74
     75__cfa_time_t from_s ( uint64_t );
     76__cfa_time_t from_ms( uint64_t );
     77__cfa_time_t from_us( uint64_t );
     78__cfa_time_t from_ns( uint64_t );
     79
     80extern __cfa_time_t zero_time;
     81
    2982//=============================================================================================
    3083// Clock logic
    3184//=============================================================================================
    32 
    33 #define TIMEGRAN 1_000_000_000L                         // nanosecond granularity, except for timeval
    3485
    3586__cfa_time_t __kernel_get_time();
     
    56107typedef alarm_node_t ** __alarm_it_t;
    57108
    58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
    59 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
     109void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
     110void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
    60111void ^?{}( alarm_node_t * this );
    61112
  • src/libcfa/concurrency/coroutine

    rfea3faa rb826e6b  
    6363
    6464// Get current coroutine
    65 coroutine_desc * this_coroutine(void);
     65extern volatile thread_local coroutine_desc * this_coroutine;
    6666
    6767// Private wrappers for context switch and stack creation
     
    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,
     
    8888forall(dtype T | is_coroutine(T))
    8989static inline void resume(T * cor) {
    90         coroutine_desc * src = this_coroutine();                // optimization
     90        coroutine_desc * src = this_coroutine;          // optimization
    9191        coroutine_desc * dst = get_coroutine(cor);
    9292
     
    112112
    113113static inline void resume(coroutine_desc * dst) {
    114         coroutine_desc * src = this_coroutine();                // optimization
     114        coroutine_desc * src = this_coroutine;          // optimization
    115115
    116116        // not resuming self ?
  • src/libcfa/concurrency/coroutine.c

    rfea3faa rb826e6b  
    3232#include "invoke.h"
    3333
    34 extern thread_local processor * this_processor;
     34extern volatile thread_local processor * this_processor;
    3535
    3636//-----------------------------------------------------------------------------
     
    4444// Coroutine ctors and dtors
    4545void ?{}(coStack_t* this) {
    46         this->size              = 10240;        // size of stack
     46        this->size              = 65000;        // size of stack
    4747        this->storage   = NULL; // pointer to stack
    4848        this->limit             = NULL; // stack grows towards stack limit
     
    5050        this->context   = NULL; // address of cfa_context_t
    5151        this->top               = NULL; // address of top of storage
    52         this->userStack = false;       
     52        this->userStack = false;
    5353}
    5454
     
    106106
    107107        // set state of current coroutine to inactive
    108         src->state = Inactive;
     108        src->state = src->state == Halted ? Halted : Inactive;
    109109
    110110        // set new coroutine that task is executing
    111         this_processor->current_coroutine = dst;
     111        this_coroutine = dst;
    112112
    113113        // context switch to specified coroutine
     114        assert( src->stack.context );
    114115        CtxSwitch( src->stack.context, dst->stack.context );
    115         // when CtxSwitch returns we are back in the src coroutine             
     116        // when CtxSwitch returns we are back in the src coroutine
    116117
    117118        // set state of new coroutine to active
     
    131132                this->size = libCeiling( storageSize, 16 );
    132133                // use malloc/memalign because "new" raises an exception for out-of-memory
    133                
     134
    134135                // assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment
    135136                LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );
  • src/libcfa/concurrency/invoke.c

    rfea3faa rb826e6b  
    2929
    3030extern void __suspend_internal(void);
    31 extern void __leave_monitor_desc( struct monitor_desc * this );
     31extern void __leave_thread_monitor( struct thread_desc * this );
     32extern void disable_interrupts();
     33extern void enable_interrupts( DEBUG_CTX_PARAM );
    3234
    3335void CtxInvokeCoroutine(
    34       void (*main)(void *), 
    35       struct coroutine_desc *(*get_coroutine)(void *), 
     36      void (*main)(void *),
     37      struct coroutine_desc *(*get_coroutine)(void *),
    3638      void *this
    3739) {
     
    5658
    5759void CtxInvokeThread(
    58       void (*dtor)(void *), 
    59       void (*main)(void *), 
    60       struct thread_desc *(*get_thread)(void *), 
     60      void (*dtor)(void *),
     61      void (*main)(void *),
     62      struct thread_desc *(*get_thread)(void *),
    6163      void *this
    6264) {
     65      // First suspend, once the thread arrives here,
     66      // the function pointer to main can be invalidated without risk
    6367      __suspend_internal();
    6468
     69      // Fetch the thread handle from the user defined thread structure
    6570      struct thread_desc* thrd = get_thread( this );
    66       struct coroutine_desc* cor = &thrd->cor;
    67       struct monitor_desc* mon = &thrd->mon;
    68       cor->state = Active;
    6971
    70       // LIB_DEBUG_PRINTF("Invoke Thread : invoking main %p (args %p)\n", main, this);
     72      // Officially start the thread by enabling preemption
     73      enable_interrupts( DEBUG_CTX );
     74
     75      // Call the main of the thread
    7176      main( this );
    7277
    73       __leave_monitor_desc( mon );
    74 
     78      // To exit a thread we must :
     79      // 1 - Mark it as halted
     80      // 2 - Leave its monitor
     81      // 3 - Disable the interupts
     82      // 4 - Final suspend
     83      // The order of these 4 operations is very important
    7584      //Final suspend, should never return
    76       __suspend_internal();
     85      __leave_thread_monitor( thrd );
    7786      abortf("Resumed dead thread");
    7887}
     
    8089
    8190void CtxStart(
    82       void (*main)(void *), 
    83       struct coroutine_desc *(*get_coroutine)(void *), 
    84       void *this, 
     91      void (*main)(void *),
     92      struct coroutine_desc *(*get_coroutine)(void *),
     93      void *this,
    8594      void (*invoke)(void *)
    8695) {
     
    108117        ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = invoke;
    109118      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520
    110       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7 
     119      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
    111120
    112121#elif defined( __x86_64__ )
     
    128137      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = invoke;
    129138      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520
    130       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7 
     139      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
    131140#else
    132141      #error Only __i386__ and __x86_64__ is supported for threads in cfa
  • src/libcfa/concurrency/invoke.h

    rfea3faa rb826e6b  
    3131      struct spinlock {
    3232            volatile int lock;
     33            #ifdef __CFA_DEBUG__
     34                  const char * prev_name;
     35                  void* prev_thrd;
     36            #endif
    3337      };
    3438
     
    8387            struct __thread_queue_t entry_queue;      // queue of threads that are blocked waiting for the monitor
    8488            struct __condition_stack_t signal_stack;  // stack of conditions to run next once we exit the monitor
    85             struct monitor_desc * stack_owner;        // if bulk acquiring was used we need to synchronize signals with an other monitor
    8689            unsigned int recursion;                   // monitor routines can be called recursively, we need to keep track of that
    8790      };
     
    99102#ifndef _INVOKE_PRIVATE_H_
    100103#define _INVOKE_PRIVATE_H_
    101      
     104
    102105      struct machine_context_t {
    103106            void *SP;
     
    109112      extern void CtxInvokeStub( void );
    110113      void CtxSwitch( void * from, void * to ) asm ("CtxSwitch");
    111       void CtxGet( void * this ) asm ("CtxGet");
     114
     115      #if   defined( __x86_64__ )
     116      #define CtxGet( ctx ) __asm__ ( \
     117                  "movq %%rsp,%0\n"   \
     118                  "movq %%rbp,%1\n"   \
     119            : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     120      #elif defined( __i386__ )
     121      #define CtxGet( ctx ) __asm__ ( \
     122                  "movl %%esp,%0\n"   \
     123                  "movl %%ebp,%1\n"   \
     124            : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     125      #endif
    112126
    113127#endif //_INVOKE_PRIVATE_H_
  • src/libcfa/concurrency/kernel

    rfea3faa rb826e6b  
    2828//-----------------------------------------------------------------------------
    2929// Locks
    30 bool try_lock( spinlock * );
    31 void lock( spinlock * );
    32 void unlock( spinlock * );
     30void lock      ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, spin if already acquired
     31void lock_yield( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, yield repeatedly if already acquired
     32bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, return false if already acquired
     33void unlock    ( spinlock * );                        // Unlock the spinlock
    3334
    34 struct signal_once {
    35         volatile bool cond;
    36         struct spinlock lock;
    37         struct __thread_queue_t blocked;
     35struct semaphore {
     36        spinlock lock;
     37        int count;
     38        __thread_queue_t waiting;
    3839};
    3940
    40 void ?{}(signal_once * this);
    41 void ^?{}(signal_once * this);
     41void  ?{}(semaphore * this, int count = 1);
     42void ^?{}(semaphore * this);
     43void P(semaphore * this);
     44void V(semaphore * this);
    4245
    43 void wait( signal_once * );
    44 void signal( signal_once * );
    4546
    4647//-----------------------------------------------------------------------------
    4748// Cluster
    4849struct cluster {
    49         __thread_queue_t ready_queue;
    50         spinlock lock;
     50        spinlock ready_queue_lock;                      // Ready queue locks
     51        __thread_queue_t ready_queue;                   // Ready queue for threads
     52        unsigned long long int preemption;              // Preemption rate on this cluster
    5153};
    5254
     
    6870        unsigned short thrd_count;
    6971};
    70 static inline void ?{}(FinishAction * this) { 
     72static inline void ?{}(FinishAction * this) {
    7173        this->action_code = No_Action;
    7274        this->thrd = NULL;
     
    7577static inline void ^?{}(FinishAction * this) {}
    7678
     79// Processor
     80// Wrapper around kernel threads
    7781struct processor {
    78         struct processorCtx_t * runner;
    79         cluster * cltr;
    80         coroutine_desc * current_coroutine;
    81         thread_desc * current_thread;
    82         pthread_t kernel_thread;
    83        
    84         signal_once terminated;
    85         volatile bool is_terminated;
     82        // Main state
     83        struct processorCtx_t * runner;                 // Coroutine ctx who does keeps the state of the processor
     84        cluster * cltr;                                 // Cluster from which to get threads
     85        pthread_t kernel_thread;                        // Handle to pthreads
    8686
    87         struct FinishAction finish;
     87        // Termination
     88        volatile bool do_terminate;                     // Set to true to notify the processor should terminate
     89        semaphore terminated;                           // Termination synchronisation
    8890
    89         struct alarm_node_t * preemption_alarm;
    90         unsigned int preemption;
     91        // RunThread data
     92        struct FinishAction finish;                     // Action to do after a thread is ran
    9193
    92         unsigned short disable_preempt_count;
     94        // Preemption data
     95        struct alarm_node_t * preemption_alarm;         // Node which is added in the discrete event simulaiton
     96        bool pending_preemption;                        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
    9397
    94         bool pending_preemption;
     98#ifdef __CFA_DEBUG__
     99        char * last_enable;                             // Last function to enable preemption on this processor
     100#endif
    95101};
    96102
  • src/libcfa/concurrency/kernel.c

    rfea3faa rb826e6b  
    1515//
    1616
    17 #include "startup.h"
    18 
    19 //Start and stop routine for the kernel, declared first to make sure they run first
    20 void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
    21 void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
    22 
    23 //Header
    24 #include "kernel_private.h"
     17#include "libhdr.h"
    2518
    2619//C Includes
     
    3528
    3629//CFA Includes
    37 #include "libhdr.h"
     30#include "kernel_private.h"
    3831#include "preemption.h"
     32#include "startup.h"
    3933
    4034//Private includes
     
    4236#include "invoke.h"
    4337
     38//Start and stop routine for the kernel, declared first to make sure they run first
     39void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
     40void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
     41
    4442//-----------------------------------------------------------------------------
    4543// Kernel storage
    46 #define KERNEL_STORAGE(T,X) static char X##_storage[sizeof(T)]
    47 
    48 KERNEL_STORAGE(processorCtx_t, systemProcessorCtx);
    49 KERNEL_STORAGE(cluster, systemCluster);
    50 KERNEL_STORAGE(system_proc_t, systemProcessor);
    51 KERNEL_STORAGE(thread_desc, mainThread);
    52 KERNEL_STORAGE(machine_context_t, mainThread_context);
    53 
    54 cluster * systemCluster;
    55 system_proc_t * systemProcessor;
     44KERNEL_STORAGE(cluster,           mainCluster);
     45KERNEL_STORAGE(processor,         mainProcessor);
     46KERNEL_STORAGE(processorCtx_t,    mainProcessorCtx);
     47KERNEL_STORAGE(thread_desc,       mainThread);
     48KERNEL_STORAGE(machine_context_t, mainThreadCtx);
     49
     50cluster *     mainCluster;
     51processor *   mainProcessor;
    5652thread_desc * mainThread;
    5753
     
    5955// Global state
    6056
    61 thread_local processor * this_processor;
    62 
    63 coroutine_desc * this_coroutine(void) {
    64         return this_processor->current_coroutine;
    65 }
    66 
    67 thread_desc * this_thread(void) {
    68         return this_processor->current_thread;
    69 }
     57volatile thread_local coroutine_desc * this_coroutine;
     58volatile thread_local thread_desc * this_thread;
     59volatile thread_local processor * this_processor;
     60
     61volatile thread_local bool preemption_in_progress = 0;
     62volatile thread_local unsigned short disable_preempt_count = 1;
    7063
    7164//-----------------------------------------------------------------------------
    7265// Main thread construction
    7366struct current_stack_info_t {
    74         machine_context_t ctx; 
     67        machine_context_t ctx;
    7568        unsigned int size;              // size of stack
    7669        void *base;                             // base of stack
     
    8275
    8376void ?{}( current_stack_info_t * this ) {
    84         CtxGet( &this->ctx );
     77        CtxGet( this->ctx );
    8578        this->base = this->ctx.FP;
    8679        this->storage = this->ctx.SP;
     
    9184
    9285        this->limit = (void *)(((intptr_t)this->base) - this->size);
    93         this->context = &mainThread_context_storage;
     86        this->context = &storage_mainThreadCtx;
    9487        this->top = this->base;
    9588}
     
    10699
    107100void ?{}( coroutine_desc * this, current_stack_info_t * info) {
    108         (&this->stack){ info }; 
     101        (&this->stack){ info };
    109102        this->name = "Main Thread";
    110103        this->errno_ = 0;
     
    131124
    132125void ?{}(processor * this) {
    133         this{ systemCluster };
     126        this{ mainCluster };
    134127}
    135128
    136129void ?{}(processor * this, cluster * cltr) {
    137130        this->cltr = cltr;
    138         this->current_coroutine = NULL;
    139         this->current_thread = NULL;
    140         (&this->terminated){};
    141         this->is_terminated = false;
     131        (&this->terminated){ 0 };
     132        this->do_terminate = false;
    142133        this->preemption_alarm = NULL;
    143         this->preemption = default_preemption();
    144         this->disable_preempt_count = 1;                //Start with interrupts disabled
    145134        this->pending_preemption = false;
    146135
     
    150139void ?{}(processor * this, cluster * cltr, processorCtx_t * runner) {
    151140        this->cltr = cltr;
    152         this->current_coroutine = NULL;
    153         this->current_thread = NULL;
    154         (&this->terminated){};
    155         this->is_terminated = false;
    156         this->disable_preempt_count = 0;
     141        (&this->terminated){ 0 };
     142        this->do_terminate = false;
     143        this->preemption_alarm = NULL;
    157144        this->pending_preemption = false;
     145        this->kernel_thread = pthread_self();
    158146
    159147        this->runner = runner;
    160         LIB_DEBUG_PRINT_SAFE("Kernel : constructing processor context %p\n", runner);
     148        LIB_DEBUG_PRINT_SAFE("Kernel : constructing main processor context %p\n", runner);
    161149        runner{ this };
    162150}
    163151
    164 void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) {
    165         (&this->alarms){};
    166         (&this->alarm_lock){};
    167         this->pending_alarm = false;
    168 
    169         (&this->proc){ cltr, runner };
    170 }
    171 
    172152void ^?{}(processor * this) {
    173         if( ! this->is_terminated ) {
     153        if( ! this->do_terminate ) {
    174154                LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this);
    175                 this->is_terminated = true;
    176                 wait( &this->terminated );
     155                this->do_terminate = true;
     156                P( &this->terminated );
     157                pthread_join( this->kernel_thread, NULL );
    177158        }
    178159}
     
    180161void ?{}(cluster * this) {
    181162        ( &this->ready_queue ){};
    182         ( &this->lock ){};
     163        ( &this->ready_queue_lock ){};
     164
     165        this->preemption = default_preemption();
    183166}
    184167
    185168void ^?{}(cluster * this) {
    186        
     169
    187170}
    188171
     
    203186
    204187                thread_desc * readyThread = NULL;
    205                 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )
     188                for( unsigned int spin_count = 0; ! this->do_terminate; spin_count++ )
    206189                {
    207190                        readyThread = nextThread( this->cltr );
     
    209192                        if(readyThread)
    210193                        {
     194                                verify( disable_preempt_count > 0 );
     195
    211196                                runThread(this, readyThread);
     197
     198                                verify( disable_preempt_count > 0 );
    212199
    213200                                //Some actions need to be taken from the kernel
     
    225212        }
    226213
    227         signal( &this->terminated );
     214        V( &this->terminated );
     215
    228216        LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this);
    229217}
    230218
    231 // runThread runs a thread by context switching 
    232 // from the processor coroutine to the target thread 
     219// runThread runs a thread by context switching
     220// from the processor coroutine to the target thread
    233221void runThread(processor * this, thread_desc * dst) {
    234222        coroutine_desc * proc_cor = get_coroutine(this->runner);
    235223        coroutine_desc * thrd_cor = get_coroutine(dst);
    236        
     224
    237225        //Reset the terminating actions here
    238226        this->finish.action_code = No_Action;
    239227
    240228        //Update global state
    241         this->current_thread = dst;
     229        this_thread = dst;
    242230
    243231        // Context Switch to the thread
     
    246234}
    247235
    248 // Once a thread has finished running, some of 
     236// Once a thread has finished running, some of
    249237// its final actions must be executed from the kernel
    250238void finishRunning(processor * this) {
     
    256244        }
    257245        else if( this->finish.action_code == Release_Schedule ) {
    258                 unlock( this->finish.lock );           
     246                unlock( this->finish.lock );
    259247                ScheduleThread( this->finish.thrd );
    260248        }
     
    289277        processor * proc = (processor *) arg;
    290278        this_processor = proc;
     279        this_coroutine = NULL;
     280        this_thread = NULL;
     281        disable_preempt_count = 1;
    291282        // SKULLDUGGERY: We want to create a context for the processor coroutine
    292283        // which is needed for the 2-step context switch. However, there is no reason
    293         // to waste the perfectly valid stack create by pthread. 
     284        // to waste the perfectly valid stack create by pthread.
    294285        current_stack_info_t info;
    295286        machine_context_t ctx;
     
    300291
    301292        //Set global state
    302         proc->current_coroutine = &proc->runner->__cor;
    303         proc->current_thread = NULL;
     293        this_coroutine = &proc->runner->__cor;
     294        this_thread = NULL;
    304295
    305296        //We now have a proper context from which to schedule threads
    306297        LIB_DEBUG_PRINT_SAFE("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
    307298
    308         // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't 
    309         // resume it to start it like it normally would, it will just context switch 
    310         // back to here. Instead directly call the main since we already are on the 
     299        // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't
     300        // resume it to start it like it normally would, it will just context switch
     301        // back to here. Instead directly call the main since we already are on the
    311302        // appropriate stack.
    312303        proc_cor_storage.__cor.state = Active;
     
    315306
    316307        // Main routine of the core returned, the core is now fully terminated
    317         LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner); 
     308        LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner);
    318309
    319310        return NULL;
     
    322313void start(processor * this) {
    323314        LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this);
    324        
     315
    325316        pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this );
    326317
    327         LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);       
     318        LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);
    328319}
    329320
     
    331322// Scheduler routines
    332323void ScheduleThread( thread_desc * thrd ) {
    333         if( !thrd ) return;
     324        // if( !thrd ) return;
     325        assert( thrd );
     326        assert( thrd->cor.state != Halted );
     327
     328        verify( disable_preempt_count > 0 );
    334329
    335330        verifyf( thrd->next == NULL, "Expected null got %p", thrd->next );
    336        
    337         lock( &systemProcessor->proc.cltr->lock );
    338         append( &systemProcessor->proc.cltr->ready_queue, thrd );
    339         unlock( &systemProcessor->proc.cltr->lock );
     331
     332        lock(   &this_processor->cltr->ready_queue_lock DEBUG_CTX2 );
     333        append( &this_processor->cltr->ready_queue, thrd );
     334        unlock( &this_processor->cltr->ready_queue_lock );
     335
     336        verify( disable_preempt_count > 0 );
    340337}
    341338
    342339thread_desc * nextThread(cluster * this) {
    343         lock( &this->lock );
     340        verify( disable_preempt_count > 0 );
     341        lock( &this->ready_queue_lock DEBUG_CTX2 );
    344342        thread_desc * head = pop_head( &this->ready_queue );
    345         unlock( &this->lock );
     343        unlock( &this->ready_queue_lock );
     344        verify( disable_preempt_count > 0 );
    346345        return head;
    347346}
    348347
    349 void ScheduleInternal() {
    350         suspend();
    351 }
    352 
    353 void ScheduleInternal( spinlock * lock ) {
     348void BlockInternal() {
     349        disable_interrupts();
     350        verify( disable_preempt_count > 0 );
     351        suspend();
     352        verify( disable_preempt_count > 0 );
     353        enable_interrupts( DEBUG_CTX );
     354}
     355
     356void BlockInternal( spinlock * lock ) {
     357        disable_interrupts();
    354358        this_processor->finish.action_code = Release;
    355359        this_processor->finish.lock = lock;
    356         suspend();
    357 }
    358 
    359 void ScheduleInternal( thread_desc * thrd ) {
     360
     361        verify( disable_preempt_count > 0 );
     362        suspend();
     363        verify( disable_preempt_count > 0 );
     364
     365        enable_interrupts( DEBUG_CTX );
     366}
     367
     368void BlockInternal( thread_desc * thrd ) {
     369        disable_interrupts();
     370        assert( thrd->cor.state != Halted );
    360371        this_processor->finish.action_code = Schedule;
    361372        this_processor->finish.thrd = thrd;
    362         suspend();
    363 }
    364 
    365 void ScheduleInternal( spinlock * lock, thread_desc * thrd ) {
     373
     374        verify( disable_preempt_count > 0 );
     375        suspend();
     376        verify( disable_preempt_count > 0 );
     377
     378        enable_interrupts( DEBUG_CTX );
     379}
     380
     381void BlockInternal( spinlock * lock, thread_desc * thrd ) {
     382        disable_interrupts();
    366383        this_processor->finish.action_code = Release_Schedule;
    367384        this_processor->finish.lock = lock;
    368385        this_processor->finish.thrd = thrd;
    369         suspend();
    370 }
    371 
    372 void ScheduleInternal(spinlock ** locks, unsigned short count) {
     386
     387        verify( disable_preempt_count > 0 );
     388        suspend();
     389        verify( disable_preempt_count > 0 );
     390
     391        enable_interrupts( DEBUG_CTX );
     392}
     393
     394void BlockInternal(spinlock ** locks, unsigned short count) {
     395        disable_interrupts();
    373396        this_processor->finish.action_code = Release_Multi;
    374397        this_processor->finish.locks = locks;
    375398        this_processor->finish.lock_count = count;
    376         suspend();
    377 }
    378 
    379 void ScheduleInternal(spinlock ** locks, unsigned short lock_count, thread_desc ** thrds, unsigned short thrd_count) {
     399
     400        verify( disable_preempt_count > 0 );
     401        suspend();
     402        verify( disable_preempt_count > 0 );
     403
     404        enable_interrupts( DEBUG_CTX );
     405}
     406
     407void BlockInternal(spinlock ** locks, unsigned short lock_count, thread_desc ** thrds, unsigned short thrd_count) {
     408        disable_interrupts();
    380409        this_processor->finish.action_code = Release_Multi_Schedule;
    381410        this_processor->finish.locks = locks;
     
    383412        this_processor->finish.thrds = thrds;
    384413        this_processor->finish.thrd_count = thrd_count;
     414
     415        verify( disable_preempt_count > 0 );
     416        suspend();
     417        verify( disable_preempt_count > 0 );
     418
     419        enable_interrupts( DEBUG_CTX );
     420}
     421
     422void LeaveThread(spinlock * lock, thread_desc * thrd) {
     423        verify( disable_preempt_count > 0 );
     424        this_processor->finish.action_code = thrd ? Release_Schedule : Release;
     425        this_processor->finish.lock = lock;
     426        this_processor->finish.thrd = thrd;
     427
    385428        suspend();
    386429}
     
    392435// Kernel boot procedures
    393436void kernel_startup(void) {
    394         LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n");   
     437        LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n");
    395438
    396439        // Start by initializing the main thread
    397         // SKULLDUGGERY: the mainThread steals the process main thread 
    398         // which will then be scheduled by the systemProcessor normally
    399         mainThread = (thread_desc *)&mainThread_storage;
     440        // SKULLDUGGERY: the mainThread steals the process main thread
     441        // which will then be scheduled by the mainProcessor normally
     442        mainThread = (thread_desc *)&storage_mainThread;
    400443        current_stack_info_t info;
    401444        mainThread{ &info };
     
    403446        LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n");
    404447
     448        // Initialize the main cluster
     449        mainCluster = (cluster *)&storage_mainCluster;
     450        mainCluster{};
     451
     452        LIB_DEBUG_PRINT_SAFE("Kernel : main cluster ready\n");
     453
     454        // Initialize the main processor and the main processor ctx
     455        // (the coroutine that contains the processing control flow)
     456        mainProcessor = (processor *)&storage_mainProcessor;
     457        mainProcessor{ mainCluster, (processorCtx_t *)&storage_mainProcessorCtx };
     458
     459        //initialize the global state variables
     460        this_processor = mainProcessor;
     461        this_thread = mainThread;
     462        this_coroutine = &mainThread->cor;
     463
    405464        // Enable preemption
    406465        kernel_start_preemption();
    407466
    408         // Initialize the system cluster
    409         systemCluster = (cluster *)&systemCluster_storage;
    410         systemCluster{};
    411 
    412         LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n");
    413 
    414         // Initialize the system processor and the system processor ctx
    415         // (the coroutine that contains the processing control flow)
    416         systemProcessor = (system_proc_t *)&systemProcessor_storage;
    417         systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtx_storage };
    418 
    419         // Add the main thread to the ready queue
    420         // once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread
     467        // Add the main thread to the ready queue
     468        // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread
    421469        ScheduleThread(mainThread);
    422470
    423         //initialize the global state variables
    424         this_processor = &systemProcessor->proc;
    425         this_processor->current_thread = mainThread;
    426         this_processor->current_coroutine = &mainThread->cor;
    427 
    428         // SKULLDUGGERY: Force a context switch to the system processor to set the main thread's context to the current UNIX
     471        // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX
    429472        // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that
    430         // mainThread is on the ready queue when this call is made. 
    431         resume( systemProcessor->proc.runner );
     473        // mainThread is on the ready queue when this call is made.
     474        resume( mainProcessor->runner );
    432475
    433476
     
    435478        // THE SYSTEM IS NOW COMPLETELY RUNNING
    436479        LIB_DEBUG_PRINT_SAFE("Kernel : Started\n--------------------------------------------------\n\n");
     480
     481        enable_interrupts( DEBUG_CTX );
    437482}
    438483
     
    440485        LIB_DEBUG_PRINT_SAFE("\n--------------------------------------------------\nKernel : Shutting down\n");
    441486
    442         // SKULLDUGGERY: Notify the systemProcessor it needs to terminates.
     487        disable_interrupts();
     488
     489        // SKULLDUGGERY: Notify the mainProcessor it needs to terminates.
    443490        // When its coroutine terminates, it return control to the mainThread
    444491        // which is currently here
    445         systemProcessor->proc.is_terminated = true;
     492        mainProcessor->do_terminate = true;
    446493        suspend();
    447494
    448495        // THE SYSTEM IS NOW COMPLETELY STOPPED
    449496
    450         // Destroy the system processor and its context in reverse order of construction
     497        // Disable preemption
     498        kernel_stop_preemption();
     499
     500        // Destroy the main processor and its context in reverse order of construction
    451501        // These were manually constructed so we need manually destroy them
    452         ^(systemProcessor->proc.runner){};
    453         ^(systemProcessor){};
     502        ^(mainProcessor->runner){};
     503        ^(mainProcessor){};
    454504
    455505        // Final step, destroy the main thread since it is no longer needed
     
    457507        ^(mainThread){};
    458508
    459         LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n");   
     509        LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n");
    460510}
    461511
     
    467517        // abort cannot be recursively entered by the same or different processors because all signal handlers return when
    468518        // the globalAbort flag is true.
    469         lock( &kernel_abort_lock );
     519        lock( &kernel_abort_lock DEBUG_CTX2 );
    470520
    471521        // first task to abort ?
     
    473523                kernel_abort_called = true;
    474524                unlock( &kernel_abort_lock );
    475         } 
     525        }
    476526        else {
    477527                unlock( &kernel_abort_lock );
    478                
     528
    479529                sigset_t mask;
    480530                sigemptyset( &mask );
     
    482532                sigaddset( &mask, SIGUSR1 );                    // block SIGUSR1 signals
    483533                sigsuspend( &mask );                            // block the processor to prevent further damage during abort
    484                 _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it             
    485         }
    486 
    487         return this_thread();
     534                _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it
     535        }
     536
     537        return this_thread;
    488538}
    489539
     
    494544        __lib_debug_write( STDERR_FILENO, abort_text, len );
    495545
    496         if ( thrd != this_coroutine() ) {
    497                 len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine()->name, this_coroutine() );
     546        if ( thrd != this_coroutine ) {
     547                len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine->name, this_coroutine );
    498548                __lib_debug_write( STDERR_FILENO, abort_text, len );
    499         } 
     549        }
    500550        else {
    501551                __lib_debug_write( STDERR_FILENO, ".\n", 2 );
     
    505555extern "C" {
    506556        void __lib_debug_acquire() {
    507                 lock(&kernel_debug_lock);
     557                lock( &kernel_debug_lock DEBUG_CTX2 );
    508558        }
    509559
    510560        void __lib_debug_release() {
    511                 unlock(&kernel_debug_lock);
     561                unlock( &kernel_debug_lock );
    512562        }
    513563}
     
    525575}
    526576
    527 bool try_lock( spinlock * this ) {
     577bool try_lock( spinlock * this DEBUG_CTX_PARAM2 ) {
    528578        return this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0;
    529579}
    530580
    531 void lock( spinlock * this ) {
     581void lock( spinlock * this DEBUG_CTX_PARAM2 ) {
    532582        for ( unsigned int i = 1;; i += 1 ) {
    533                 if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) break;
    534         }
    535 }
     583                if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) { break; }
     584        }
     585        LIB_DEBUG_DO(
     586                this->prev_name = caller;
     587                this->prev_thrd = this_thread;
     588        )
     589}
     590
     591void lock_yield( spinlock * this DEBUG_CTX_PARAM2 ) {
     592        for ( unsigned int i = 1;; i += 1 ) {
     593                if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) { break; }
     594                yield();
     595        }
     596        LIB_DEBUG_DO(
     597                this->prev_name = caller;
     598                this->prev_thrd = this_thread;
     599        )
     600}
     601
    536602
    537603void unlock( spinlock * this ) {
     
    539605}
    540606
    541 void ?{}( signal_once * this ) {
    542         this->cond = false;
    543 }
    544 void ^?{}( signal_once * this ) {
    545 
    546 }
    547 
    548 void wait( signal_once * this ) {
    549         lock( &this->lock );
    550         if( !this->cond ) {
    551                 append( &this->blocked, this_thread() );
    552                 ScheduleInternal( &this->lock );
    553                 lock( &this->lock );
    554         }
     607void  ?{}( semaphore * this, int count = 1 ) {
     608        (&this->lock){};
     609        this->count = count;
     610        (&this->waiting){};
     611}
     612void ^?{}(semaphore * this) {}
     613
     614void P(semaphore * this) {
     615        lock( &this->lock DEBUG_CTX2 );
     616        this->count -= 1;
     617        if ( this->count < 0 ) {
     618                // queue current task
     619                append( &this->waiting, (thread_desc *)this_thread );
     620
     621                // atomically release spin lock and block
     622                BlockInternal( &this->lock );
     623        }
     624        else {
     625            unlock( &this->lock );
     626        }
     627}
     628
     629void V(semaphore * this) {
     630        thread_desc * thrd = NULL;
     631        lock( &this->lock DEBUG_CTX2 );
     632        this->count += 1;
     633        if ( this->count <= 0 ) {
     634                // remove task at head of waiting list
     635                thrd = pop_head( &this->waiting );
     636        }
     637
    555638        unlock( &this->lock );
    556 }
    557 
    558 void signal( signal_once * this ) {
    559         lock( &this->lock );
    560         {
    561                 this->cond = true;
    562 
    563                 thread_desc * it;
    564                 while( it = pop_head( &this->blocked) ) {
    565                         ScheduleThread( it );
    566                 }
    567         }
    568         unlock( &this->lock );
     639
     640        // make new owner
     641        WakeThread( thrd );
    569642}
    570643
     
    590663                }
    591664                head->next = NULL;
    592         }       
     665        }
    593666        return head;
    594667}
     
    609682                this->top = top->next;
    610683                top->next = NULL;
    611         }       
     684        }
    612685        return top;
    613686}
  • src/libcfa/concurrency/kernel_private.h

    rfea3faa rb826e6b  
    1818#define KERNEL_PRIVATE_H
    1919
     20#include "libhdr.h"
     21
    2022#include "kernel"
    2123#include "thread"
     
    2325#include "alarm.h"
    2426
    25 #include "libhdr.h"
    2627
    2728//-----------------------------------------------------------------------------
    2829// Scheduler
     30
     31extern "C" {
     32        void disable_interrupts();
     33        void enable_interrupts_noPoll();
     34        void enable_interrupts( DEBUG_CTX_PARAM );
     35}
     36
    2937void ScheduleThread( thread_desc * );
     38static inline void WakeThread( thread_desc * thrd ) {
     39        if( !thrd ) return;
     40
     41        disable_interrupts();
     42        ScheduleThread( thrd );
     43        enable_interrupts( DEBUG_CTX );
     44}
    3045thread_desc * nextThread(cluster * this);
    3146
    32 void ScheduleInternal(void);
    33 void ScheduleInternal(spinlock * lock);
    34 void ScheduleInternal(thread_desc * thrd);
    35 void ScheduleInternal(spinlock * lock, thread_desc * thrd);
    36 void ScheduleInternal(spinlock ** locks, unsigned short count);
    37 void ScheduleInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
     47//Block current thread and release/wake-up the following resources
     48void BlockInternal(void);
     49void BlockInternal(spinlock * lock);
     50void BlockInternal(thread_desc * thrd);
     51void BlockInternal(spinlock * lock, thread_desc * thrd);
     52void BlockInternal(spinlock ** locks, unsigned short count);
     53void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
     54void LeaveThread(spinlock * lock, thread_desc * thrd);
    3855
    3956//-----------------------------------------------------------------------------
     
    4966void spin(processor * this, unsigned int * spin_count);
    5067
    51 struct system_proc_t {
    52         processor proc;
    53 
     68struct event_kernel_t {
    5469        alarm_list_t alarms;
    55         spinlock alarm_lock;
    56 
    57         bool pending_alarm;
     70        spinlock lock;
    5871};
    5972
    60 extern cluster * systemCluster;
    61 extern system_proc_t * systemProcessor;
    62 extern thread_local processor * this_processor;
     73extern event_kernel_t * event_kernel;
    6374
    64 static inline void disable_interrupts() {
    65         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST );
    66         assert( prev != (unsigned short) -1 );
    67 }
    68 
    69 static inline void enable_interrupts_noRF() {
    70         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    71         verify( prev != (unsigned short) 0 );
    72 }
    73 
    74 static inline void enable_interrupts() {
    75         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    76         verify( prev != (unsigned short) 0 );
    77         if( prev == 1 && this_processor->pending_preemption ) {
    78                 ScheduleInternal( this_processor->current_thread );
    79                 this_processor->pending_preemption = false;
    80         }
    81 }
     75extern volatile thread_local processor * this_processor;
     76extern volatile thread_local coroutine_desc * this_coroutine;
     77extern volatile thread_local thread_desc * this_thread;
     78extern volatile thread_local bool preemption_in_progress;
     79extern volatile thread_local unsigned short disable_preempt_count;
    8280
    8381//-----------------------------------------------------------------------------
     
    9088extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
    9189
     90//-----------------------------------------------------------------------------
     91// Utils
     92#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
     93
    9294#endif //KERNEL_PRIVATE_H
    9395
  • src/libcfa/concurrency/monitor

    rfea3faa rb826e6b  
    2626static inline void ?{}(monitor_desc * this) {
    2727        this->owner = NULL;
    28         this->stack_owner = NULL;
    2928        this->recursion = 0;
    3029}
  • src/libcfa/concurrency/monitor.c

    rfea3faa rb826e6b  
    1919#include <stdlib>
    2020
     21#include "libhdr.h"
    2122#include "kernel_private.h"
    22 #include "libhdr.h"
    2323
    2424//-----------------------------------------------------------------------------
     
    4444
    4545extern "C" {
    46         void __enter_monitor_desc(monitor_desc * this) {
    47                 lock( &this->lock );
    48                 thread_desc * thrd = this_thread();
    49 
    50                 LIB_DEBUG_PRINT_SAFE("%p Entering %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion);
     46        void __enter_monitor_desc( monitor_desc * this ) {
     47                lock_yield( &this->lock DEBUG_CTX2 );
     48                thread_desc * thrd = this_thread;
     49
     50                // LIB_DEBUG_PRINT_SAFE("%p Entering %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion);
    5151
    5252                if( !this->owner ) {
     
    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);
    65                         ScheduleInternal( &this->lock );
    66 
    67                         //ScheduleInternal will unlock spinlock, no need to unlock ourselves
    68                         return; 
     64                        // LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd);
     65                        BlockInternal( &this->lock );
     66
     67                        //BlockInternal will unlock spinlock, no need to unlock ourselves
     68                        return;
    6969                }
    7070
     
    7575        // leave pseudo code :
    7676        //      TODO
    77         void __leave_monitor_desc(monitor_desc * this) {
    78                 lock( &this->lock );
    79 
    80                 LIB_DEBUG_PRINT_SAFE("%p Leaving %p (o: %p, r: %i)\n", thrd, this, 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 );
     77        void __leave_monitor_desc( monitor_desc * this ) {
     78                lock_yield( &this->lock DEBUG_CTX2 );
     79
     80                // LIB_DEBUG_PRINT_SAFE("%p Leaving %p (o: %p, r: %i). ", this_thread, this, 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 );
    8282
    8383                //Leaving a recursion level, decrement the counter
     
    9696                unlock( &this->lock );
    9797
    98                 LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
     98                // LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
    9999
    100100                //We need to wake-up the thread
    101                 ScheduleThread( new_owner );
     101                WakeThread( new_owner );
     102        }
     103
     104        void __leave_thread_monitor( thread_desc * thrd ) {
     105                monitor_desc * this = &thrd->mon;
     106                lock_yield( &this->lock DEBUG_CTX2 );
     107
     108                disable_interrupts();
     109
     110                thrd->cor.state = Halted;
     111
     112                verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i)", thrd, this->owner, this->recursion );
     113
     114                //Leaving a recursion level, decrement the counter
     115                this->recursion -= 1;
     116
     117                //If we haven't left the last level of recursion
     118                //it means we don't need to do anything
     119                if( this->recursion != 0) {
     120                        unlock( &this->lock );
     121                        return;
     122                }
     123
     124                thread_desc * new_owner = next_thread( this );
     125
     126                LeaveThread( &this->lock, new_owner );
    102127        }
    103128}
     
    121146        enter( this->m, this->count );
    122147
    123         this->prev_mntrs = this_thread()->current_monitors;
    124         this->prev_count = this_thread()->current_monitor_count;
    125 
    126         this_thread()->current_monitors      = m;
    127         this_thread()->current_monitor_count = count;
     148        this->prev_mntrs = this_thread->current_monitors;
     149        this->prev_count = this_thread->current_monitor_count;
     150
     151        this_thread->current_monitors      = m;
     152        this_thread->current_monitor_count = count;
    128153}
    129154
     
    131156        leave( this->m, this->count );
    132157
    133         this_thread()->current_monitors      = this->prev_mntrs;
    134         this_thread()->current_monitor_count = this->prev_count;
     158        this_thread->current_monitors      = this->prev_mntrs;
     159        this_thread->current_monitor_count = this->prev_count;
    135160}
    136161
     
    159184// Internal scheduling
    160185void wait( condition * this, uintptr_t user_info = 0 ) {
    161         LIB_DEBUG_PRINT_SAFE("Waiting\n");
     186        // LIB_DEBUG_PRINT_SAFE("Waiting\n");
    162187
    163188        brand_condition( this );
     
    170195        unsigned short count = this->monitor_count;
    171196        unsigned int recursions[ count ];               //Save the current recursion levels to restore them later
    172         spinlock *   locks     [ count ];               //We need to pass-in an array of locks to ScheduleInternal
    173 
    174         LIB_DEBUG_PRINT_SAFE("count %i\n", count);
    175 
    176         __condition_node_t waiter = { this_thread(), count, user_info };
     197        spinlock *   locks     [ count ];               //We need to pass-in an array of locks to BlockInternal
     198
     199        // LIB_DEBUG_PRINT_SAFE("count %i\n", count);
     200
     201        __condition_node_t waiter = { (thread_desc*)this_thread, count, user_info };
    177202
    178203        __condition_criterion_t criteria[count];
    179204        for(int i = 0; i < count; i++) {
    180205                (&criteria[i]){ this->monitors[i], &waiter };
    181                 LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
     206                // LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
    182207        }
    183208
     
    201226        }
    202227
    203         LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     228        // LIB_DEBUG_PRINT_SAFE("Will unblock: ");
    204229        for(int i = 0; i < thread_count; i++) {
    205                 LIB_DEBUG_PRINT_SAFE("%p ", threads[i]);
    206         }
    207         LIB_DEBUG_PRINT_SAFE("\n");
     230                // LIB_DEBUG_PRINT_SAFE("%p ", threads[i]);
     231        }
     232        // LIB_DEBUG_PRINT_SAFE("\n");
    208233
    209234        // Everything is ready to go to sleep
    210         ScheduleInternal( locks, count, threads, thread_count );
     235        BlockInternal( locks, count, threads, thread_count );
    211236
    212237
     
    222247bool signal( condition * this ) {
    223248        if( is_empty( this ) ) {
    224                 LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
     249                // LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
    225250                return false;
    226251        }
     
    231256
    232257        unsigned short count = this->monitor_count;
    233        
     258
    234259        //Some more checking in debug
    235260        LIB_DEBUG_DO(
    236                 thread_desc * this_thrd = this_thread();
     261                thread_desc * this_thrd = this_thread;
    237262                if ( this->monitor_count != this_thrd->current_monitor_count ) {
    238263                        abortf( "Signal on condition %p made with different number of monitor(s), expected %i got %i", this, this->monitor_count, this_thrd->current_monitor_count );
     
    248273        //Lock all the monitors
    249274        lock_all( this->monitors, NULL, count );
    250         LIB_DEBUG_PRINT_SAFE("Signalling");
     275        // LIB_DEBUG_PRINT_SAFE("Signalling");
    251276
    252277        //Pop the head of the waiting queue
     
    256281        for(int i = 0; i < count; i++) {
    257282                __condition_criterion_t * crit = &node->criteria[i];
    258                 LIB_DEBUG_PRINT_SAFE(" %p", crit->target);
     283                // LIB_DEBUG_PRINT_SAFE(" %p", crit->target);
    259284                assert( !crit->ready );
    260285                push( &crit->target->signal_stack, crit );
    261286        }
    262287
    263         LIB_DEBUG_PRINT_SAFE("\n");
     288        // LIB_DEBUG_PRINT_SAFE("\n");
    264289
    265290        //Release
     
    281306        unsigned short count = this->monitor_count;
    282307        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
     308        spinlock *   locks     [ count ];               //We need to pass-in an array of locks to BlockInternal
    284309
    285310        lock_all( this->monitors, locks, count );
    286311
    287312        //create creteria
    288         __condition_node_t waiter = { this_thread(), count, 0 };
     313        __condition_node_t waiter = { (thread_desc*)this_thread, count, 0 };
    289314
    290315        __condition_criterion_t criteria[count];
    291316        for(int i = 0; i < count; i++) {
    292317                (&criteria[i]){ this->monitors[i], &waiter };
    293                 LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
     318                // LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
    294319                push( &criteria[i].target->signal_stack, &criteria[i] );
    295320        }
     
    309334
    310335        //Everything is ready to go to sleep
    311         ScheduleInternal( locks, count, &signallee, 1 );
     336        BlockInternal( locks, count, &signallee, 1 );
    312337
    313338
     
    325350
    326351uintptr_t front( condition * this ) {
    327         verifyf( !is_empty(this), 
     352        verifyf( !is_empty(this),
    328353                "Attempt to access user data on an empty condition.\n"
    329354                "Possible cause is not checking if the condition is empty before reading stored data."
     
    335360// Internal scheduling
    336361void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ) {
    337         // thread_desc * this = this_thread();
     362        // thread_desc * this = this_thread;
    338363
    339364        // unsigned short count = this->current_monitor_count;
    340365        // 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
     366        // spinlock *   locks     [ count ];            //We need to pass-in an array of locks to BlockInternal
    342367
    343368        // lock_all( this->current_monitors, locks, count );
     
    348373
    349374        // // // Everything is ready to go to sleep
    350         // // ScheduleInternal( locks, count, threads, thread_count );
     375        // // BlockInternal( locks, count, threads, thread_count );
    351376
    352377
     
    393418static inline void lock_all( spinlock ** locks, unsigned short count ) {
    394419        for( int i = 0; i < count; i++ ) {
    395                 lock( locks[i] );
     420                lock_yield( locks[i] DEBUG_CTX2 );
    396421        }
    397422}
     
    400425        for( int i = 0; i < count; i++ ) {
    401426                spinlock * l = &source[i]->lock;
    402                 lock( l );
     427                lock_yield( l DEBUG_CTX2 );
    403428                if(locks) locks[i] = l;
    404429        }
     
    443468        for(    int i = 0; i < count; i++ ) {
    444469
    445                 LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
     470                // LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
    446471                if( &criteria[i] == target ) {
    447472                        criteria[i].ready = true;
    448                         LIB_DEBUG_PRINT_SAFE( "True\n" );
     473                        // LIB_DEBUG_PRINT_SAFE( "True\n" );
    449474                }
    450475
     
    452477        }
    453478
    454         LIB_DEBUG_PRINT_SAFE( "Runing %i\n", ready2run );
     479        // LIB_DEBUG_PRINT_SAFE( "Runing %i\n", ready2run );
    455480        return ready2run ? node->waiting_thread : NULL;
    456481}
    457482
    458483static inline void brand_condition( condition * this ) {
    459         thread_desc * thrd = this_thread();
     484        thread_desc * thrd = this_thread;
    460485        if( !this->monitors ) {
    461                 LIB_DEBUG_PRINT_SAFE("Branding\n");
     486                // LIB_DEBUG_PRINT_SAFE("Branding\n");
    462487                assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors );
    463488                this->monitor_count = thrd->current_monitor_count;
  • src/libcfa/concurrency/preemption.c

    rfea3faa rb826e6b  
    1515//
    1616
     17#include "libhdr.h"
    1718#include "preemption.h"
    1819
    1920extern "C" {
     21#include <errno.h>
     22#include <execinfo.h>
     23#define __USE_GNU
    2024#include <signal.h>
    21 }
    22 
    23 #define __CFA_DEFAULT_PREEMPTION__ 10
    24 
     25#undef __USE_GNU
     26#include <stdio.h>
     27#include <string.h>
     28#include <unistd.h>
     29}
     30
     31
     32#ifdef __USE_STREAM__
     33#include "fstream"
     34#endif
     35
     36//TODO move to defaults
     37#define __CFA_DEFAULT_PREEMPTION__ 10000
     38
     39//TODO move to defaults
    2540__attribute__((weak)) unsigned int default_preemption() {
    2641        return __CFA_DEFAULT_PREEMPTION__;
    2742}
    2843
     44// Short hands for signal context information
     45#define __CFA_SIGCXT__ ucontext_t *
     46#define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
     47
     48// FwdDeclarations : timeout handlers
    2949static void preempt( processor   * this );
    3050static void timeout( thread_desc * this );
    3151
     52// FwdDeclarations : Signal handlers
     53void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
     54void sigHandler_segv     ( __CFA_SIGPARMS__ );
     55void sigHandler_abort    ( __CFA_SIGPARMS__ );
     56
     57// FwdDeclarations : sigaction wrapper
     58static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags );
     59
     60// FwdDeclarations : alarm thread main
     61void * alarm_loop( __attribute__((unused)) void * args );
     62
     63// Machine specific register name
     64#ifdef __x86_64__
     65#define CFA_REG_IP REG_RIP
     66#else
     67#define CFA_REG_IP REG_EIP
     68#endif
     69
     70KERNEL_STORAGE(event_kernel_t, event_kernel);         // private storage for event kernel
     71event_kernel_t * event_kernel;                        // kernel public handle to even kernel
     72static pthread_t alarm_thread;                        // pthread handle to alarm thread
     73
     74void ?{}(event_kernel_t * this) {
     75        (&this->alarms){};
     76        (&this->lock){};
     77}
     78
    3279//=============================================================================================
    3380// Kernel Preemption logic
    3481//=============================================================================================
    3582
    36 void kernel_start_preemption() {
    37 
    38 }
    39 
     83// Get next expired node
     84static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_t currtime ) {
     85        if( !alarms->head ) return NULL;                          // If no alarms return null
     86        if( alarms->head->alarm >= currtime ) return NULL;        // If alarms head not expired return null
     87        return pop(alarms);                                       // Otherwise just pop head
     88}
     89
     90// Tick one frame of the Discrete Event Simulation for alarms
    4091void tick_preemption() {
    41         alarm_list_t * alarms = &systemProcessor->alarms;
    42         __cfa_time_t currtime = __kernel_get_time();
    43         while( alarms->head && alarms->head->alarm < currtime ) {
    44                 alarm_node_t * node = pop(alarms);
     92        alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
     93        alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
     94        __cfa_time_t currtime = __kernel_get_time();    // Check current time once so we everything "happens at once"
     95
     96        //Loop throught every thing expired
     97        while( node = get_expired( alarms, currtime ) ) {
     98
     99                // Check if this is a kernel
    45100                if( node->kernel_alarm ) {
    46101                        preempt( node->proc );
     
    50105                }
    51106
    52                 if( node->period > 0 ) {
    53                         node->alarm += node->period;
    54                         insert( alarms, node );
     107                // Check if this is a periodic alarm
     108                __cfa_time_t period = node->period;
     109                if( period > 0 ) {
     110                        node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
     111                        insert( alarms, node );             // Reinsert the node for the next time it triggers
    55112                }
    56113                else {
    57                         node->set = false;
    58                 }
    59         }
    60 
    61         if( alarms->head ) {
    62                 __kernel_set_timer( alarms->head->alarm - currtime );
    63         }
    64 }
    65 
     114                        node->set = false;                  // Node is one-shot, just mark it as not pending
     115                }
     116        }
     117
     118        // If there are still alarms pending, reset the timer
     119        if( alarms->head ) { __kernel_set_timer( alarms->head->alarm - currtime ); }
     120}
     121
     122// Update the preemption of a processor and notify interested parties
    66123void update_preemption( processor * this, __cfa_time_t duration ) {
    67         //     assert( THREAD_GETMEM( disableInt ) && THREAD_GETMEM( disableIntCnt ) == 1 );
    68124        alarm_node_t * alarm = this->preemption_alarm;
    69125
     
    89145}
    90146
     147//=============================================================================================
     148// Kernel Signal Tools
     149//=============================================================================================
     150
     151LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; )
     152
     153extern "C" {
     154        // Disable interrupts by incrementing the counter
     155        void disable_interrupts() {
     156                __attribute__((unused)) unsigned short new_val = __atomic_add_fetch_2( &disable_preempt_count, 1, __ATOMIC_SEQ_CST );
     157                verify( new_val < 65_000u );              // If this triggers someone is disabling interrupts without enabling them
     158        }
     159
     160        // Enable interrupts by decrementing the counter
     161        // If counter reaches 0, execute any pending CtxSwitch
     162        void enable_interrupts( DEBUG_CTX_PARAM ) {
     163                processor * proc   = this_processor;      // Cache the processor now since interrupts can start happening after the atomic add
     164                thread_desc * thrd = this_thread;         // Cache the thread now since interrupts can start happening after the atomic add
     165
     166                unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     167                verify( prev != 0u );                     // If this triggers someone is enabled already enabled interruptsverify( prev != 0u );
     168
     169                // Check if we need to prempt the thread because an interrupt was missed
     170                if( prev == 1 && proc->pending_preemption ) {
     171                        proc->pending_preemption = false;
     172                        BlockInternal( thrd );
     173                }
     174
     175                // For debugging purposes : keep track of the last person to enable the interrupts
     176                LIB_DEBUG_DO( proc->last_enable = caller; )
     177        }
     178
     179        // Disable interrupts by incrementint the counter
     180        // Don't execute any pending CtxSwitch even if counter reaches 0
     181        void enable_interrupts_noPoll() {
     182                __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     183                verify( prev != 0u );                     // If this triggers someone is enabled already enabled interrupts
     184        }
     185}
     186
     187// sigprocmask wrapper : unblock a single signal
     188static inline void signal_unblock( int sig ) {
     189        sigset_t mask;
     190        sigemptyset( &mask );
     191        sigaddset( &mask, sig );
     192
     193        if ( pthread_sigmask( SIG_UNBLOCK, &mask, NULL ) == -1 ) {
     194            abortf( "internal error, pthread_sigmask" );
     195        }
     196}
     197
     198// sigprocmask wrapper : block a single signal
     199static inline void signal_block( int sig ) {
     200        sigset_t mask;
     201        sigemptyset( &mask );
     202        sigaddset( &mask, sig );
     203
     204        if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
     205            abortf( "internal error, pthread_sigmask" );
     206        }
     207}
     208
     209// kill wrapper : signal a processor
     210static void preempt( processor * this ) {
     211        pthread_kill( this->kernel_thread, SIGUSR1 );
     212}
     213
     214// reserved for future use
     215static void timeout( thread_desc * this ) {
     216        //TODO : implement waking threads
     217}
     218
     219
     220// Check if a CtxSwitch signal handler shoud defer
     221// If true  : preemption is safe
     222// If false : preemption is unsafe and marked as pending
     223static inline bool preemption_ready() {
     224        bool ready = disable_preempt_count == 0 && !preemption_in_progress; // Check if preemption is safe
     225        this_processor->pending_preemption = !ready;                        // Adjust the pending flag accordingly
     226        return ready;
     227}
     228
     229//=============================================================================================
     230// Kernel Signal Startup/Shutdown logic
     231//=============================================================================================
     232
     233// Startup routine to activate preemption
     234// Called from kernel_startup
     235void kernel_start_preemption() {
     236        LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n");
     237
     238        // Start with preemption disabled until ready
     239        disable_preempt_count = 1;
     240
     241        // Initialize the event kernel
     242        event_kernel = (event_kernel_t *)&storage_event_kernel;
     243        event_kernel{};
     244
     245        // Setup proper signal handlers
     246        __kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO );         // CtxSwitch handler
     247        // __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );      // Failure handler
     248        // __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );      // Failure handler
     249
     250        signal_block( SIGALRM );
     251
     252        pthread_create( &alarm_thread, NULL, alarm_loop, NULL );
     253}
     254
     255// Shutdown routine to deactivate preemption
     256// Called from kernel_shutdown
     257void kernel_stop_preemption() {
     258        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n");
     259
     260        // Block all signals since we are already shutting down
     261        sigset_t mask;
     262        sigfillset( &mask );
     263        sigprocmask( SIG_BLOCK, &mask, NULL );
     264
     265        // Notify the alarm thread of the shutdown
     266        sigval val = { 1 };
     267        pthread_sigqueue( alarm_thread, SIGALRM, val );
     268
     269        // Wait for the preemption thread to finish
     270        pthread_join( alarm_thread, NULL );
     271
     272        // Preemption is now fully stopped
     273
     274        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n");
     275}
     276
     277// Raii ctor/dtor for the preemption_scope
     278// Used by thread to control when they want to receive preemption signals
    91279void ?{}( preemption_scope * this, processor * proc ) {
    92         (&this->alarm){ proc };
     280        (&this->alarm){ proc, zero_time, zero_time };
    93281        this->proc = proc;
    94282        this->proc->preemption_alarm = &this->alarm;
    95         update_preemption( this->proc, this->proc->preemption );
     283
     284        update_preemption( this->proc, from_us(this->proc->cltr->preemption) );
    96285}
    97286
    98287void ^?{}( preemption_scope * this ) {
    99         update_preemption( this->proc, 0 );
    100 }
    101 
    102 //=============================================================================================
    103 // Kernel Signal logic
    104 //=============================================================================================
    105 
    106 static inline bool preemption_ready() {
    107         return this_processor->disable_preempt_count == 0;
    108 }
    109 
    110 static inline void defer_ctxSwitch() {
    111         this_processor->pending_preemption = true;
    112 }
    113 
    114 static inline void defer_alarm() {
    115         systemProcessor->pending_alarm = true;
    116 }
    117 
    118 void sigHandler_ctxSwitch( __attribute__((unused)) int sig ) {
    119         if( preemption_ready() ) {
    120                 ScheduleInternal( this_processor->current_thread );
    121         }
    122         else {
    123                 defer_ctxSwitch();
    124         }
    125 }
    126 
    127 void sigHandler_alarm( __attribute__((unused)) int sig ) {
    128         if( try_lock( &systemProcessor->alarm_lock ) ) {
    129                 tick_preemption();
    130                 unlock( &systemProcessor->alarm_lock );
    131         }
    132         else {
    133                 defer_alarm();
    134         }
    135 }
    136 
    137 static void preempt( processor * this ) {
    138         pthread_kill( this->kernel_thread, SIGUSR1 );
    139 }
    140 
    141 static void timeout( thread_desc * this ) {
    142         //TODO : implement waking threads
    143 }
     288        disable_interrupts();
     289
     290        update_preemption( this->proc, zero_time );
     291}
     292
     293//=============================================================================================
     294// Kernel Signal Handlers
     295//=============================================================================================
     296
     297// Context switch signal handler
     298// Receives SIGUSR1 signal and causes the current thread to yield
     299void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
     300        LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
     301
     302        // Check if it is safe to preempt here
     303        if( !preemption_ready() ) { return; }
     304
     305        preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
     306        signal_unblock( SIGUSR1 );                          // We are about to CtxSwitch out of the signal handler, let other handlers in
     307        preemption_in_progress = false;                     // Clear the in progress flag
     308
     309        // Preemption can occur here
     310
     311        BlockInternal( (thread_desc*)this_thread );         // Do the actual CtxSwitch
     312}
     313
     314// Main of the alarm thread
     315// Waits on SIGALRM and send SIGUSR1 to whom ever needs it
     316void * alarm_loop( __attribute__((unused)) void * args ) {
     317        // Block sigalrms to control when they arrive
     318        sigset_t mask;
     319        sigemptyset( &mask );
     320        sigaddset( &mask, SIGALRM );
     321
     322        if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
     323            abortf( "internal error, pthread_sigmask" );
     324        }
     325
     326        // Main loop
     327        while( true ) {
     328                // Wait for a sigalrm
     329                siginfo_t info;
     330                int sig = sigwaitinfo( &mask, &info );
     331
     332                // If another signal arrived something went wrong
     333                assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
     334
     335                LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
     336                // Switch on the code (a.k.a. the sender) to
     337                switch( info.si_code )
     338                {
     339                // Timers can apparently be marked as sent for the kernel
     340                // In either case, tick preemption
     341                case SI_TIMER:
     342                case SI_KERNEL:
     343                        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
     344                        lock( &event_kernel->lock DEBUG_CTX2 );
     345                        tick_preemption();
     346                        unlock( &event_kernel->lock );
     347                        break;
     348                // Signal was not sent by the kernel but by an other thread
     349                case SI_QUEUE:
     350                        // For now, other thread only signal the alarm thread to shut it down
     351                        // If this needs to change use info.si_value and handle the case here
     352                        goto EXIT;
     353                }
     354        }
     355
     356EXIT:
     357        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n");
     358        return NULL;
     359}
     360
     361// Sigaction wrapper : register an signal handler
     362static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
     363        struct sigaction act;
     364
     365        act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
     366        act.sa_flags = flags;
     367
     368        if ( sigaction( sig, &act, NULL ) == -1 ) {
     369                LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
     370                        " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
     371                        sig, handler, flags, errno, strerror( errno )
     372                );
     373                _exit( EXIT_FAILURE );
     374        }
     375}
     376
     377// Sigaction wrapper : restore default handler
     378static void __kernel_sigdefault( int sig ) {
     379        struct sigaction act;
     380
     381        act.sa_handler = SIG_DFL;
     382        act.sa_flags = 0;
     383        sigemptyset( &act.sa_mask );
     384
     385        if ( sigaction( sig, &act, NULL ) == -1 ) {
     386                LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
     387                        " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
     388                        sig, errno, strerror( errno )
     389                );
     390                _exit( EXIT_FAILURE );
     391        }
     392}
     393
     394//=============================================================================================
     395// Terminating Signals logic
     396//=============================================================================================
     397
     398LIB_DEBUG_DO(
     399        static void __kernel_backtrace( int start ) {
     400                // skip first N stack frames
     401
     402                enum { Frames = 50 };
     403                void * array[Frames];
     404                int size = backtrace( array, Frames );
     405                char ** messages = backtrace_symbols( array, size );
     406
     407                // find executable name
     408                *index( messages[0], '(' ) = '\0';
     409                #ifdef __USE_STREAM__
     410                serr | "Stack back trace for:" | messages[0] | endl;
     411                #else
     412                fprintf( stderr, "Stack back trace for: %s\n", messages[0]);
     413                #endif
     414
     415                // skip last 2 stack frames after main
     416                for ( int i = start; i < size && messages != NULL; i += 1 ) {
     417                        char * name = NULL;
     418                        char * offset_begin = NULL;
     419                        char * offset_end = NULL;
     420
     421                        for ( char *p = messages[i]; *p; ++p ) {
     422                                // find parantheses and +offset
     423                                if ( *p == '(' ) {
     424                                        name = p;
     425                                }
     426                                else if ( *p == '+' ) {
     427                                        offset_begin = p;
     428                                }
     429                                else if ( *p == ')' ) {
     430                                        offset_end = p;
     431                                        break;
     432                                }
     433                        }
     434
     435                        // if line contains symbol print it
     436                        int frameNo = i - start;
     437                        if ( name && offset_begin && offset_end && name < offset_begin ) {
     438                                // delimit strings
     439                                *name++ = '\0';
     440                                *offset_begin++ = '\0';
     441                                *offset_end++ = '\0';
     442
     443                                #ifdef __USE_STREAM__
     444                                serr    | "("  | frameNo | ")" | messages[i] | ":"
     445                                        | name | "+" | offset_begin | offset_end | endl;
     446                                #else
     447                                fprintf( stderr, "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
     448                                #endif
     449                        }
     450                        // otherwise, print the whole line
     451                        else {
     452                                #ifdef __USE_STREAM__
     453                                serr | "(" | frameNo | ")" | messages[i] | endl;
     454                                #else
     455                                fprintf( stderr, "(%i) %s\n", frameNo, messages[i] );
     456                                #endif
     457                        }
     458                }
     459
     460                free( messages );
     461        }
     462)
     463
     464// void sigHandler_segv( __CFA_SIGPARMS__ ) {
     465//      LIB_DEBUG_DO(
     466//              #ifdef __USE_STREAM__
     467//              serr    | "*CFA runtime error* program cfa-cpp terminated with"
     468//                      | (sig == SIGSEGV ? "segment fault." : "bus error.")
     469//                      | endl;
     470//              #else
     471//              fprintf( stderr, "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
     472//              #endif
     473
     474//              // skip first 2 stack frames
     475//              __kernel_backtrace( 1 );
     476//      )
     477//      exit( EXIT_FAILURE );
     478// }
     479
     480// void sigHandler_abort( __CFA_SIGPARMS__ ) {
     481//      // skip first 6 stack frames
     482//      LIB_DEBUG_DO( __kernel_backtrace( 6 ); )
     483
     484//      // reset default signal handler
     485//      __kernel_sigdefault( SIGABRT );
     486
     487//      raise( SIGABRT );
     488// }
  • src/libcfa/concurrency/thread

    rfea3faa rb826e6b  
    5454}
    5555
    56 thread_desc * this_thread(void);
     56extern volatile thread_local thread_desc * this_thread;
    5757
    5858forall( dtype T | is_thread(T) )
  • src/libcfa/concurrency/thread.c

    rfea3faa rb826e6b  
    2828}
    2929
    30 extern thread_local processor * this_processor;
     30extern volatile thread_local processor * this_processor;
    3131
    3232//-----------------------------------------------------------------------------
     
    7171        coroutine_desc* thrd_c = get_coroutine(this);
    7272        thread_desc*  thrd_h = get_thread   (this);
    73         thrd_c->last = this_coroutine();
    74         this_processor->current_coroutine = thrd_c;
     73        thrd_c->last = this_coroutine;
    7574
    76         LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
     75        // LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
    7776
     77        disable_interrupts();
    7878        create_stack(&thrd_c->stack, thrd_c->stack.size);
     79        this_coroutine = thrd_c;
    7980        CtxStart(this, CtxInvokeThread);
     81        assert( thrd_c->last->stack.context );
    8082        CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
    8183
    8284        ScheduleThread(thrd_h);
     85        enable_interrupts( DEBUG_CTX );
    8386}
    8487
    8588void yield( void ) {
    86         ScheduleInternal( this_processor->current_thread );
     89        BlockInternal( (thread_desc *)this_thread );
    8790}
    8891
     
    9598void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    9699        // set state of current coroutine to inactive
    97         src->state = Inactive;
     100        src->state = src->state == Halted ? Halted : Inactive;
    98101        dst->state = Active;
    99102
     
    103106        // set new coroutine that the processor is executing
    104107        // and context switch to it
    105         this_processor->current_coroutine = dst;
     108        this_coroutine = dst;
     109        assert( src->stack.context );
    106110        CtxSwitch( src->stack.context, dst->stack.context );
    107         this_processor->current_coroutine = src;
     111        this_coroutine = src;
    108112
    109113        // set state of new coroutine to active
    110         dst->state = Inactive;
     114        dst->state = dst->state == Halted ? Halted : Inactive;
    111115        src->state = Active;
    112116}
  • src/libcfa/fstream

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 18:11:09 2017
    13 // Update Count     : 104
     12// Last Modified On : Fri Jul  7 08:32:38 2017
     13// Update Count     : 117
    1414//
    1515
    16 #ifndef __FSTREAM_H__
    17 #define __FSTREAM_H__
     16#pragma once
    1817
    1918#include "iostream"
    2019
    21 enum { separateSize = 16 };
     20enum { sepSize = 16 };
    2221struct ofstream {
    2322        void * file;
    2423        _Bool sepDefault;
    2524        _Bool sepOnOff;
     25        _Bool sawNL;
    2626        const char * sepCur;
    27         char separator[separateSize];
    28         char tupleSeparator[separateSize];
     27        char separator[sepSize];
     28        char tupleSeparator[sepSize];
    2929}; // ofstream
    3030
     
    3535const char * sepGetCur( ofstream * );
    3636void sepSetCur( ofstream *, const char * );
     37_Bool getNL( ofstream * );
     38void setNL( ofstream *, _Bool );
    3739
    3840// public
     
    7375extern ifstream * sin;
    7476
    75 #endif // __FSTREAM_H__
    76 
    7777// Local Variables: //
    7878// mode: c //
  • src/libcfa/fstream.c

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 18:11:11 2017
    13 // Update Count     : 234
     12// Last Modified On : Thu Jul  6 18:38:25 2017
     13// Update Count     : 251
    1414//
    1515
     
    3939
    4040// private
    41 _Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
     41_Bool sepPrt( ofstream * os ) { setNL( os, false ); return os->sepOnOff; }
    4242void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
    4343void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
    4444const char * sepGetCur( ofstream * os ) { return os->sepCur; }
    4545void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; }
     46_Bool getNL( ofstream * os ) { return os->sawNL; }
     47void setNL( ofstream * os, _Bool state ) { os->sawNL = state; }
    4648
    4749// public
    48 void sepOn( ofstream * os ) { os->sepOnOff = 1; }
    49 void sepOff( ofstream * os ) { os->sepOnOff = 0; }
     50void sepOn( ofstream * os ) { os->sepOnOff = ! getNL( os ); }
     51void sepOff( ofstream * os ) { os->sepOnOff = false; }
    5052
    5153_Bool sepDisable( ofstream *os ) {
     
    6668void sepSet( ofstream * os, const char * s ) {
    6769        assert( s );
    68         strncpy( os->separator, s, separateSize - 1 );
    69         os->separator[separateSize - 1] = '\0';
     70        strncpy( os->separator, s, sepSize - 1 );
     71        os->separator[sepSize - 1] = '\0';
    7072} // sepSet
    7173
     
    7375void sepSetTuple( ofstream * os, const char * s ) {
    7476        assert( s );
    75         strncpy( os->tupleSeparator, s, separateSize - 1 );
    76         os->tupleSeparator[separateSize - 1] = '\0';
     77        strncpy( os->tupleSeparator, s, sepSize - 1 );
     78        os->tupleSeparator[sepSize - 1] = '\0';
    7779} // sepSet
    7880
     
    9294                exit( EXIT_FAILURE );
    9395        } // if
    94         ?{}( os, file, 1, 0, " ", ", " );
     96        ?{}( os, file, true, false, " ", ", " );
    9597} // open
    9698
     
    132134} // fmt
    133135
    134 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };
     136static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };
    135137ofstream *sout = &soutFile;
    136 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " };
     138static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };
    137139ofstream *serr = &serrFile;
    138140
     
    150152
    151153void open( ifstream * is, const char * name, const char * mode ) {
    152         FILE *t = fopen( name, mode );
    153         if ( t == 0 ) {                                                                         // do not change unless successful
     154        FILE *file = fopen( name, mode );
     155        if ( file == 0 ) {                                                                      // do not change unless successful
    154156                fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
    155157                perror( 0 );
    156158                exit( EXIT_FAILURE );
    157159        } // if
    158         is->file = t;
     160        is->file = file;
    159161} // open
    160162
  • src/libcfa/gmp

    rfea3faa rb826e6b  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 27 09:55:51 2017
    13 // Update Count     : 14
     12// Last Modified On : Fri Jul  7 09:33:20 2017
     13// Update Count     : 15
    1414//
    1515
    1616// https://gmplib.org/gmp-man-6.1.1.pdf
     17
     18#pragma once
    1719
    1820#include <gmp.h>                                                                                // GNU multi-precise integers
  • src/libcfa/iostream

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 18:08:44 2017
    13 // Update Count     : 105
     12// Last Modified On : Fri Jul  7 08:35:59 2017
     13// Update Count     : 118
    1414//
    1515
    16 #ifndef __IOSTREAM_H__
    17 #define __IOSTREAM_H__
     16#pragma once
    1817
    1918#include "iterator"
     
    2625        const char * sepGetCur( ostype * );                                     // get current separator string
    2726        void sepSetCur( ostype *, const char * );                       // set current separator string
     27        _Bool getNL( ostype * );                                                        // check newline
     28        void setNL( ostype *, _Bool );                                          // saw newline
    2829        // public
    2930        void sepOn( ostype * );                                                         // turn separator state on
     
    4344        ostype * write( ostype *, const char *, unsigned long int );
    4445        int fmt( ostype *, const char fmt[], ... );
    45 };
     46}; // ostream
    4647
    4748trait writeable( otype T ) {
    4849        forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, T );
    49 };
     50}; // writeable
    5051
    5152// implement writable for intrinsic types
     
    8182forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) );
    8283forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * );
     84forall( dtype ostype | ostream( ostype ) ) ostype * sep( ostype * );
     85forall( dtype ostype | ostream( ostype ) ) ostype * sepTuple( ostype * );
    8386forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
    8487forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
     
    103106        istype * ungetc( istype *, char );
    104107        int fmt( istype *, const char fmt[], ... );
    105 };
     108}; // istream
    106109
    107110trait readable( otype T ) {
    108111        forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, T );
    109 };
     112}; // readable
    110113
    111114forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, char * );
     
    136139forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC );
    137140
    138 #endif // __IOSTREAM_H
    139 
    140141// Local Variables: //
    141142// mode: c //
  • src/libcfa/iostream.c

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May  8 18:24:23 2017
    13 // Update Count     : 369
     12// Last Modified On : Sun Jul 16 21:12:03 2017
     13// Update Count     : 398
    1414//
    1515
     
    1818extern "C" {
    1919#include <stdio.h>
     20#include <stdbool.h>                                                                    // true/false
    2021#include <string.h>                                                                             // strlen
    2122#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
     
    2425
    2526forall( dtype ostype | ostream( ostype ) )
    26 ostype * ?|?( ostype * os, char c ) {
    27         fmt( os, "%c", c );
     27ostype * ?|?( ostype * os, char ch ) {
     28        fmt( os, "%c", ch );
     29        if ( ch == '\n' ) setNL( os, true );
    2830        sepOff( os );
    2931        return os;
     
    123125forall( dtype ostype | ostream( ostype ) )
    124126ostype * ?|?( ostype * os, float _Complex fc ) {
    125         os | crealf( fc );
    126         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    127         if ( cimagf( fc ) >= 0 ) os | '+';                                      // negative value prints '-'
    128         os | cimagf( fc ) | 'i';
    129         sepReset( os, temp );                                                           // reset separator
     127        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     128        fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) );
    130129        return os;
    131130} // ?|?
     
    133132forall( dtype ostype | ostream( ostype ) )
    134133ostype * ?|?( ostype * os, double _Complex dc ) {
    135         os | creal( dc );
    136         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    137         if ( cimag( dc ) >= 0 ) os | '+';                                       // negative value prints '-'
    138         os | cimag( dc ) | 'i';
    139         sepReset( os, temp );                                                           // reset separator
     134        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     135        fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) );
    140136        return os;
    141137} // ?|?
     
    143139forall( dtype ostype | ostream( ostype ) )
    144140ostype * ?|?( ostype * os, long double _Complex ldc ) {
    145         os | creall( ldc );
    146         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    147         if ( cimagl( ldc ) >= 0 ) os | '+';                                     // negative value prints '-'
    148         os | cimagl( ldc ) | 'i';
    149         sepReset( os, temp );                                                           // reset separator
     141        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     142        fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    150143        return os;
    151144} // ?|?
     
    180173
    181174        // last character IS spacing or opening punctuation => turn off separator for next item
    182         unsigned int len = strlen( cp ), posn = len - 1;
    183         ch = cp[posn];                                                                          // must make unsigned
     175        size_t len = strlen( cp );
     176        ch = cp[len - 1];                                                                       // must make unsigned
    184177        if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
    185178                sepOn( os );
     
    187180                sepOff( os );
    188181        } // if
     182        if ( ch == '\n' ) setNL( os, true );                            // check *AFTER* sepPrt call above as it resets NL flag
    189183        return write( os, cp, len );
    190184} // ?|?
     
    201195forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    202196ostype * ?|?( ostype * os, T arg, Params rest ) {
     197        os | arg;                                                                                       // print first argument
    203198        sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    204         os | arg;                                                                                       // print first argument
    205199        os | rest;                                                                                      // print remaining arguments
    206200        sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
     
    216210
    217211forall( dtype ostype | ostream( ostype ) )
     212ostype * sep( ostype * os ) {
     213        os | sepGet( os );
     214        return os;
     215} // sep
     216
     217forall( dtype ostype | ostream( ostype ) )
     218ostype * sepTuple( ostype * os ) {
     219        os | sepGetTuple( os );
     220        return os;
     221} // sepTuple
     222
     223forall( dtype ostype | ostream( ostype ) )
    218224ostype * endl( ostype * os ) {
    219225        os | '\n';
     226        setNL( os, true );
    220227        flush( os );
    221228        sepOff( os );                                                                           // prepare for next line
  • src/libcfa/iterator

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 18:06:05 2016
    13 // Update Count     : 9
     12// Last Modified On : Fri Jul  7 08:37:25 2017
     13// Update Count     : 10
    1414//
    1515
    16 #ifndef ITERATOR_H
    17 #define ITERATOR_H
     16#pragma once
    1817
    1918// An iterator can be used to traverse a data structure.
     
    3938
    4039forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    41 void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
     40void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
    4241
    4342forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    44 void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
    45 
    46 #endif // ITERATOR_H
     43void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
    4744
    4845// Local Variables: //
  • src/libcfa/iterator.c

    rfea3faa rb826e6b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 18:08:11 2016
    13 // Update Count     : 27
     12// Last Modified On : Fri Jul  7 08:38:23 2017
     13// Update Count     : 28
    1414//
    1515
     
    1717
    1818forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    19 void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
     19void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {
    2020        for ( iterator_type i = begin; i != end; ++i ) {
    2121                func( *i );
    22         }
    23 }
     22        } // for
     23} // for_each
    2424
    2525forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    26 void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
     26void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {
    2727        for ( iterator_type i = end; i != begin; ) {
    2828                --i;
    2929                func( *i );
    30         }
    31 }
     30        } // for
     31} // for_each_reverse
    3232
    3333// Local Variables: //
  • src/libcfa/libhdr/libalign.h

    rfea3faa rb826e6b  
    1 //                              -*- Mode: C++ -*- 
     1//                              -*- Mode: C++ -*-
    22//
    33// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1818// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    1919// option) any later version.
    20 // 
     20//
    2121// This library is distributed in the  hope that it will be useful, but WITHOUT
    2222// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    2323// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    2424// for more details.
    25 // 
     25//
    2626// You should  have received a  copy of the  GNU Lesser General  Public License
    2727// along  with this library.
    28 // 
     28//
    2929
    3030
     
    3333
    3434#include "assert"
     35#include <stdbool.h>
    3536
    36 // Minimum size used to align memory boundaries for memory allocations. 
     37// Minimum size used to align memory boundaries for memory allocations.
    3738#define libAlign() (sizeof(double))
    3839
  • src/libcfa/libhdr/libdebug.h

    rfea3faa rb826e6b  
    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(...) __VA_ARGS__
     21        #define LIB_NO_DEBUG_DO(...)
     22        #define DEBUG_CTX __PRETTY_FUNCTION__
     23        #define DEBUG_CTX2 , __PRETTY_FUNCTION__
     24        #define DEBUG_CTX_PARAM const char * caller
     25        #define DEBUG_CTX_PARAM2 , const char * caller
    2226#else
    23         #define LIB_DEBUG_DO(x) ((void)0)
    24         #define LIB_NO_DEBUG_DO(x) x     
     27        #define LIB_DEBUG_DO(...)
     28        #define LIB_NO_DEBUG_DO(...) __VA_ARGS__
     29        #define DEBUG_CTX
     30        #define DEBUG_CTX2
     31        #define DEBUG_CTX_PARAM
     32        #define DEBUG_CTX_PARAM2
    2533#endif
    2634
     
    5159
    5260#ifdef __CFA_DEBUG_PRINT__
    53       #define LIB_DEBUG_WRITE( fd, buffer, len )  __lib_debug_write( fd, buffer, len )
    54       #define LIB_DEBUG_ACQUIRE()                 __lib_debug_acquire()
    55       #define LIB_DEBUG_RELEASE()                 __lib_debug_release()
    56       #define LIB_DEBUG_PRINT_SAFE(...)           __lib_debug_print_safe   (__VA_ARGS__)
    57       #define LIB_DEBUG_PRINT_NOLOCK(...)         __lib_debug_print_nolock (__VA_ARGS__)
    58       #define LIB_DEBUG_PRINT_BUFFER(...)         __lib_debug_print_buffer (__VA_ARGS__)
     61        #define LIB_DEBUG_WRITE( fd, buffer, len )     __lib_debug_write( fd, buffer, len )
     62        #define LIB_DEBUG_ACQUIRE()                    __lib_debug_acquire()
     63        #define LIB_DEBUG_RELEASE()                    __lib_debug_release()
     64        #define LIB_DEBUG_PRINT_SAFE(...)              __lib_debug_print_safe   (__VA_ARGS__)
     65        #define LIB_DEBUG_PRINT_NOLOCK(...)            __lib_debug_print_nolock (__VA_ARGS__)
     66        #define LIB_DEBUG_PRINT_BUFFER(...)            __lib_debug_print_buffer (__VA_ARGS__)
     67        #define LIB_DEBUG_PRINT_BUFFER_DECL(fd, ...)   char text[256]; int len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
     68        #define LIB_DEBUG_PRINT_BUFFER_LOCAL(fd, ...)  len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
    5969#else
    60       #define LIB_DEBUG_WRITE(...)          ((void)0)
    61       #define LIB_DEBUG_ACQUIRE()           ((void)0)
    62       #define LIB_DEBUG_RELEASE()           ((void)0)
    63       #define LIB_DEBUG_PRINT_SAFE(...)     ((void)0)
    64       #define LIB_DEBUG_PRINT_NOLOCK(...)   ((void)0)
    65       #define LIB_DEBUG_PRINT_BUFFER(...)   ((void)0)
     70        #define LIB_DEBUG_WRITE(...)               ((void)0)
     71        #define LIB_DEBUG_ACQUIRE()                ((void)0)
     72        #define LIB_DEBUG_RELEASE()                ((void)0)
     73        #define LIB_DEBUG_PRINT_SAFE(...)          ((void)0)
     74        #define LIB_DEBUG_PRINT_NOLOCK(...)        ((void)0)
     75        #define LIB_DEBUG_PRINT_BUFFER(...)        ((void)0)
     76        #define LIB_DEBUG_PRINT_BUFFER_DECL(...)   ((void)0)
     77        #define LIB_DEBUG_PRINT_BUFFER_LOCAL(...)  ((void)0)
    6678#endif
    6779
  • src/libcfa/limits

    rfea3faa rb826e6b  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr  6 21:08:16 2016
    13 // Update Count     : 6
     12// Last Modified On : Fri Jul  7 09:33:57 2017
     13// Update Count     : 7
    1414//
    1515
    16 #ifndef LIMITS_H
    17 #define LIMITS_H
     16#pragma once
    1817
    1918// Integral Constants
     
    110109extern const long _Complex _1_SQRT_2;                                   // 1 / sqrt(2)
    111110
    112 #endif // LIMITS_H
    113 
    114111// Local Variables: //
    115112// mode: c //
  • src/libcfa/math

    rfea3faa rb826e6b  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 24 17:40:39 2017
    13 // Update Count     : 60
    14 //
    15 
    16 #ifndef MATH_H
    17 #define MATH_H
     12// Last Modified On : Fri Jul  7 09:34:15 2017
     13// Update Count     : 61
     14//
     15
     16#pragma once
    1817
    1918extern "C" {
     
    345344long double scalbln( long double, long int );
    346345
    347 #endif // MATH_H
    348 
    349346// Local Variables: //
    350347// mode: c //
  • src/libcfa/rational

    rfea3faa rb826e6b  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Mon May 15 21:30:12 2017
    15 // Update Count     : 90
     14// Last Modified On : Fri Jul  7 09:34:33 2017
     15// Update Count     : 93
    1616//
    1717
    18 #ifndef RATIONAL_H
    19 #define RATIONAL_H
     18#pragma once
    2019
    2120#include "iostream"
     
    4746// implementation
    4847
    49 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     48forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5049struct Rational {
    5150        RationalImpl numerator, denominator;                            // invariant: denominator > 0
     
    5453// constructors
    5554
    56 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     55forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5756void ?{}( Rational(RationalImpl) * r );
    5857
    59 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     58forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6059void ?{}( Rational(RationalImpl) * r, RationalImpl n );
    6160
    62 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     61forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6362void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d );
    6463
    65 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     64forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6665void ?{}( Rational(RationalImpl) * r, zero_t );
    6766
    68 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     67forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6968void ?{}( Rational(RationalImpl) * r, one_t );
    7069
    71 // getter for numerator/denominator
     70// numerator/denominator getter
    7271
    73 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     72forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7473RationalImpl numerator( Rational(RationalImpl) r );
    7574
    76 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     75forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7776RationalImpl denominator( Rational(RationalImpl) r );
    78 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     77
     78forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7979[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
    8080
    81 // setter for numerator/denominator
     81// numerator/denominator setter
    8282
    83 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     83forall( otype RationalImpl | arithmetic( RationalImpl ) )
    8484RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
    8585
    86 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     86forall( otype RationalImpl | arithmetic( RationalImpl ) )
    8787RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
    8888
    8989// comparison
    9090
    91 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     91forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9292int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9393
    94 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     94forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9595int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9696
    97 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     97forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9898int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9999
    100 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     100forall( otype RationalImpl | arithmetic( RationalImpl ) )
    101101int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    102102
    103 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     103forall( otype RationalImpl | arithmetic( RationalImpl ) )
    104104int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    105105
    106 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     106forall( otype RationalImpl | arithmetic( RationalImpl ) )
    107107int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    108108
    109109// arithmetic
    110110
    111 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     111forall( otype RationalImpl | arithmetic( RationalImpl ) )
    112112Rational(RationalImpl) +?( Rational(RationalImpl) r );
    113113
    114 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     114forall( otype RationalImpl | arithmetic( RationalImpl ) )
    115115Rational(RationalImpl) -?( Rational(RationalImpl) r );
    116116
    117 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     117forall( otype RationalImpl | arithmetic( RationalImpl ) )
    118118Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    119119
    120 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     120forall( otype RationalImpl | arithmetic( RationalImpl ) )
    121121Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    122122
    123 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     123forall( otype RationalImpl | arithmetic( RationalImpl ) )
    124124Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    125125
    126 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     126forall( otype RationalImpl | arithmetic( RationalImpl ) )
    127127Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    128128
    129129// conversion
    130 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
     130forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
    131131double widen( Rational(RationalImpl) r );
    132 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
     132forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
    133133Rational(RationalImpl) narrow( double f, RationalImpl md );
    134134
    135135// I/O
    136 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     136forall( otype RationalImpl | arithmetic( RationalImpl ) )
    137137forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
    138138istype * ?|?( istype *, Rational(RationalImpl) * );
    139139
    140 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     140forall( otype RationalImpl | arithmetic( RationalImpl ) )
    141141forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
    142142ostype * ?|?( ostype *, Rational(RationalImpl ) );
    143 
    144 #endif // RATIONAL_H
    145143
    146144// Local Variables: //
  • src/libcfa/rational.c

    rfea3faa rb826e6b  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 21:29:23 2017
    13 // Update Count     : 149
     12// Last Modified On : Tue May 16 18:35:36 2017
     13// Update Count     : 150
    1414//
    1515
     
    2222// Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals.
    2323// alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm
    24 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     24forall( otype RationalImpl | arithmetic( RationalImpl ) )
    2525static RationalImpl gcd( RationalImpl a, RationalImpl b ) {
    2626        for ( ;; ) {                                                                            // Euclid's algorithm
     
    3333} // gcd
    3434
    35 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     35forall( otype RationalImpl | arithmetic( RationalImpl ) )
    3636static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) {
    3737        if ( *d == (RationalImpl){0} ) {
     
    4646// constructors
    4747
    48 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     48forall( otype RationalImpl | arithmetic( RationalImpl ) )
    4949void ?{}( Rational(RationalImpl) * r ) {
    5050        r{ (RationalImpl){0}, (RationalImpl){1} };
    5151} // rational
    5252
    53 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     53forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5454void ?{}( Rational(RationalImpl) * r, RationalImpl n ) {
    5555        r{ n, (RationalImpl){1} };
    5656} // rational
    5757
    58 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     58forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5959void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) {
    6060        RationalImpl t = simplify( &n, &d );                            // simplify
     
    6666// getter for numerator/denominator
    6767
    68 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     68forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6969RationalImpl numerator( Rational(RationalImpl) r ) {
    7070        return r.numerator;
    7171} // numerator
    7272
    73 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     73forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7474RationalImpl denominator( Rational(RationalImpl) r ) {
    7575        return r.denominator;
    7676} // denominator
    7777
    78 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     78forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7979[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) {
    8080        return *dest = src.[ numerator, denominator ];
     
    8383// setter for numerator/denominator
    8484
    85 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     85forall( otype RationalImpl | arithmetic( RationalImpl ) )
    8686RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) {
    8787        RationalImpl prev = r.numerator;
     
    9292} // numerator
    9393
    94 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     94forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9595RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) {
    9696        RationalImpl prev = r.denominator;
     
    104104// comparison
    105105
    106 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     106forall( otype RationalImpl | arithmetic( RationalImpl ) )
    107107int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    108108        return l.numerator * r.denominator == l.denominator * r.numerator;
    109109} // ?==?
    110110
    111 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     111forall( otype RationalImpl | arithmetic( RationalImpl ) )
    112112int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    113113        return ! ( l == r );
    114114} // ?!=?
    115115
    116 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     116forall( otype RationalImpl | arithmetic( RationalImpl ) )
    117117int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    118118        return l.numerator * r.denominator < l.denominator * r.numerator;
    119119} // ?<?
    120120
    121 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     121forall( otype RationalImpl | arithmetic( RationalImpl ) )
    122122int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    123123        return l.numerator * r.denominator <= l.denominator * r.numerator;
    124124} // ?<=?
    125125
    126 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     126forall( otype RationalImpl | arithmetic( RationalImpl ) )
    127127int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    128128        return ! ( l <= r );
    129129} // ?>?
    130130
    131 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     131forall( otype RationalImpl | arithmetic( RationalImpl ) )
    132132int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    133133        return ! ( l < r );
     
    137137// arithmetic
    138138
    139 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     139forall( otype RationalImpl | arithmetic( RationalImpl ) )
    140140Rational(RationalImpl) +?( Rational(RationalImpl) r ) {
    141141        Rational(RationalImpl) t = { r.numerator, r.denominator };
     
    143143} // +?
    144144
    145 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     145forall( otype RationalImpl | arithmetic( RationalImpl ) )
    146146Rational(RationalImpl) -?( Rational(RationalImpl) r ) {
    147147        Rational(RationalImpl) t = { -r.numerator, r.denominator };
     
    149149} // -?
    150150
    151 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     151forall( otype RationalImpl | arithmetic( RationalImpl ) )
    152152Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    153153        if ( l.denominator == r.denominator ) {                         // special case
     
    160160} // ?+?
    161161
    162 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     162forall( otype RationalImpl | arithmetic( RationalImpl ) )
    163163Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    164164        if ( l.denominator == r.denominator ) {                         // special case
     
    171171} // ?-?
    172172
    173 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     173forall( otype RationalImpl | arithmetic( RationalImpl ) )
    174174Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    175175        Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator };
     
    177177} // ?*?
    178178
    179 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     179forall( otype RationalImpl | arithmetic( RationalImpl ) )
    180180Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    181181        if ( r.numerator < (RationalImpl){0} ) {
     
    190190// conversion
    191191
    192 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
     192forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
    193193double widen( Rational(RationalImpl) r ) {
    194194        return convert( r.numerator ) / convert( r.denominator );
     
    196196
    197197// http://www.ics.uci.edu/~eppstein/numth/frap.c
    198 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double ); } )
     198forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double ); } )
    199199Rational(RationalImpl) narrow( double f, RationalImpl md ) {
    200200        if ( md <= (RationalImpl){1} ) {                                        // maximum fractional digits too small?
     
    227227// I/O
    228228
    229 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     229forall( otype RationalImpl | arithmetic( RationalImpl ) )
    230230forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
    231231istype * ?|?( istype * is, Rational(RationalImpl) * r ) {
     
    238238} // ?|?
    239239
    240 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     240forall( otype RationalImpl | arithmetic( RationalImpl ) )
    241241forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
    242242ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) {
  • src/libcfa/stdlib

    rfea3faa rb826e6b  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun  2 15:51:03 2017
    13 // Update Count     : 218
    14 //
    15 
    16 #ifndef STDLIB_H
    17 #define STDLIB_H
     12// Last Modified On : Fri Jul  7 09:34:49 2017
     13// Update Count     : 219
     14//
     15
     16#pragma once
    1817
    1918//---------------------------------------
     
    232231void swap( T * t1, T * t2 );
    233232
    234 #endif // STDLIB_H
    235 
    236233// Local Variables: //
    237234// mode: c //
  • src/main.cc

    rfea3faa rb826e6b  
    1111// Created On       : Fri May 15 23:12:02 2015
    1212// Last Modified By : Andrew Beach
    13 // Last Modified On : Wed May 10 14:45:00 2017
    14 // Update Count     : 437
     13// Last Modified On : Fri Jul  7 11:13:00 2017
     14// Update Count     : 442
    1515//
    1616
    17 #include <iostream>
    18 #include <fstream>
    19 #include <signal.h>                                                                             // signal
    20 #include <getopt.h>                                                                             // getopt
    21 #include <execinfo.h>                                                                   // backtrace, backtrace_symbols
    22 #include <cxxabi.h>                                                                             // __cxa_demangle
    23 #include <cstring>                                                                              // index
    24 
    25 using namespace std;
    26 
    27 #include "Parser/lex.h"
    28 #include "Parser/parser.h"
    29 #include "Parser/TypedefTable.h"
    30 #include "GenPoly/Lvalue.h"
    31 #include "GenPoly/Specialize.h"
    32 #include "GenPoly/Box.h"
    33 #include "GenPoly/CopyParams.h"
    34 #include "GenPoly/InstantiateGeneric.h"
    35 #include "Concurrency/Keywords.h"
    36 #include "CodeGen/Generate.h"
    37 #include "CodeGen/FixNames.h"
    38 #include "CodeGen/FixMain.h"
    39 #include "CodeTools/DeclStats.h"
    40 #include "CodeTools/TrackLoc.h"
    41 #include "ControlStruct/Mutate.h"
    42 #include "SymTab/Validate.h"
    43 #include "ResolvExpr/AlternativePrinter.h"
    44 #include "ResolvExpr/Resolver.h"
    45 #include "MakeLibCfa.h"
    46 #include "InitTweak/GenInit.h"
    47 #include "InitTweak/FixInit.h"
    48 #include "Common/UnimplementedError.h"
    49 #include "../config.h"
    50 #include "Tuples/Tuples.h"
     17#include <cassert>                          // for assertf
     18#include <cxxabi.h>                         // for __cxa_demangle
     19#include <execinfo.h>                       // for backtrace, backtrace_symbols
     20#include <getopt.h>                         // for no_argument, optind, geto...
     21#include <signal.h>                         // for signal, SIGABRT, SIGSEGV
     22#include <cstdio>                           // for fopen, FILE, fclose, stdin
     23#include <cstdlib>                          // for exit, free, abort, EXIT_F...
     24#include <cstring>                          // for index
     25#include <fstream>                          // for ofstream
     26#include <iostream>                         // for operator<<, basic_ostream
     27#include <iterator>                         // for back_inserter
     28#include <list>                             // for list
     29#include <string>                           // for operator<<, allocator
     30
     31#include "../config.h"                      // for CFA_LIBDIR
     32#include "CodeGen/FixMain.h"                // for FixMain
     33#include "CodeGen/FixNames.h"               // for fixNames
     34#include "CodeGen/Generate.h"               // for generate
     35#include "CodeTools/DeclStats.h"            // for printDeclStats
     36#include "CodeTools/TrackLoc.h"             // for fillLocations
     37#include "Common/CompilerError.h"           // for CompilerError
     38#include "Common/SemanticError.h"           // for SemanticError
     39#include "Common/UnimplementedError.h"      // for UnimplementedError
     40#include "Common/utility.h"                 // for deleteAll, filter, printAll
     41#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
     42#include "ControlStruct/Mutate.h"           // for mutate
     43#include "GenPoly/Box.h"                    // for box
     44#include "GenPoly/CopyParams.h"             // for copyParams
     45#include "GenPoly/InstantiateGeneric.h"     // for instantiateGeneric
     46#include "GenPoly/Lvalue.h"                 // for convertLvalue
     47#include "GenPoly/Specialize.h"             // for convertSpecializations
     48#include "InitTweak/FixInit.h"              // for fix
     49#include "InitTweak/GenInit.h"              // for genInit
     50#include "MakeLibCfa.h"                     // for makeLibCfa
     51#include "Parser/LinkageSpec.h"             // for Spec, Cforall, Intrinsic
     52#include "Parser/ParseNode.h"               // for DeclarationNode, buildList
     53#include "Parser/TypedefTable.h"            // for TypedefTable
     54#include "ResolvExpr/AlternativePrinter.h"  // for AlternativePrinter
     55#include "ResolvExpr/Resolver.h"            // for resolve
     56#include "SymTab/Validate.h"                // for validate
     57#include "SynTree/Declaration.h"            // for Declaration
     58#include "SynTree/Visitor.h"                // for acceptAll
     59#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
    5160
    5261using namespace std;
     
    186195                if ( ! nopreludep ) {                                                   // include gcc builtins
    187196                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    188                         // Read to cfa builtins, if not generating the cfa library
    189                         FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
    190                         assertf( builtins, "cannot open builtins.cf\n" );
    191                         parse( builtins, LinkageSpec::Compiler );
    192197
    193198                        // Read to gcc builtins, if not generating the cfa library
     
    206211                                assertf( prelude, "cannot open prelude.cf\n" );
    207212                                parse( prelude, LinkageSpec::Intrinsic );
     213
     214                                // Read to cfa builtins, if not generating the cfa library
     215                                FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     216                                assertf( builtins, "cannot open builtins.cf\n" );
     217                                parse( builtins, LinkageSpec::BuiltinCFA );
    208218                        } // if
    209219                } // if
     
    289299                OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    290300                Tuples::expandUniqueExpr( translationUnit );
     301
     302                OPTPRINT( "translateEHM" );
     303                ControlStruct::translateEHM( translationUnit );
    291304
    292305                OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
     
    481494                        break;
    482495                  case '?':
    483                         assertf( false, "Unknown option: '%c'\n", (char)optopt );
     496                        if ( optopt ) {                                                         // short option ?
     497                                assertf( false, "Unknown option: -%c\n", (char)optopt );
     498                        } else {
     499                                assertf( false, "Unknown option: %s\n", argv[optind - 1] );
     500                        } // if
    484501                  default:
    485502                        abort();
  • src/prelude/Makefile.am

    rfea3faa rb826e6b  
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
    2424
     25CC = ${abs_top_srcdir}/src/driver/cfa
     26
     27$(DEPDIR) :
     28        mkdir $(DEPDIR)
     29
     30$(DEPDIR)/builtins.Po : $(DEPDIR)
     31        touch ${@}
     32
    2533# create extra forward types/declarations to reduce inclusion of library files
    2634extras.cf : extras.regx extras.c
     
    3947
    4048# create forward declarations for cfa builtins
    41 builtins.cf : builtins.c
    42         ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
     49builtins.cf : builtins.c ${CC}
     50        ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
     51        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
     52
     53include $(DEPDIR)/builtins.Po
    4354
    4455../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     
    4859        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    4960
     61maintainer-clean-local :
     62        rm -rf $(DEPDIR)
     63
    5064MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • src/prelude/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    2019
    2120VPATH = @srcdir@
     21am__is_gnu_make = { \
     22  if test -z '$(MAKELEVEL)'; then \
     23    false; \
     24  elif test -n '$(MAKE_HOST)'; then \
     25    true; \
     26  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     27    true; \
     28  else \
     29    false; \
     30  fi; \
     31}
     32am__make_running_with_option = \
     33  case $${target_option-} in \
     34      ?) ;; \
     35      *) echo "am__make_running_with_option: internal error: invalid" \
     36              "target option '$${target_option-}' specified" >&2; \
     37         exit 1;; \
     38  esac; \
     39  has_opt=no; \
     40  sane_makeflags=$$MAKEFLAGS; \
     41  if $(am__is_gnu_make); then \
     42    sane_makeflags=$$MFLAGS; \
     43  else \
     44    case $$MAKEFLAGS in \
     45      *\\[\ \   ]*) \
     46        bs=\\; \
     47        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     48          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     49    esac; \
     50  fi; \
     51  skip_next=no; \
     52  strip_trailopt () \
     53  { \
     54    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     55  }; \
     56  for flg in $$sane_makeflags; do \
     57    test $$skip_next = yes && { skip_next=no; continue; }; \
     58    case $$flg in \
     59      *=*|--*) continue;; \
     60        -*I) strip_trailopt 'I'; skip_next=yes;; \
     61      -*I?*) strip_trailopt 'I';; \
     62        -*O) strip_trailopt 'O'; skip_next=yes;; \
     63      -*O?*) strip_trailopt 'O';; \
     64        -*l) strip_trailopt 'l'; skip_next=yes;; \
     65      -*l?*) strip_trailopt 'l';; \
     66      -[dEDm]) skip_next=yes;; \
     67      -[JT]) skip_next=yes;; \
     68    esac; \
     69    case $$flg in \
     70      *$$target_option*) has_opt=yes; break;; \
     71    esac; \
     72  done; \
     73  test $$has_opt = yes
     74am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     75am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2276pkgdatadir = $(datadir)/@PACKAGE@
    2377pkgincludedir = $(includedir)/@PACKAGE@
     
    3993host_triplet = @host@
    4094subdir = src/prelude
    41 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    4295ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4396am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    4497am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    4598        $(ACLOCAL_M4)
     99DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    46100mkinstalldirs = $(install_sh) -d
    47101CONFIG_HEADER = $(top_builddir)/config.h
    48102CONFIG_CLEAN_FILES =
    49103CONFIG_CLEAN_VPATH_FILES =
     104AM_V_P = $(am__v_P_@AM_V@)
     105am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     106am__v_P_0 = false
     107am__v_P_1 = :
    50108AM_V_GEN = $(am__v_GEN_@AM_V@)
    51109am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    52 am__v_GEN_0 = @echo "  GEN   " $@;
     110am__v_GEN_0 = @echo "  GEN     " $@;
     111am__v_GEN_1 =
    53112AM_V_at = $(am__v_at_@AM_V@)
    54113am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    55114am__v_at_0 = @
     115am__v_at_1 =
    56116SOURCES =
    57117DIST_SOURCES =
     118am__can_run_installinfo = \
     119  case $$AM_UPDATE_INFO_DIR in \
     120    n|no|NO) false;; \
     121    *) (install-info --version) >/dev/null 2>&1;; \
     122  esac
    58123am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    59124am__vpath_adj = case $$p in \
     
    85150am__installdirs = "$(DESTDIR)$(cfalibdir)"
    86151DATA = $(cfalib_DATA) $(noinst_DATA)
     152am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     153am__DIST_COMMON = $(srcdir)/Makefile.in
    87154DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    88155ACLOCAL = @ACLOCAL@
     
    95162AWK = @AWK@
    96163BACKEND_CC = @BACKEND_CC@
    97 CC = @CC@
     164CC = ${abs_top_srcdir}/src/driver/cfa
    98165CCAS = @CCAS@
    99166CCASDEPMODE = @CCASDEPMODE@
     
    197264program_transform_name = @program_transform_name@
    198265psdir = @psdir@
     266runstatedir = @runstatedir@
    199267sbindir = @sbindir@
    200268sharedstatedir = @sharedstatedir@
     
    229297        $(am__cd) $(top_srcdir) && \
    230298          $(AUTOMAKE) --foreign src/prelude/Makefile
    231 .PRECIOUS: Makefile
    232299Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    233300        @case '$?' in \
     
    249316install-cfalibDATA: $(cfalib_DATA)
    250317        @$(NORMAL_INSTALL)
    251         test -z "$(cfalibdir)" || $(MKDIR_P) "$(DESTDIR)$(cfalibdir)"
    252318        @list='$(cfalib_DATA)'; test -n "$(cfalibdir)" || list=; \
     319        if test -n "$$list"; then \
     320          echo " $(MKDIR_P) '$(DESTDIR)$(cfalibdir)'"; \
     321          $(MKDIR_P) "$(DESTDIR)$(cfalibdir)" || exit 1; \
     322        fi; \
    253323        for p in $$list; do \
    254324          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
     
    265335        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
    266336        dir='$(DESTDIR)$(cfalibdir)'; $(am__uninstall_files_from_dir)
    267 tags: TAGS
    268 TAGS:
    269 
    270 ctags: CTAGS
    271 CTAGS:
     337tags TAGS:
     338
     339ctags CTAGS:
     340
     341cscope cscopelist:
    272342
    273343
     
    390460maintainer-clean: maintainer-clean-am
    391461        -rm -f Makefile
    392 maintainer-clean-am: distclean-am maintainer-clean-generic
     462maintainer-clean-am: distclean-am maintainer-clean-generic \
     463        maintainer-clean-local
    393464
    394465mostlyclean: mostlyclean-am
     
    408479.MAKE: install-am install-strip
    409480
    410 .PHONY: all all-am check check-am clean clean-generic distclean \
    411         distclean-generic distdir dvi dvi-am html html-am info info-am \
    412         install install-am install-cfalibDATA install-data \
    413         install-data-am install-dvi install-dvi-am install-exec \
    414         install-exec-am install-html install-html-am install-info \
    415         install-info-am install-man install-pdf install-pdf-am \
    416         install-ps install-ps-am install-strip installcheck \
    417         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 
     481.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
     482        ctags-am distclean distclean-generic distdir dvi dvi-am html \
     483        html-am info info-am install install-am install-cfalibDATA \
     484        install-data install-data-am install-dvi install-dvi-am \
     485        install-exec install-exec-am install-html install-html-am \
     486        install-info install-info-am install-man install-pdf \
     487        install-pdf-am install-ps install-ps-am install-strip \
     488        installcheck installcheck-am installdirs maintainer-clean \
     489        maintainer-clean-generic maintainer-clean-local mostlyclean \
     490        mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
     491        uninstall-am uninstall-cfalibDATA
     492
     493.PRECIOUS: Makefile
     494
     495
     496$(DEPDIR) :
     497        mkdir $(DEPDIR)
     498
     499$(DEPDIR)/builtins.Po : $(DEPDIR)
     500        touch ${@}
    421501
    422502# create extra forward types/declarations to reduce inclusion of library files
     
    436516
    437517# create forward declarations for cfa builtins
    438 builtins.cf : builtins.c
    439         ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
     518builtins.cf : builtins.c ${CC}
     519        ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
     520        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
     521
     522include $(DEPDIR)/builtins.Po
    440523
    441524../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     
    444527bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    445528        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     529
     530maintainer-clean-local :
     531        rm -rf $(DEPDIR)
    446532
    447533# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/prelude/builtins.c

    rfea3faa rb826e6b  
    11typedef unsigned long long __cfaabi_exception_type_t;
     2
     3#include "../libcfa/exception.h"
  • src/tests/.expect/32/math.txt

    rfea3faa rb826e6b  
    2222cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
    2323tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
    24 asin:1.5708 1.5707963267949 1.57079632679489662 0.66624+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
    2525acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
    2626atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
  • src/tests/.expect/concurrent/sched-int-disjoint.txt

    rfea3faa rb826e6b  
    999000
    101010000
    11 11000
    12 12000
    13 13000
    14 14000
    15 15000
    16 16000
    17 17000
    18 18000
    19 19000
    20 20000
    21 21000
    22 22000
    23 23000
    24 24000
    25 25000
    26 26000
    27 27000
    28 28000
    29 29000
    30 30000
    31 31000
    32 32000
    33 33000
    34 34000
    35 35000
    36 36000
    37 37000
    38 38000
    39 39000
    40 40000
    41 41000
    42 42000
    43 43000
    44 44000
    45 45000
    46 46000
    47 47000
    48 48000
    49 49000
    50 50000
    51 51000
    52 52000
    53 53000
    54 54000
    55 55000
    56 56000
    57 57000
    58 58000
    59 59000
    60 60000
    61 61000
    62 62000
    63 63000
    64 64000
    65 65000
    66 66000
    67 67000
    68 68000
    69 69000
    70 70000
    71 71000
    72 72000
    73 73000
    74 74000
    75 75000
    76 76000
    77 77000
    78 78000
    79 79000
    80 80000
    81 81000
    82 82000
    83 83000
    84 84000
    85 85000
    86 86000
    87 87000
    88 88000
    89 89000
    90 90000
    91 91000
    92 92000
    93 93000
    94 94000
    95 95000
    96 96000
    97 97000
    98 98000
    99 99000
    100 100000
    10111All waiter done
  • src/tests/.expect/io.txt

    rfea3faa rb826e6b  
    44123
    55
     6opening delimiters
    67x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10
     8
     9closing delimiters
    7101, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x
     11
     12opening/closing delimiters
    813x`1`x'2'x"3"x:4:x 5 x   6       x
    9147
     
    152010
    1621x
     22
     23override opening/closing delimiters
    1724x ( 1 ) x 2 , x 3 :x: 4
     25
     26input bacis types
     27
     28output basic types
    1829A
    19301 2 3 4 5 6 7 8
     
    21321.1+2.3i 1.1-2.3i 1.1-2.3i
    2233
     34tuples
     351, 2, 3 4, 5, 6
     36
     37toggle separator
    23381.11.21.3
    24391.1+2.3i1.1-2.3i1.1-2.3i
    25  abcxyz
     401.1+2.3i 1.1-2.3i1.1-2.3i
     411.1+2.3i 1.1-2.3i 1.1-2.3i
     421.1+2.3i1.1-2.3i 1.1-2.3i
     43abcxyz
    2644abcxyz
    2745
     46change separator
     47from " " to ", $"
    28481.1, $1.2, $1.3
    29491.1+2.3i, $1.1-2.3i, $1.1-2.3i
    3050abc, $xyz
     511, 2, 3, $4, 5, 6
    3152
    32 1, 2, 3, 4
    33 1, $2, $3 ", $"
    34 1 2 3 " "
    35  1 2 3
     53from ", $" to " "
     541.1 1.2 1.3
     551.1+2.3i 1.1-2.3i 1.1-2.3i
     56abc xyz
     571, 2, 3 4, 5, 6
     58
     59check sepOn/sepOff
     601 2 3
    366112 3
     621 2 3
     631 2 3
     64
     651 2 3
     66
     67check enable/disable
    3768123
    38691 23
    39701 2 3
    40 1 2 3 4 " "
    41 1, 2, 3, 4 ", "
    42 1, 2, 3, 4
     71123
     721 2 3
     73123
     741 2 3
     75
     761 2 3 4 5 6 " "
     771, 2, 3 4, 5, 6 " "
     781, 2, 3 4, 5, 6
     79
    43803, 4, a, 7.2
    44813, 4, a, 7.2
    45823 4 a 7.2
    46  3 4 a 7.234a7.23 4 a 7.2
    47 3-4-a-7.2^3^4-3-4-a-7.2
     833 4 a 7.234a7.23 4 a 7.2
     843-4-a-7.2^3^4^3-4-a-7.2
  • src/tests/Makefile.am

    rfea3faa rb826e6b  
    2929
    3030# applies to both programs
    31 EXTRA_FLAGS =
    32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
     31DEBUG_FLAGS =
     32
     33BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@
     34if !BUILD_DEBUG
     35BUILD_FLAGS += -nodebug
     36else
     37if !BUILD_RELEASE
     38BUILD_FLAGS += -debug
     39else
     40BUILD_FLAGS += ${DEBUG_FLAGS}
     41endif
     42endif
     43
    3344TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
    34 CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
     45AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
    3546CC = @CFA_BINDIR@/@CFA_NAME@
    3647
     
    3950
    4051fstream_test_SOURCES = fstream_test.c
     52fstream_test_CFLAGS = $(if $(test), 2>> .err/fstream_test.log, ) ${BUILD_FLAGS}
     53
    4154vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
     55vector_test_CFLAGS = $(if $(test), 2>> .err/vector_test.log, ) ${BUILD_FLAGS}
     56
    4257avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
     58avl_test_CFLAGS = $(if $(test), 2>> .err/avl_test.log, ) ${BUILD_FLAGS}
    4359
    4460all-local :
     
    6278
    6379% : %.c @CFA_BINDIR@/@CFA_NAME@
    64         ${CC} ${CFLAGS} ${<} -o ${@}
     80        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    6581
    6682dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    67         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     83        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    6884
    6985dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    70         ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
     86        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@}
    7187
    7288declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    73         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     89        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    7490
    7591gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    76         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     92        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    7793
    7894extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    79         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     95        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8096
    8197attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    82         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     98        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8399
    84100KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    85         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     101        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    86102
    87103gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    88         ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
     104        ${CC} ${AM_CFLAGS} ${CFLAGS} -lgmp ${<} -o ${@}
    89105
    90106memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    91         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     107        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    92108
    93109completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    94         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     110        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1918###############################################################################
    2019VPATH = @srcdir@
     20am__is_gnu_make = { \
     21  if test -z '$(MAKELEVEL)'; then \
     22    false; \
     23  elif test -n '$(MAKE_HOST)'; then \
     24    true; \
     25  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     26    true; \
     27  else \
     28    false; \
     29  fi; \
     30}
     31am__make_running_with_option = \
     32  case $${target_option-} in \
     33      ?) ;; \
     34      *) echo "am__make_running_with_option: internal error: invalid" \
     35              "target option '$${target_option-}' specified" >&2; \
     36         exit 1;; \
     37  esac; \
     38  has_opt=no; \
     39  sane_makeflags=$$MAKEFLAGS; \
     40  if $(am__is_gnu_make); then \
     41    sane_makeflags=$$MFLAGS; \
     42  else \
     43    case $$MAKEFLAGS in \
     44      *\\[\ \   ]*) \
     45        bs=\\; \
     46        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     47          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     48    esac; \
     49  fi; \
     50  skip_next=no; \
     51  strip_trailopt () \
     52  { \
     53    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     54  }; \
     55  for flg in $$sane_makeflags; do \
     56    test $$skip_next = yes && { skip_next=no; continue; }; \
     57    case $$flg in \
     58      *=*|--*) continue;; \
     59        -*I) strip_trailopt 'I'; skip_next=yes;; \
     60      -*I?*) strip_trailopt 'I';; \
     61        -*O) strip_trailopt 'O'; skip_next=yes;; \
     62      -*O?*) strip_trailopt 'O';; \
     63        -*l) strip_trailopt 'l'; skip_next=yes;; \
     64      -*l?*) strip_trailopt 'l';; \
     65      -[dEDm]) skip_next=yes;; \
     66      -[JT]) skip_next=yes;; \
     67    esac; \
     68    case $$flg in \
     69      *$$target_option*) has_opt=yes; break;; \
     70    esac; \
     71  done; \
     72  test $$has_opt = yes
     73am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     74am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2175pkgdatadir = $(datadir)/@PACKAGE@
    2276pkgincludedir = $(includedir)/@PACKAGE@
     
    3892host_triplet = @host@
    3993@BUILD_CONCURRENCY_TRUE@am__append_1 = coroutine thread monitor
     94@BUILD_DEBUG_FALSE@am__append_2 = -nodebug
     95@BUILD_DEBUG_TRUE@@BUILD_RELEASE_FALSE@am__append_3 = -debug
     96@BUILD_DEBUG_TRUE@@BUILD_RELEASE_TRUE@am__append_4 = ${DEBUG_FLAGS}
    4097EXTRA_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \
    4198        avl_test$(EXEEXT)
    4299subdir = src/tests
    43 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    44100ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    45101am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    46102am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    47103        $(ACLOCAL_M4)
     104DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    48105mkinstalldirs = $(install_sh) -d
    49106CONFIG_HEADER = $(top_builddir)/config.h
    50107CONFIG_CLEAN_FILES =
    51108CONFIG_CLEAN_VPATH_FILES =
    52 am_avl_test_OBJECTS = avl_test.$(OBJEXT) avl0.$(OBJEXT) avl1.$(OBJEXT) \
    53         avl2.$(OBJEXT) avl3.$(OBJEXT) avl4.$(OBJEXT) \
    54         avl-private.$(OBJEXT)
     109am__dirstamp = $(am__leading_dot)dirstamp
     110am_avl_test_OBJECTS = avltree/avl_test-avl_test.$(OBJEXT) \
     111        avltree/avl_test-avl0.$(OBJEXT) \
     112        avltree/avl_test-avl1.$(OBJEXT) \
     113        avltree/avl_test-avl2.$(OBJEXT) \
     114        avltree/avl_test-avl3.$(OBJEXT) \
     115        avltree/avl_test-avl4.$(OBJEXT) \
     116        avltree/avl_test-avl-private.$(OBJEXT)
    55117avl_test_OBJECTS = $(am_avl_test_OBJECTS)
    56118avl_test_LDADD = $(LDADD)
    57 am_fstream_test_OBJECTS = fstream_test.$(OBJEXT)
     119avl_test_LINK = $(CCLD) $(avl_test_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
     120        $(LDFLAGS) -o $@
     121am_fstream_test_OBJECTS = fstream_test-fstream_test.$(OBJEXT)
    58122fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)
    59123fstream_test_LDADD = $(LDADD)
    60 am_vector_test_OBJECTS = vector_int.$(OBJEXT) array.$(OBJEXT) \
    61         vector_test.$(OBJEXT)
     124fstream_test_LINK = $(CCLD) $(fstream_test_CFLAGS) $(CFLAGS) \
     125        $(AM_LDFLAGS) $(LDFLAGS) -o $@
     126am_vector_test_OBJECTS = vector/vector_test-vector_int.$(OBJEXT) \
     127        vector/vector_test-array.$(OBJEXT) \
     128        vector/vector_test-vector_test.$(OBJEXT)
    62129vector_test_OBJECTS = $(am_vector_test_OBJECTS)
    63130vector_test_LDADD = $(LDADD)
     131vector_test_LINK = $(CCLD) $(vector_test_CFLAGS) $(CFLAGS) \
     132        $(AM_LDFLAGS) $(LDFLAGS) -o $@
     133AM_V_P = $(am__v_P_@AM_V@)
     134am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     135am__v_P_0 = false
     136am__v_P_1 = :
     137AM_V_GEN = $(am__v_GEN_@AM_V@)
     138am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     139am__v_GEN_0 = @echo "  GEN     " $@;
     140am__v_GEN_1 =
     141AM_V_at = $(am__v_at_@AM_V@)
     142am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     143am__v_at_0 = @
     144am__v_at_1 =
    64145DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    65146depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    69150am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    70151am__v_lt_0 = --silent
     152am__v_lt_1 =
    71153COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    72154        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    73155AM_V_CC = $(am__v_CC_@AM_V@)
    74156am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    75 am__v_CC_0 = @echo "  CC    " $@;
    76 AM_V_at = $(am__v_at_@AM_V@)
    77 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    78 am__v_at_0 = @
     157am__v_CC_0 = @echo "  CC      " $@;
     158am__v_CC_1 =
    79159CCLD = $(CC)
    80160LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    81161AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    82162am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    83 am__v_CCLD_0 = @echo "  CCLD  " $@;
    84 AM_V_GEN = $(am__v_GEN_@AM_V@)
    85 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    86 am__v_GEN_0 = @echo "  GEN   " $@;
     163am__v_CCLD_0 = @echo "  CCLD    " $@;
     164am__v_CCLD_1 =
    87165SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    88166        $(vector_test_SOURCES)
    89167DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    90168        $(vector_test_SOURCES)
     169am__can_run_installinfo = \
     170  case $$AM_UPDATE_INFO_DIR in \
     171    n|no|NO) false;; \
     172    *) (install-info --version) >/dev/null 2>&1;; \
     173  esac
     174am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     175# Read a list of newline-separated strings from the standard input,
     176# and print each of them once, without duplicates.  Input order is
     177# *not* preserved.
     178am__uniquify_input = $(AWK) '\
     179  BEGIN { nonempty = 0; } \
     180  { items[$$0] = 1; nonempty = 1; } \
     181  END { if (nonempty) { for (i in items) print i; }; } \
     182'
     183# Make sure the list of sources is unique.  This is necessary because,
     184# e.g., the same source file might be shared among _SOURCES variables
     185# for different programs/libraries.
     186am__define_uniq_tagged_files = \
     187  list='$(am__tagged_files)'; \
     188  unique=`for i in $$list; do \
     189    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     190  done | $(am__uniquify_input)`
    91191ETAGS = etags
    92192CTAGS = ctags
     193am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    93194DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    94195ACLOCAL = @ACLOCAL@
     
    113214CFA_NAME = @CFA_NAME@
    114215CFA_PREFIX = @CFA_PREFIX@
    115 CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
     216CFLAGS = @CFLAGS@
    116217CPP = @CPP@
    117218CPPFLAGS = @CPPFLAGS@
     
    203304program_transform_name = @program_transform_name@
    204305psdir = @psdir@
     306runstatedir = @runstatedir@
    205307sbindir = @sbindir@
    206308sharedstatedir = @sharedstatedir@
     
    221323
    222324# applies to both programs
    223 EXTRA_FLAGS =
    224 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
     325DEBUG_FLAGS =
     326BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ \
     327        $(am__append_2) $(am__append_3) $(am__append_4)
    225328TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
     329AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
    226330fstream_test_SOURCES = fstream_test.c
     331fstream_test_CFLAGS = $(if $(test), 2>> .err/fstream_test.log, ) ${BUILD_FLAGS}
    227332vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
     333vector_test_CFLAGS = $(if $(test), 2>> .err/vector_test.log, ) ${BUILD_FLAGS}
    228334avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
     335avl_test_CFLAGS = $(if $(test), 2>> .err/avl_test.log, ) ${BUILD_FLAGS}
    229336all: all-am
    230337
     
    243350        $(am__cd) $(top_srcdir) && \
    244351          $(AUTOMAKE) --foreign src/tests/Makefile
    245 .PRECIOUS: Makefile
    246352Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    247353        @case '$?' in \
     
    261367        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    262368$(am__aclocal_m4_deps):
     369avltree/$(am__dirstamp):
     370        @$(MKDIR_P) avltree
     371        @: > avltree/$(am__dirstamp)
     372avltree/$(DEPDIR)/$(am__dirstamp):
     373        @$(MKDIR_P) avltree/$(DEPDIR)
     374        @: > avltree/$(DEPDIR)/$(am__dirstamp)
     375avltree/avl_test-avl_test.$(OBJEXT): avltree/$(am__dirstamp) \
     376        avltree/$(DEPDIR)/$(am__dirstamp)
     377avltree/avl_test-avl0.$(OBJEXT): avltree/$(am__dirstamp) \
     378        avltree/$(DEPDIR)/$(am__dirstamp)
     379avltree/avl_test-avl1.$(OBJEXT): avltree/$(am__dirstamp) \
     380        avltree/$(DEPDIR)/$(am__dirstamp)
     381avltree/avl_test-avl2.$(OBJEXT): avltree/$(am__dirstamp) \
     382        avltree/$(DEPDIR)/$(am__dirstamp)
     383avltree/avl_test-avl3.$(OBJEXT): avltree/$(am__dirstamp) \
     384        avltree/$(DEPDIR)/$(am__dirstamp)
     385avltree/avl_test-avl4.$(OBJEXT): avltree/$(am__dirstamp) \
     386        avltree/$(DEPDIR)/$(am__dirstamp)
     387avltree/avl_test-avl-private.$(OBJEXT): avltree/$(am__dirstamp) \
     388        avltree/$(DEPDIR)/$(am__dirstamp)
     389
    263390avl_test$(EXEEXT): $(avl_test_OBJECTS) $(avl_test_DEPENDENCIES) $(EXTRA_avl_test_DEPENDENCIES)
    264391        @rm -f avl_test$(EXEEXT)
    265         $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
     392        $(AM_V_CCLD)$(avl_test_LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
     393
    266394fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)
    267395        @rm -f fstream_test$(EXEEXT)
    268         $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
     396        $(AM_V_CCLD)$(fstream_test_LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
     397vector/$(am__dirstamp):
     398        @$(MKDIR_P) vector
     399        @: > vector/$(am__dirstamp)
     400vector/$(DEPDIR)/$(am__dirstamp):
     401        @$(MKDIR_P) vector/$(DEPDIR)
     402        @: > vector/$(DEPDIR)/$(am__dirstamp)
     403vector/vector_test-vector_int.$(OBJEXT): vector/$(am__dirstamp) \
     404        vector/$(DEPDIR)/$(am__dirstamp)
     405vector/vector_test-array.$(OBJEXT): vector/$(am__dirstamp) \
     406        vector/$(DEPDIR)/$(am__dirstamp)
     407vector/vector_test-vector_test.$(OBJEXT): vector/$(am__dirstamp) \
     408        vector/$(DEPDIR)/$(am__dirstamp)
     409
    269410vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES)
    270411        @rm -f vector_test$(EXEEXT)
    271         $(AM_V_CCLD)$(LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS)
     412        $(AM_V_CCLD)$(vector_test_LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS)
    272413
    273414mostlyclean-compile:
    274415        -rm -f *.$(OBJEXT)
     416        -rm -f avltree/*.$(OBJEXT)
     417        -rm -f vector/*.$(OBJEXT)
    275418
    276419distclean-compile:
    277420        -rm -f *.tab.c
    278421
    279 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl-private.Po@am__quote@
    281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl0.Po@am__quote@
    282 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl1.Po@am__quote@
    283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl2.Po@am__quote@
    284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl3.Po@am__quote@
    285 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@
    286 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_test.Po@am__quote@
    287 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@
    288 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@
    289 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@
     422@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test-fstream_test.Po@am__quote@
     423@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl-private.Po@am__quote@
     424@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl0.Po@am__quote@
     425@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl1.Po@am__quote@
     426@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl2.Po@am__quote@
     427@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl3.Po@am__quote@
     428@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl4.Po@am__quote@
     429@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl_test.Po@am__quote@
     430@AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-array.Po@am__quote@
     431@AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-vector_int.Po@am__quote@
     432@AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-vector_test.Po@am__quote@
    290433
    291434.c.o:
    292 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    293 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     435@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     436@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     437@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    294438@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    295439@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    296 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
     440@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    297441
    298442.c.obj:
    299 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    300 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
     443@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     444@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     445@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    301446@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    302447@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    303 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
    304 
    305 avl_test.o: avltree/avl_test.c
    306 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.o -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    307 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
    308 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.o' libtool=no @AMDEPBACKSLASH@
    309 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    310 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    311 
    312 avl_test.obj: avltree/avl_test.c
    313 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.obj -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    314 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
    315 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.obj' libtool=no @AMDEPBACKSLASH@
    316 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    317 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    318 
    319 avl0.o: avltree/avl0.c
    320 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.o -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    321 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
    322 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.o' libtool=no @AMDEPBACKSLASH@
    323 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    324 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    325 
    326 avl0.obj: avltree/avl0.c
    327 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.obj -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    328 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
    329 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.obj' libtool=no @AMDEPBACKSLASH@
    330 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    331 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    332 
    333 avl1.o: avltree/avl1.c
    334 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.o -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    335 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
    336 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.o' libtool=no @AMDEPBACKSLASH@
    337 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    338 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    339 
    340 avl1.obj: avltree/avl1.c
    341 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.obj -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    342 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
    343 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.obj' libtool=no @AMDEPBACKSLASH@
    344 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    345 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    346 
    347 avl2.o: avltree/avl2.c
    348 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.o -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    349 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
    350 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.o' libtool=no @AMDEPBACKSLASH@
    351 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    352 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    353 
    354 avl2.obj: avltree/avl2.c
    355 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.obj -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    356 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
    357 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.obj' libtool=no @AMDEPBACKSLASH@
    358 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    359 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    360 
    361 avl3.o: avltree/avl3.c
    362 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.o -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    363 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
    364 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.o' libtool=no @AMDEPBACKSLASH@
    365 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    366 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    367 
    368 avl3.obj: avltree/avl3.c
    369 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.obj -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    370 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
    371 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.obj' libtool=no @AMDEPBACKSLASH@
    372 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    373 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    374 
    375 avl4.o: avltree/avl4.c
    376 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.o -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    377 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
    378 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.o' libtool=no @AMDEPBACKSLASH@
    379 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    380 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    381 
    382 avl4.obj: avltree/avl4.c
    383 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.obj -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    384 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
    385 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.obj' libtool=no @AMDEPBACKSLASH@
    386 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    387 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    388 
    389 avl-private.o: avltree/avl-private.c
    390 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.o -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    391 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
    392 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.o' libtool=no @AMDEPBACKSLASH@
    393 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    394 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    395 
    396 avl-private.obj: avltree/avl-private.c
    397 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.obj -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    398 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
    399 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.obj' libtool=no @AMDEPBACKSLASH@
    400 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    401 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    402 
    403 vector_int.o: vector/vector_int.c
    404 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_int.o -MD -MP -MF $(DEPDIR)/vector_int.Tpo -c -o vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
    405 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_int.Tpo $(DEPDIR)/vector_int.Po
    406 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector_int.o' libtool=no @AMDEPBACKSLASH@
    407 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    408 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
    409 
    410 vector_int.obj: vector/vector_int.c
    411 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_int.obj -MD -MP -MF $(DEPDIR)/vector_int.Tpo -c -o vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
    412 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_int.Tpo $(DEPDIR)/vector_int.Po
    413 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector_int.obj' libtool=no @AMDEPBACKSLASH@
    414 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    415 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
    416 
    417 array.o: vector/array.c
    418 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT array.o -MD -MP -MF $(DEPDIR)/array.Tpo -c -o array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
    419 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/array.Tpo $(DEPDIR)/array.Po
    420 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='array.o' libtool=no @AMDEPBACKSLASH@
    421 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    422 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
    423 
    424 array.obj: vector/array.c
    425 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT array.obj -MD -MP -MF $(DEPDIR)/array.Tpo -c -o array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
    426 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/array.Tpo $(DEPDIR)/array.Po
    427 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='array.obj' libtool=no @AMDEPBACKSLASH@
    428 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    429 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
    430 
    431 vector_test.o: vector/vector_test.c
    432 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_test.o -MD -MP -MF $(DEPDIR)/vector_test.Tpo -c -o vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
    433 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_test.Tpo $(DEPDIR)/vector_test.Po
    434 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector_test.o' libtool=no @AMDEPBACKSLASH@
    435 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    436 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
    437 
    438 vector_test.obj: vector/vector_test.c
    439 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_test.obj -MD -MP -MF $(DEPDIR)/vector_test.Tpo -c -o vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
    440 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_test.Tpo $(DEPDIR)/vector_test.Po
    441 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector_test.obj' libtool=no @AMDEPBACKSLASH@
    442 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    443 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
    444 
    445 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    446         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    447         unique=`for i in $$list; do \
    448             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    449           done | \
    450           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    451               END { if (nonempty) { for (i in files) print i; }; }'`; \
    452         mkid -fID $$unique
    453 tags: TAGS
    454 
    455 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    456                 $(TAGS_FILES) $(LISP)
     448@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     449
     450avltree/avl_test-avl_test.o: avltree/avl_test.c
     451@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl_test.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl_test.Tpo -c -o avltree/avl_test-avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     452@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl_test.Tpo avltree/$(DEPDIR)/avl_test-avl_test.Po
     453@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avltree/avl_test-avl_test.o' libtool=no @AMDEPBACKSLASH@
     454@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     455@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     456
     457avltree/avl_test-avl_test.obj: avltree/avl_test.c
     458@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl_test.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl_test.Tpo -c -o avltree/avl_test-avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     459@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl_test.Tpo avltree/$(DEPDIR)/avl_test-avl_test.Po
     460@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avltree/avl_test-avl_test.obj' libtool=no @AMDEPBACKSLASH@
     461@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     462@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     463
     464avltree/avl_test-avl0.o: avltree/avl0.c
     465@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl0.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl0.Tpo -c -o avltree/avl_test-avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     466@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl0.Tpo avltree/$(DEPDIR)/avl_test-avl0.Po
     467@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avltree/avl_test-avl0.o' libtool=no @AMDEPBACKSLASH@
     468@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     469@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     470
     471avltree/avl_test-avl0.obj: avltree/avl0.c
     472@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl0.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl0.Tpo -c -o avltree/avl_test-avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     473@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl0.Tpo avltree/$(DEPDIR)/avl_test-avl0.Po
     474@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avltree/avl_test-avl0.obj' libtool=no @AMDEPBACKSLASH@
     475@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     476@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     477
     478avltree/avl_test-avl1.o: avltree/avl1.c
     479@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl1.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl1.Tpo -c -o avltree/avl_test-avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     480@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl1.Tpo avltree/$(DEPDIR)/avl_test-avl1.Po
     481@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avltree/avl_test-avl1.o' libtool=no @AMDEPBACKSLASH@
     482@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     483@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     484
     485avltree/avl_test-avl1.obj: avltree/avl1.c
     486@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl1.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl1.Tpo -c -o avltree/avl_test-avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     487@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl1.Tpo avltree/$(DEPDIR)/avl_test-avl1.Po
     488@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avltree/avl_test-avl1.obj' libtool=no @AMDEPBACKSLASH@
     489@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     490@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     491
     492avltree/avl_test-avl2.o: avltree/avl2.c
     493@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl2.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl2.Tpo -c -o avltree/avl_test-avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     494@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl2.Tpo avltree/$(DEPDIR)/avl_test-avl2.Po
     495@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avltree/avl_test-avl2.o' libtool=no @AMDEPBACKSLASH@
     496@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     497@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     498
     499avltree/avl_test-avl2.obj: avltree/avl2.c
     500@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl2.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl2.Tpo -c -o avltree/avl_test-avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     501@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl2.Tpo avltree/$(DEPDIR)/avl_test-avl2.Po
     502@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avltree/avl_test-avl2.obj' libtool=no @AMDEPBACKSLASH@
     503@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     504@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     505
     506avltree/avl_test-avl3.o: avltree/avl3.c
     507@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl3.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl3.Tpo -c -o avltree/avl_test-avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     508@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl3.Tpo avltree/$(DEPDIR)/avl_test-avl3.Po
     509@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avltree/avl_test-avl3.o' libtool=no @AMDEPBACKSLASH@
     510@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     511@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     512
     513avltree/avl_test-avl3.obj: avltree/avl3.c
     514@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl3.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl3.Tpo -c -o avltree/avl_test-avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     515@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl3.Tpo avltree/$(DEPDIR)/avl_test-avl3.Po
     516@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avltree/avl_test-avl3.obj' libtool=no @AMDEPBACKSLASH@
     517@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     518@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     519
     520avltree/avl_test-avl4.o: avltree/avl4.c
     521@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl4.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl4.Tpo -c -o avltree/avl_test-avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     522@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl4.Tpo avltree/$(DEPDIR)/avl_test-avl4.Po
     523@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avltree/avl_test-avl4.o' libtool=no @AMDEPBACKSLASH@
     524@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     525@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     526
     527avltree/avl_test-avl4.obj: avltree/avl4.c
     528@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl4.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl4.Tpo -c -o avltree/avl_test-avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     529@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl4.Tpo avltree/$(DEPDIR)/avl_test-avl4.Po
     530@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avltree/avl_test-avl4.obj' libtool=no @AMDEPBACKSLASH@
     531@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     532@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     533
     534avltree/avl_test-avl-private.o: avltree/avl-private.c
     535@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl-private.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl-private.Tpo -c -o avltree/avl_test-avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     536@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl-private.Tpo avltree/$(DEPDIR)/avl_test-avl-private.Po
     537@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avltree/avl_test-avl-private.o' libtool=no @AMDEPBACKSLASH@
     538@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     539@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     540
     541avltree/avl_test-avl-private.obj: avltree/avl-private.c
     542@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl-private.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl-private.Tpo -c -o avltree/avl_test-avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     543@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl-private.Tpo avltree/$(DEPDIR)/avl_test-avl-private.Po
     544@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avltree/avl_test-avl-private.obj' libtool=no @AMDEPBACKSLASH@
     545@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     546@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     547
     548fstream_test-fstream_test.o: fstream_test.c
     549@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -MT fstream_test-fstream_test.o -MD -MP -MF $(DEPDIR)/fstream_test-fstream_test.Tpo -c -o fstream_test-fstream_test.o `test -f 'fstream_test.c' || echo '$(srcdir)/'`fstream_test.c
     550@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fstream_test-fstream_test.Tpo $(DEPDIR)/fstream_test-fstream_test.Po
     551@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fstream_test.c' object='fstream_test-fstream_test.o' libtool=no @AMDEPBACKSLASH@
     552@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     553@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -c -o fstream_test-fstream_test.o `test -f 'fstream_test.c' || echo '$(srcdir)/'`fstream_test.c
     554
     555fstream_test-fstream_test.obj: fstream_test.c
     556@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -MT fstream_test-fstream_test.obj -MD -MP -MF $(DEPDIR)/fstream_test-fstream_test.Tpo -c -o fstream_test-fstream_test.obj `if test -f 'fstream_test.c'; then $(CYGPATH_W) 'fstream_test.c'; else $(CYGPATH_W) '$(srcdir)/fstream_test.c'; fi`
     557@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fstream_test-fstream_test.Tpo $(DEPDIR)/fstream_test-fstream_test.Po
     558@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fstream_test.c' object='fstream_test-fstream_test.obj' libtool=no @AMDEPBACKSLASH@
     559@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     560@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -c -o fstream_test-fstream_test.obj `if test -f 'fstream_test.c'; then $(CYGPATH_W) 'fstream_test.c'; else $(CYGPATH_W) '$(srcdir)/fstream_test.c'; fi`
     561
     562vector/vector_test-vector_int.o: vector/vector_int.c
     563@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_int.o -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_int.Tpo -c -o vector/vector_test-vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
     564@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_int.Tpo vector/$(DEPDIR)/vector_test-vector_int.Po
     565@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector/vector_test-vector_int.o' libtool=no @AMDEPBACKSLASH@
     566@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     567@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
     568
     569vector/vector_test-vector_int.obj: vector/vector_int.c
     570@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_int.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_int.Tpo -c -o vector/vector_test-vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
     571@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_int.Tpo vector/$(DEPDIR)/vector_test-vector_int.Po
     572@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector/vector_test-vector_int.obj' libtool=no @AMDEPBACKSLASH@
     573@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     574@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
     575
     576vector/vector_test-array.o: vector/array.c
     577@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-array.o -MD -MP -MF vector/$(DEPDIR)/vector_test-array.Tpo -c -o vector/vector_test-array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
     578@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-array.Tpo vector/$(DEPDIR)/vector_test-array.Po
     579@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='vector/vector_test-array.o' libtool=no @AMDEPBACKSLASH@
     580@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     581@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
     582
     583vector/vector_test-array.obj: vector/array.c
     584@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-array.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-array.Tpo -c -o vector/vector_test-array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
     585@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-array.Tpo vector/$(DEPDIR)/vector_test-array.Po
     586@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='vector/vector_test-array.obj' libtool=no @AMDEPBACKSLASH@
     587@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     588@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
     589
     590vector/vector_test-vector_test.o: vector/vector_test.c
     591@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_test.o -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_test.Tpo -c -o vector/vector_test-vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
     592@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_test.Tpo vector/$(DEPDIR)/vector_test-vector_test.Po
     593@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector/vector_test-vector_test.o' libtool=no @AMDEPBACKSLASH@
     594@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     595@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
     596
     597vector/vector_test-vector_test.obj: vector/vector_test.c
     598@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_test.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_test.Tpo -c -o vector/vector_test-vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
     599@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_test.Tpo vector/$(DEPDIR)/vector_test-vector_test.Po
     600@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector/vector_test-vector_test.obj' libtool=no @AMDEPBACKSLASH@
     601@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     602@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
     603
     604ID: $(am__tagged_files)
     605        $(am__define_uniq_tagged_files); mkid -fID $$unique
     606tags: tags-am
     607TAGS: tags
     608
     609tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    457610        set x; \
    458611        here=`pwd`; \
    459         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    460         unique=`for i in $$list; do \
    461             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    462           done | \
    463           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    464               END { if (nonempty) { for (i in files) print i; }; }'`; \
     612        $(am__define_uniq_tagged_files); \
    465613        shift; \
    466614        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    474622          fi; \
    475623        fi
    476 ctags: CTAGS
    477 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    478                 $(TAGS_FILES) $(LISP)
    479         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    480         unique=`for i in $$list; do \
    481             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    482           done | \
    483           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    484               END { if (nonempty) { for (i in files) print i; }; }'`; \
     624ctags: ctags-am
     625
     626CTAGS: ctags
     627ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     628        $(am__define_uniq_tagged_files); \
    485629        test -z "$(CTAGS_ARGS)$$unique" \
    486630          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    491635          && $(am__cd) $(top_srcdir) \
    492636          && gtags -i $(GTAGS_ARGS) "$$here"
     637cscopelist: cscopelist-am
     638
     639cscopelist-am: $(am__tagged_files)
     640        list='$(am__tagged_files)'; \
     641        case "$(srcdir)" in \
     642          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     643          *) sdir=$(subdir)/$(srcdir) ;; \
     644        esac; \
     645        for i in $$list; do \
     646          if test -f "$$i"; then \
     647            echo "$(subdir)/$$i"; \
     648          else \
     649            echo "$$sdir/$$i"; \
     650          fi; \
     651        done >> $(top_builddir)/cscope.files
    493652
    494653distclean-tags:
     
    555714        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    556715        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
     716        -rm -f avltree/$(DEPDIR)/$(am__dirstamp)
     717        -rm -f avltree/$(am__dirstamp)
     718        -rm -f vector/$(DEPDIR)/$(am__dirstamp)
     719        -rm -f vector/$(am__dirstamp)
    557720
    558721maintainer-clean-generic:
     
    564727
    565728distclean: distclean-am
    566         -rm -rf ./$(DEPDIR)
     729        -rm -rf ./$(DEPDIR) avltree/$(DEPDIR) vector/$(DEPDIR)
    567730        -rm -f Makefile
    568731distclean-am: clean-am distclean-compile distclean-generic \
     
    610773
    611774maintainer-clean: maintainer-clean-am
    612         -rm -rf ./$(DEPDIR)
     775        -rm -rf ./$(DEPDIR) avltree/$(DEPDIR) vector/$(DEPDIR)
    613776        -rm -f Makefile
    614777maintainer-clean-am: distclean-am maintainer-clean-generic
     
    630793.MAKE: install-am install-strip
    631794
    632 .PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
    633         clean-generic clean-local ctags distclean distclean-compile \
    634         distclean-generic distclean-tags distdir dvi dvi-am html \
    635         html-am info info-am install install-am install-data \
    636         install-data-am install-dvi install-dvi-am install-exec \
    637         install-exec-am install-html install-html-am install-info \
    638         install-info-am install-man install-pdf install-pdf-am \
    639         install-ps install-ps-am install-strip installcheck \
    640         installcheck-am installdirs maintainer-clean \
    641         maintainer-clean-generic mostlyclean mostlyclean-compile \
    642         mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
    643         uninstall-am
     795.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
     796        clean-generic clean-local cscopelist-am ctags ctags-am \
     797        distclean distclean-compile distclean-generic distclean-tags \
     798        distdir dvi dvi-am html html-am info info-am install \
     799        install-am install-data install-data-am install-dvi \
     800        install-dvi-am install-exec install-exec-am install-html \
     801        install-html-am install-info install-info-am install-man \
     802        install-pdf install-pdf-am install-ps install-ps-am \
     803        install-strip installcheck installcheck-am installdirs \
     804        maintainer-clean maintainer-clean-generic mostlyclean \
     805        mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
     806        tags tags-am uninstall uninstall-am
     807
     808.PRECIOUS: Makefile
    644809
    645810
     
    665830
    666831% : %.c @CFA_BINDIR@/@CFA_NAME@
    667         ${CC} ${CFLAGS} ${<} -o ${@}
     832        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    668833
    669834dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    670         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     835        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    671836
    672837dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    673         ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
     838        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@}
    674839
    675840declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    676         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     841        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    677842
    678843gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    679         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     844        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    680845
    681846extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    682         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     847        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    683848
    684849attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    685         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     850        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    686851
    687852KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    688         ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     853        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    689854
    690855gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    691         ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
     856        ${CC} ${AM_CFLAGS} ${CFLAGS} -lgmp ${<} -o ${@}
    692857
    693858memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    694         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     859        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    695860
    696861completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    697         ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
     862        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    698863
    699864# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/gmp.c

    rfea3faa rb826e6b  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 24 22:05:38 2017
    13 // Update Count     : 540
     12// Last Modified On : Thu Jul 13 16:35:01 2017
     13// Update Count     : 541
    1414//
    1515
     
    9595// Local Variables: //
    9696// tab-width: 4 //
    97 // compile-command: "cfa gmp.c -l gmp" //
     97// compile-command: "cfa gmp.c -lgmp" //
    9898// End: //
  • src/tests/io.c

    rfea3faa rb826e6b  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  8 09:52:10 2017
    13 // Update Count     : 51
     12// Last Modified On : Thu Jul  6 23:26:12 2017
     13// Update Count     : 78
    1414//
    1515
     
    4242        sout | endl;
    4343
     44        sout | "opening delimiters" | endl;
    4445        sout
    45                 // opening delimiters
    4646                | "x (" | 1
    4747                | "x [" | 2
     
    5454                | "x ¿" | 9
    5555                | "x «" | 10
    56                 | endl;
     56                | endl | endl;
     57
     58        sout | "closing delimiters" | endl;
    5759        sout
    58                 // closing delimiters
    5960                | 1 | ", x"
    6061                | 2 | ". x"
     
    6869                | 10 | "] x"
    6970                | 11 | "} x"
    70                 | endl;
     71                | endl | endl;
     72
     73        sout | "opening/closing delimiters" | endl;
    7174        sout
    72                 // opening-closing delimiters
    7375                | "x`" | 1 | "`x'" | 2
    7476                | "'x\"" | 3 | "\"x:" | 4
     
    7678                | "\tx\f" | 7 | "\fx\v" | 8
    7779                | "\vx\n" | 9 | "\nx\r" | 10
    78                 | "\rx" |
    79                 endl;
     80                | "\rx"
     81                | endl | endl;
     82
     83        sout | "override opening/closing delimiters" | endl;
    8084        sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
     85        sout | endl;
    8186
    8287        ifstream in;                                                                            // create / open file
    8388        open( &in, "io.data", "r" );
    8489
     90        sout | "input bacis types" | endl;
    8591        &in | &c                                                                                        // character
    8692                | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli     // integral
     
    8894                | &fc | &dc | &ldc                                                              // floating-point complex
    8995                | cstr( s1 ) | cstr( s2, size );                                // C string, length unchecked and checked
     96        sout | endl;
    9097
     98        sout | "output basic types" | endl;
    9199        sout | c | ' ' | endl                                                           // character
    92100                | si | usi | i | ui | li | uli | lli | ulli | endl // integral
     
    94102                | fc | dc | ldc | endl;                                                 // complex
    95103        sout | endl;
    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
     104
     105        sout | "tuples" | endl;
     106        [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
     107        sout | t1 | t2 | endl;                                                          // print tuple
    100108        sout | endl;
    101109
     110        sout | "toggle separator" | endl;
     111        sout | f | "" | d | "" | ld | endl                                      // floating point without separator
     112                | sepDisable | fc | dc | ldc | endl                             // complex without separator
     113                | fc | sepOn | dc | ldc | endl                                  // local separator add
     114                | sepEnable | fc | dc | ldc | endl                              // complex with separator
     115                | fc | sepOff | dc | ldc | endl                                 // local separator removal
     116                | s1 | sepOff | s2 | endl                                               // local separator removal
     117                | s1 | "" | s2 | endl;                                                  // local separator removal
     118        sout | endl;
     119
     120        sout | "change separator" | endl;
     121        sout | "from \"" | sep | "\"";
    102122        sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
     123        sout | " to \"" | sep | "\"" | endl;
    103124        sout | f | d | ld | endl
    104125                | fc | dc | ldc | endl
    105                 | s1 | s2 | endl;
     126                | s1 | s2 | endl
     127                | t1 | t2 | endl;                                                               // print tuple
     128        sout | endl;
     129        sout | "from \"" | sep | "\" ";
     130        sepSet( sout, " " );                                                            // restore separator
     131        sout | "to \"" | sep | "\"" | endl;
     132        sout | f | d | ld | endl
     133                | fc | dc | ldc | endl
     134                | s1 | s2 | endl
     135                | t1 | t2 | endl;                                                               // print tuple
    106136        sout | endl;
    107137
    108         [int, int] t1 = [1, 2], t2 = [3, 4];
    109         sout | t1 | t2 | endl;                                                          // print tuple
     138        sout | "check sepOn/sepOff" | endl;
     139        sout | sepOn | 1 | 2 | 3 | sepOn | endl;                        // no separator at start/end of line
     140        sout | 1 | sepOff | 2 | 3 | endl;                                       // locally turn off implicit separator
     141        sout | sepOn | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn | '\n'; // no separator at start/end of line
     142        sout | 1 | 2 | 3 | "\n\n" | sepOn;                                      // no separator at start of next line
     143        sout | 1 | 2 | 3 | endl;
     144        sout | endl;
    110145
    111         sepSet( sout, " " );
    112         sepSet( sout, ", $" );                                                          // set separator from " " to ", $"
    113         sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    114         sepSet( sout, " " );                                                            // reset separator to " "
    115         sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    116 
    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
    119 
     146        sout | "check enable/disable" | endl;
    120147        sout | sepDisable | 1 | 2 | 3 | endl;                           // globally turn off implicit separation
    121148        sout | 1 | sepOn | 2 | 3 | endl;                                        // locally turn on implicit separator
    122         sout | sepEnable | 1 | 2 | 3 | endl;                            // globally turn on implicit separation
     149        sout | sepEnable | 1 | 2 | 3 | endl | sepDisable;       // globally turn on/off implicit separation
     150        sout | 1 | 2 | 3 | endl | sepEnable;                            // globally turn on implicit separation
     151        sout | 1 | 2 | 3 | sepOn | sepDisable | endl;           // ignore seperate at end of line
     152        sout | 1 | 2 | 3 | sepOn | sepEnable | endl;            // separator at end of line
     153        sout | 1 | 2 | 3 | endl;
     154        sout | endl;
     155
     156//      sout | fmt( d, "%8.3f" ) || endl;
     157//      sout | endl;
    123158
    124159        sepSetTuple( sout, " " );                                                       // set tuple separator from ", " to " "
    125         sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
     160        sout | t1 | t2 | " \"" | sep | "\"" | endl;
    126161        sepSetTuple( sout, ", " );                                                      // reset tuple separator to ", "
    127         sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    128 
     162        sout | t1 | t2 | " \"" | sep | "\"" | endl;
    129163        sout | t1 | t2 | endl;                                                          // print tuple
     164        sout | endl;
    130165
    131166        [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
  • src/tests/preempt_longrun/Makefile.am

    rfea3faa rb826e6b  
    1010## Author           : Thierry Delisle
    1111## Created On       : Fri Jun 16 10:57:34 2017
    12 ## Last Modified By : 
    13 ## Last Modified On : 
     12## Last Modified By :
     13## Last Modified On :
    1414## Update Count     : 0
    1515###############################################################################
    1616
    1717repeats=10
    18 max_time=10
    19 N=10ul
    20 preempt=10_000ul
     18max_time=600
     19preempt=1_000ul
    2120
    2221REPEAT = ${abs_top_srcdir}/tools/repeat -s
    2322
    24 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
     23BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
    2524CFLAGS = ${BUILD_FLAGS}
    2625CC = @CFA_BINDIR@/@CFA_NAME@
    2726
    28 TESTS = barge block create disjoint processor stack wait yield
     27TESTS = barge block create disjoint enter enter3 processor stack wait yield
    2928
    3029.INTERMEDIATE: ${TESTS}
    3130
    3231all-local: ${TESTS:=.run}
     32
     33clean-local:
     34        rm -f ${TESTS}
    3335
    3436% : %.c ${CC}
  • src/tests/preempt_longrun/Makefile.in

    rfea3faa rb826e6b  
    1 # Makefile.in generated by automake 1.11.3 from Makefile.am.
     1# Makefile.in generated by automake 1.15 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
    6 # Foundation, Inc.
     4# Copyright (C) 1994-2014 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1918###############################################################################
    2019VPATH = @srcdir@
     20am__is_gnu_make = { \
     21  if test -z '$(MAKELEVEL)'; then \
     22    false; \
     23  elif test -n '$(MAKE_HOST)'; then \
     24    true; \
     25  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
     26    true; \
     27  else \
     28    false; \
     29  fi; \
     30}
     31am__make_running_with_option = \
     32  case $${target_option-} in \
     33      ?) ;; \
     34      *) echo "am__make_running_with_option: internal error: invalid" \
     35              "target option '$${target_option-}' specified" >&2; \
     36         exit 1;; \
     37  esac; \
     38  has_opt=no; \
     39  sane_makeflags=$$MAKEFLAGS; \
     40  if $(am__is_gnu_make); then \
     41    sane_makeflags=$$MFLAGS; \
     42  else \
     43    case $$MAKEFLAGS in \
     44      *\\[\ \   ]*) \
     45        bs=\\; \
     46        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     47          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     48    esac; \
     49  fi; \
     50  skip_next=no; \
     51  strip_trailopt () \
     52  { \
     53    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     54  }; \
     55  for flg in $$sane_makeflags; do \
     56    test $$skip_next = yes && { skip_next=no; continue; }; \
     57    case $$flg in \
     58      *=*|--*) continue;; \
     59        -*I) strip_trailopt 'I'; skip_next=yes;; \
     60      -*I?*) strip_trailopt 'I';; \
     61        -*O) strip_trailopt 'O'; skip_next=yes;; \
     62      -*O?*) strip_trailopt 'O';; \
     63        -*l) strip_trailopt 'l'; skip_next=yes;; \
     64      -*l?*) strip_trailopt 'l';; \
     65      -[dEDm]) skip_next=yes;; \
     66      -[JT]) skip_next=yes;; \
     67    esac; \
     68    case $$flg in \
     69      *$$target_option*) has_opt=yes; break;; \
     70    esac; \
     71  done; \
     72  test $$has_opt = yes
     73am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     74am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2175pkgdatadir = $(datadir)/@PACKAGE@
    2276pkgincludedir = $(includedir)/@PACKAGE@
     
    3892host_triplet = @host@
    3993subdir = src/tests/preempt_longrun
    40 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    4194ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4295am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    4396am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    4497        $(ACLOCAL_M4)
     98DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    4599mkinstalldirs = $(install_sh) -d
    46100CONFIG_HEADER = $(top_builddir)/config.h
    47101CONFIG_CLEAN_FILES =
    48102CONFIG_CLEAN_VPATH_FILES =
     103AM_V_P = $(am__v_P_@AM_V@)
     104am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     105am__v_P_0 = false
     106am__v_P_1 = :
    49107AM_V_GEN = $(am__v_GEN_@AM_V@)
    50108am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    51 am__v_GEN_0 = @echo "  GEN   " $@;
     109am__v_GEN_0 = @echo "  GEN     " $@;
     110am__v_GEN_1 =
    52111AM_V_at = $(am__v_at_@AM_V@)
    53112am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    54113am__v_at_0 = @
     114am__v_at_1 =
    55115SOURCES =
    56116DIST_SOURCES =
    57 am__tty_colors = \
    58 red=; grn=; lgn=; blu=; std=
     117am__can_run_installinfo = \
     118  case $$AM_UPDATE_INFO_DIR in \
     119    n|no|NO) false;; \
     120    *) (install-info --version) >/dev/null 2>&1;; \
     121  esac
     122am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     123am__tty_colors_dummy = \
     124  mgn= red= grn= lgn= blu= brg= std=; \
     125  am__color_tests=no
     126am__tty_colors = { \
     127  $(am__tty_colors_dummy); \
     128  if test "X$(AM_COLOR_TESTS)" = Xno; then \
     129    am__color_tests=no; \
     130  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
     131    am__color_tests=yes; \
     132  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
     133    am__color_tests=yes; \
     134  fi; \
     135  if test $$am__color_tests = yes; then \
     136    red='[0;31m'; \
     137    grn='[0;32m'; \
     138    lgn='[1;32m'; \
     139    blu='[1;34m'; \
     140    mgn='[0;35m'; \
     141    brg='[1m'; \
     142    std='[m'; \
     143  fi; \
     144}
     145am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
     146am__vpath_adj = case $$p in \
     147    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     148    *) f=$$p;; \
     149  esac;
     150am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
     151am__install_max = 40
     152am__nobase_strip_setup = \
     153  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
     154am__nobase_strip = \
     155  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
     156am__nobase_list = $(am__nobase_strip_setup); \
     157  for p in $$list; do echo "$$p $$p"; done | \
     158  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
     159  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
     160    if (++n[$$2] == $(am__install_max)) \
     161      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
     162    END { for (dir in files) print dir, files[dir] }'
     163am__base_list = \
     164  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
     165  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
     166am__uninstall_files_from_dir = { \
     167  test -z "$$files" \
     168    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
     169    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
     170         $(am__cd) "$$dir" && rm -f $$files; }; \
     171  }
     172am__recheck_rx = ^[     ]*:recheck:[    ]*
     173am__global_test_result_rx = ^[  ]*:global-test-result:[         ]*
     174am__copy_in_global_log_rx = ^[  ]*:copy-in-global-log:[         ]*
     175# A command that, given a newline-separated list of test names on the
     176# standard input, print the name of the tests that are to be re-run
     177# upon "make recheck".
     178am__list_recheck_tests = $(AWK) '{ \
     179  recheck = 1; \
     180  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
     181    { \
     182      if (rc < 0) \
     183        { \
     184          if ((getline line2 < ($$0 ".log")) < 0) \
     185            recheck = 0; \
     186          break; \
     187        } \
     188      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
     189        { \
     190          recheck = 0; \
     191          break; \
     192        } \
     193      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
     194        { \
     195          break; \
     196        } \
     197    }; \
     198  if (recheck) \
     199    print $$0; \
     200  close ($$0 ".trs"); \
     201  close ($$0 ".log"); \
     202}'
     203# A command that, given a newline-separated list of test names on the
     204# standard input, create the global log from their .trs and .log files.
     205am__create_global_log = $(AWK) ' \
     206function fatal(msg) \
     207{ \
     208  print "fatal: making $@: " msg | "cat >&2"; \
     209  exit 1; \
     210} \
     211function rst_section(header) \
     212{ \
     213  print header; \
     214  len = length(header); \
     215  for (i = 1; i <= len; i = i + 1) \
     216    printf "="; \
     217  printf "\n\n"; \
     218} \
     219{ \
     220  copy_in_global_log = 1; \
     221  global_test_result = "RUN"; \
     222  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
     223    { \
     224      if (rc < 0) \
     225         fatal("failed to read from " $$0 ".trs"); \
     226      if (line ~ /$(am__global_test_result_rx)/) \
     227        { \
     228          sub("$(am__global_test_result_rx)", "", line); \
     229          sub("[        ]*$$", "", line); \
     230          global_test_result = line; \
     231        } \
     232      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
     233        copy_in_global_log = 0; \
     234    }; \
     235  if (copy_in_global_log) \
     236    { \
     237      rst_section(global_test_result ": " $$0); \
     238      while ((rc = (getline line < ($$0 ".log"))) != 0) \
     239      { \
     240        if (rc < 0) \
     241          fatal("failed to read from " $$0 ".log"); \
     242        print line; \
     243      }; \
     244      printf "\n"; \
     245    }; \
     246  close ($$0 ".trs"); \
     247  close ($$0 ".log"); \
     248}'
     249# Restructured Text title.
     250am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
     251# Solaris 10 'make', and several other traditional 'make' implementations,
     252# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
     253# by disabling -e (using the XSI extension "set +e") if it's set.
     254am__sh_e_setup = case $$- in *e*) set +e;; esac
     255# Default flags passed to test drivers.
     256am__common_driver_flags = \
     257  --color-tests "$$am__color_tests" \
     258  --enable-hard-errors "$$am__enable_hard_errors" \
     259  --expect-failure "$$am__expect_failure"
     260# To be inserted before the command running the test.  Creates the
     261# directory for the log if needed.  Stores in $dir the directory
     262# containing $f, in $tst the test, in $log the log.  Executes the
     263# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
     264# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
     265# will run the test scripts (or their associated LOG_COMPILER, if
     266# thy have one).
     267am__check_pre = \
     268$(am__sh_e_setup);                                      \
     269$(am__vpath_adj_setup) $(am__vpath_adj)                 \
     270$(am__tty_colors);                                      \
     271srcdir=$(srcdir); export srcdir;                        \
     272case "$@" in                                            \
     273  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;    \
     274    *) am__odir=.;;                                     \
     275esac;                                                   \
     276test "x$$am__odir" = x"." || test -d "$$am__odir"       \
     277  || $(MKDIR_P) "$$am__odir" || exit $$?;               \
     278if test -f "./$$f"; then dir=./;                        \
     279elif test -f "$$f"; then dir=;                          \
     280else dir="$(srcdir)/"; fi;                              \
     281tst=$$dir$$f; log='$@';                                 \
     282if test -n '$(DISABLE_HARD_ERRORS)'; then               \
     283  am__enable_hard_errors=no;                            \
     284else                                                    \
     285  am__enable_hard_errors=yes;                           \
     286fi;                                                     \
     287case " $(XFAIL_TESTS) " in                              \
     288  *[\ \ ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
     289    am__expect_failure=yes;;                            \
     290  *)                                                    \
     291    am__expect_failure=no;;                             \
     292esac;                                                   \
     293$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
     294# A shell command to get the names of the tests scripts with any registered
     295# extension removed (i.e., equivalently, the names of the test logs, with
     296# the '.log' extension removed).  The result is saved in the shell variable
     297# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
     298# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
     299# since that might cause problem with VPATH rewrites for suffix-less tests.
     300# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
     301am__set_TESTS_bases = \
     302  bases='$(TEST_LOGS)'; \
     303  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
     304  bases=`echo $$bases`
     305RECHECK_LOGS = $(TEST_LOGS)
     306AM_RECURSIVE_TARGETS = check recheck
     307TEST_SUITE_LOG = test-suite.log
     308TEST_EXTENSIONS = @EXEEXT@ .test
     309LOG_DRIVER = $(SHELL) $(top_srcdir)/automake/test-driver
     310LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
     311am__set_b = \
     312  case '$@' in \
     313    */*) \
     314      case '$*' in \
     315        */*) b='$*';; \
     316          *) b=`echo '$@' | sed 's/\.log$$//'`; \
     317       esac;; \
     318    *) \
     319      b='$*';; \
     320  esac
     321am__test_logs1 = $(TESTS:=.log)
     322am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
     323TEST_LOGS = $(am__test_logs2:.test.log=.log)
     324TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/automake/test-driver
     325TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
     326        $(TEST_LOG_FLAGS)
     327am__DIST_COMMON = $(srcdir)/Makefile.in \
     328        $(top_srcdir)/automake/test-driver
    59329DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    60330ACLOCAL = @ACLOCAL@
     
    169439program_transform_name = @program_transform_name@
    170440psdir = @psdir@
     441runstatedir = @runstatedir@
    171442sbindir = @sbindir@
    172443sharedstatedir = @sharedstatedir@
     
    178449top_srcdir = @top_srcdir@
    179450repeats = 10
    180 max_time = 10
    181 N = 10ul
    182 preempt = 10_000ul
     451max_time = 600
     452preempt = 1_000ul
    183453REPEAT = ${abs_top_srcdir}/tools/repeat -s
    184 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
    185 TESTS = barge block create disjoint processor stack wait yield
     454BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
     455TESTS = barge block create disjoint enter enter3 processor stack wait yield
    186456all: all-am
    187457
    188458.SUFFIXES:
     459.SUFFIXES: .log .test .test$(EXEEXT) .trs
    189460$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
    190461        @for dep in $?; do \
     
    199470        $(am__cd) $(top_srcdir) && \
    200471          $(AUTOMAKE) --foreign src/tests/preempt_longrun/Makefile
    201 .PRECIOUS: Makefile
    202472Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    203473        @case '$?' in \
     
    217487        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    218488$(am__aclocal_m4_deps):
    219 tags: TAGS
    220 TAGS:
    221 
    222 ctags: CTAGS
    223 CTAGS:
    224 
    225 
    226 check-TESTS: $(TESTS)
    227         @failed=0; all=0; xfail=0; xpass=0; skip=0; \
    228         srcdir=$(srcdir); export srcdir; \
    229         list=' $(TESTS) '; \
    230         $(am__tty_colors); \
    231         if test -n "$$list"; then \
    232           for tst in $$list; do \
    233             if test -f ./$$tst; then dir=./; \
    234             elif test -f $$tst; then dir=; \
    235             else dir="$(srcdir)/"; fi; \
    236             if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
    237               all=`expr $$all + 1`; \
    238               case " $(XFAIL_TESTS) " in \
    239               *[\ \     ]$$tst[\ \      ]*) \
    240                 xpass=`expr $$xpass + 1`; \
    241                 failed=`expr $$failed + 1`; \
    242                 col=$$red; res=XPASS; \
    243               ;; \
    244               *) \
    245                 col=$$grn; res=PASS; \
    246               ;; \
    247               esac; \
    248             elif test $$? -ne 77; then \
    249               all=`expr $$all + 1`; \
    250               case " $(XFAIL_TESTS) " in \
    251               *[\ \     ]$$tst[\ \      ]*) \
    252                 xfail=`expr $$xfail + 1`; \
    253                 col=$$lgn; res=XFAIL; \
    254               ;; \
    255               *) \
    256                 failed=`expr $$failed + 1`; \
    257                 col=$$red; res=FAIL; \
    258               ;; \
    259               esac; \
     489tags TAGS:
     490
     491ctags CTAGS:
     492
     493cscope cscopelist:
     494
     495
     496# Recover from deleted '.trs' file; this should ensure that
     497# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
     498# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
     499# to avoid problems with "make -n".
     500.log.trs:
     501        rm -f $< $@
     502        $(MAKE) $(AM_MAKEFLAGS) $<
     503
     504# Leading 'am--fnord' is there to ensure the list of targets does not
     505# expand to empty, as could happen e.g. with make check TESTS=''.
     506am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
     507am--force-recheck:
     508        @:
     509
     510$(TEST_SUITE_LOG): $(TEST_LOGS)
     511        @$(am__set_TESTS_bases); \
     512        am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
     513        redo_bases=`for i in $$bases; do \
     514                      am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
     515                    done`; \
     516        if test -n "$$redo_bases"; then \
     517          redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
     518          redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
     519          if $(am__make_dryrun); then :; else \
     520            rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
     521          fi; \
     522        fi; \
     523        if test -n "$$am__remaking_logs"; then \
     524          echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
     525               "recursion detected" >&2; \
     526        elif test -n "$$redo_logs"; then \
     527          am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
     528        fi; \
     529        if $(am__make_dryrun); then :; else \
     530          st=0;  \
     531          errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
     532          for i in $$redo_bases; do \
     533            test -f $$i.trs && test -r $$i.trs \
     534              || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
     535            test -f $$i.log && test -r $$i.log \
     536              || { echo "$$errmsg $$i.log" >&2; st=1; }; \
     537          done; \
     538          test $$st -eq 0 || exit 1; \
     539        fi
     540        @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
     541        ws='[   ]'; \
     542        results=`for b in $$bases; do echo $$b.trs; done`; \
     543        test -n "$$results" || results=/dev/null; \
     544        all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
     545        pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
     546        fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
     547        skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
     548        xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
     549        xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
     550        error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
     551        if test `expr $$fail + $$xpass + $$error` -eq 0; then \
     552          success=true; \
     553        else \
     554          success=false; \
     555        fi; \
     556        br='==================='; br=$$br$$br$$br$$br; \
     557        result_count () \
     558        { \
     559            if test x"$$1" = x"--maybe-color"; then \
     560              maybe_colorize=yes; \
     561            elif test x"$$1" = x"--no-color"; then \
     562              maybe_colorize=no; \
    260563            else \
    261               skip=`expr $$skip + 1`; \
    262               col=$$blu; res=SKIP; \
     564              echo "$@: invalid 'result_count' usage" >&2; exit 4; \
    263565            fi; \
    264             echo "$${col}$$res$${std}: $$tst"; \
    265           done; \
    266           if test "$$all" -eq 1; then \
    267             tests="test"; \
    268             All=""; \
    269           else \
    270             tests="tests"; \
    271             All="All "; \
    272           fi; \
    273           if test "$$failed" -eq 0; then \
    274             if test "$$xfail" -eq 0; then \
    275               banner="$$All$$all $$tests passed"; \
     566            shift; \
     567            desc=$$1 count=$$2; \
     568            if test $$maybe_colorize = yes && test $$count -gt 0; then \
     569              color_start=$$3 color_end=$$std; \
    276570            else \
    277               if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
    278               banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
     571              color_start= color_end=; \
    279572            fi; \
    280           else \
    281             if test "$$xpass" -eq 0; then \
    282               banner="$$failed of $$all $$tests failed"; \
    283             else \
    284               if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
    285               banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
    286             fi; \
    287           fi; \
    288           dashes="$$banner"; \
    289           skipped=""; \
    290           if test "$$skip" -ne 0; then \
    291             if test "$$skip" -eq 1; then \
    292               skipped="($$skip test was not run)"; \
    293             else \
    294               skipped="($$skip tests were not run)"; \
    295             fi; \
    296             test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
    297               dashes="$$skipped"; \
    298           fi; \
    299           report=""; \
    300           if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
    301             report="Please report to $(PACKAGE_BUGREPORT)"; \
    302             test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
    303               dashes="$$report"; \
    304           fi; \
    305           dashes=`echo "$$dashes" | sed s/./=/g`; \
    306           if test "$$failed" -eq 0; then \
    307             col="$$grn"; \
    308           else \
    309             col="$$red"; \
    310           fi; \
    311           echo "$${col}$$dashes$${std}"; \
    312           echo "$${col}$$banner$${std}"; \
    313           test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
    314           test -z "$$report" || echo "$${col}$$report$${std}"; \
    315           echo "$${col}$$dashes$${std}"; \
    316           test "$$failed" -eq 0; \
    317         else :; fi
     573            echo "$${color_start}# $$desc $$count$${color_end}"; \
     574        }; \
     575        create_testsuite_report () \
     576        { \
     577          result_count $$1 "TOTAL:" $$all   "$$brg"; \
     578          result_count $$1 "PASS: " $$pass  "$$grn"; \
     579          result_count $$1 "SKIP: " $$skip  "$$blu"; \
     580          result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
     581          result_count $$1 "FAIL: " $$fail  "$$red"; \
     582          result_count $$1 "XPASS:" $$xpass "$$red"; \
     583          result_count $$1 "ERROR:" $$error "$$mgn"; \
     584        }; \
     585        {                                                               \
     586          echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
     587            $(am__rst_title);                                           \
     588          create_testsuite_report --no-color;                           \
     589          echo;                                                         \
     590          echo ".. contents:: :depth: 2";                               \
     591          echo;                                                         \
     592          for b in $$bases; do echo $$b; done                           \
     593            | $(am__create_global_log);                                 \
     594        } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
     595        mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
     596        if $$success; then                                              \
     597          col="$$grn";                                                  \
     598         else                                                           \
     599          col="$$red";                                                  \
     600          test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
     601        fi;                                                             \
     602        echo "$${col}$$br$${std}";                                      \
     603        echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
     604        echo "$${col}$$br$${std}";                                      \
     605        create_testsuite_report --maybe-color;                          \
     606        echo "$$col$$br$$std";                                          \
     607        if $$success; then :; else                                      \
     608          echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
     609          if test -n "$(PACKAGE_BUGREPORT)"; then                       \
     610            echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
     611          fi;                                                           \
     612          echo "$$col$$br$$std";                                        \
     613        fi;                                                             \
     614        $$success || exit 1
     615
     616check-TESTS:
     617        @list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
     618        @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
     619        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
     620        @set +e; $(am__set_TESTS_bases); \
     621        log_list=`for i in $$bases; do echo $$i.log; done`; \
     622        trs_list=`for i in $$bases; do echo $$i.trs; done`; \
     623        log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
     624        $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
     625        exit $$?;
     626recheck: all
     627        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
     628        @set +e; $(am__set_TESTS_bases); \
     629        bases=`for i in $$bases; do echo $$i; done \
     630                 | $(am__list_recheck_tests)` || exit 1; \
     631        log_list=`for i in $$bases; do echo $$i.log; done`; \
     632        log_list=`echo $$log_list`; \
     633        $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
     634                am__force_recheck=am--force-recheck \
     635                TEST_LOGS="$$log_list"; \
     636        exit $$?
     637barge.log: barge
     638        @p='barge'; \
     639        b='barge'; \
     640        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     641        --log-file $$b.log --trs-file $$b.trs \
     642        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     643        "$$tst" $(AM_TESTS_FD_REDIRECT)
     644block.log: block
     645        @p='block'; \
     646        b='block'; \
     647        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     648        --log-file $$b.log --trs-file $$b.trs \
     649        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     650        "$$tst" $(AM_TESTS_FD_REDIRECT)
     651create.log: create
     652        @p='create'; \
     653        b='create'; \
     654        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     655        --log-file $$b.log --trs-file $$b.trs \
     656        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     657        "$$tst" $(AM_TESTS_FD_REDIRECT)
     658disjoint.log: disjoint
     659        @p='disjoint'; \
     660        b='disjoint'; \
     661        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     662        --log-file $$b.log --trs-file $$b.trs \
     663        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     664        "$$tst" $(AM_TESTS_FD_REDIRECT)
     665enter.log: enter
     666        @p='enter'; \
     667        b='enter'; \
     668        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     669        --log-file $$b.log --trs-file $$b.trs \
     670        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     671        "$$tst" $(AM_TESTS_FD_REDIRECT)
     672enter3.log: enter3
     673        @p='enter3'; \
     674        b='enter3'; \
     675        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     676        --log-file $$b.log --trs-file $$b.trs \
     677        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     678        "$$tst" $(AM_TESTS_FD_REDIRECT)
     679processor.log: processor
     680        @p='processor'; \
     681        b='processor'; \
     682        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     683        --log-file $$b.log --trs-file $$b.trs \
     684        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     685        "$$tst" $(AM_TESTS_FD_REDIRECT)
     686stack.log: stack
     687        @p='stack'; \
     688        b='stack'; \
     689        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     690        --log-file $$b.log --trs-file $$b.trs \
     691        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     692        "$$tst" $(AM_TESTS_FD_REDIRECT)
     693wait.log: wait
     694        @p='wait'; \
     695        b='wait'; \
     696        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     697        --log-file $$b.log --trs-file $$b.trs \
     698        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     699        "$$tst" $(AM_TESTS_FD_REDIRECT)
     700yield.log: yield
     701        @p='yield'; \
     702        b='yield'; \
     703        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     704        --log-file $$b.log --trs-file $$b.trs \
     705        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     706        "$$tst" $(AM_TESTS_FD_REDIRECT)
     707.test.log:
     708        @p='$<'; \
     709        $(am__set_b); \
     710        $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
     711        --log-file $$b.log --trs-file $$b.trs \
     712        $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
     713        "$$tst" $(AM_TESTS_FD_REDIRECT)
     714@am__EXEEXT_TRUE@.test$(EXEEXT).log:
     715@am__EXEEXT_TRUE@       @p='$<'; \
     716@am__EXEEXT_TRUE@       $(am__set_b); \
     717@am__EXEEXT_TRUE@       $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
     718@am__EXEEXT_TRUE@       --log-file $$b.log --trs-file $$b.trs \
     719@am__EXEEXT_TRUE@       $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
     720@am__EXEEXT_TRUE@       "$$tst" $(AM_TESTS_FD_REDIRECT)
    318721
    319722distdir: $(DISTFILES)
     
    372775        fi
    373776mostlyclean-generic:
     777        -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
     778        -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
     779        -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
    374780
    375781clean-generic:
     
    384790clean: clean-am
    385791
    386 clean-am: clean-generic mostlyclean-am
     792clean-am: clean-generic clean-local mostlyclean-am
    387793
    388794distclean: distclean-am
     
    451857
    452858.PHONY: all all-am all-local check check-TESTS check-am clean \
    453         clean-generic distclean distclean-generic distdir dvi dvi-am \
    454         html html-am info info-am install install-am install-data \
    455         install-data-am install-dvi install-dvi-am install-exec \
    456         install-exec-am install-html install-html-am install-info \
    457         install-info-am install-man install-pdf install-pdf-am \
    458         install-ps install-ps-am install-strip installcheck \
    459         installcheck-am installdirs maintainer-clean \
    460         maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
    461         pdf-am ps ps-am uninstall uninstall-am
     859        clean-generic clean-local cscopelist-am ctags-am distclean \
     860        distclean-generic distdir dvi dvi-am html html-am info info-am \
     861        install install-am install-data install-data-am install-dvi \
     862        install-dvi-am install-exec install-exec-am install-html \
     863        install-html-am install-info install-info-am install-man \
     864        install-pdf install-pdf-am install-ps install-ps-am \
     865        install-strip installcheck installcheck-am installdirs \
     866        maintainer-clean maintainer-clean-generic mostlyclean \
     867        mostlyclean-generic pdf pdf-am ps ps-am recheck tags-am \
     868        uninstall uninstall-am
     869
     870.PRECIOUS: Makefile
    462871
    463872
     
    465874
    466875all-local: ${TESTS:=.run}
     876
     877clean-local:
     878        rm -f ${TESTS}
    467879
    468880% : %.c ${CC}
  • src/tests/preempt_longrun/create.c

    rfea3faa rb826e6b  
    1010}
    1111
    12 thread Worker {};
     12thread worker_t {};
    1313
    14 void main(Worker * this) {}
     14void main(worker_t * this) {}
    1515
    1616int main(int argc, char* argv[]) {
    17         for(int i = 0; i < 100_000ul; i++) {
    18                 Worker w;
     17        processor p;
     18        for(int i = 0; i < 10_000ul; i++) {
     19                worker_t w[7];
    1920        }
    2021}
  • src/tests/preempt_longrun/processor.c

    rfea3faa rb826e6b  
    1010}
    1111
    12 thread Worker {};
     12thread worker_t {};
    1313
    14 void main(Worker * this) {}
     14void main(worker_t * this) {}
    1515
    1616int main(int argc, char* argv[]) {
    17         for(int i = 0; i < 100_000ul; i++) {
     17        for(int i = 0; i < 10_000ul; i++) {
    1818                processor p;
    1919        }
  • src/tests/preempt_longrun/stack.c

    rfea3faa rb826e6b  
    1212}
    1313
    14 thread Worker {};
     14thread worker_t {};
    1515
    16 void main(Worker * this) {
     16void main(worker_t * this) {
    1717        volatile long p = 5_021_609ul;
    1818        volatile long a = 326_417ul;
    1919        volatile long n = 1l;
    20         for (volatile long i = 0; i < p; i++) { 
    21                 n *= a; 
    22                 n %= p; 
     20        for (volatile long i = 0; i < p; i++) {
     21                n *= a;
     22                n %= p;
    2323        }
    24                
     24
    2525        if( n != a ) {
    2626                abort();
     
    2828}
    2929
     30extern "C" {
     31static worker_t * workers;
     32}
     33
    3034int main(int argc, char* argv[]) {
    3135        processor p;
    3236        {
    33                 Worker w[7];
     37                worker_t w[7];
     38                workers = w;
    3439        }
    3540}
  • src/tests/preempt_longrun/yield.c

    rfea3faa rb826e6b  
    1010}
    1111
    12 thread Worker {};
     12thread worker_t {};
    1313
    14 void main(Worker * this) {
    15         for(int i = 0; i < 100_000ul; i++) {
     14void main(worker_t * this) {
     15        for(int i = 0; i < 325_000ul; i++) {
    1616                yield();
    1717        }
     18}
     19
     20extern "C" {
     21static worker_t * workers;
    1822}
    1923
     
    2125        processor p;
    2226        {
    23                 Worker w[7];
     27                worker_t w[7];
     28                workers = w;
    2429        }
    2530}
  • src/tests/sched-int-barge.c

    rfea3faa rb826e6b  
    44#include <stdlib>
    55#include <thread>
     6
     7#ifndef N
     8#define N 100_000
     9#endif
    610
    711enum state_t { WAIT, SIGNAL, BARGE };
     
    7377        }
    7478
    75         if( c->counter >= 100_000 ) c->done = true;
     79        if( c->counter >= N ) c->done = true;
    7680        return !c->done;
    7781}
  • src/tests/sched-int-block.c

    rfea3faa rb826e6b  
    66
    77#ifndef N
    8 #define N 100_000
     8#define N 10_000
    99#endif
    1010
     
    3131//------------------------------------------------------------------------------
    3232void wait_op( global_data_t * mutex a, global_data_t * mutex b, unsigned i ) {
    33         wait( &cond, (uintptr_t)this_thread() );
     33        wait( &cond, (uintptr_t)this_thread );
    3434
    3535        yield( ((unsigned)rand48()) % 10 );
     
    4040        }
    4141
    42         a->last_thread = b->last_thread = this_thread();
     42        a->last_thread = b->last_thread = this_thread;
    4343
    4444        yield( ((unsigned)rand48()) % 10 );
     
    5656        yield( ((unsigned)rand48()) % 10 );
    5757
    58         a->last_thread = b->last_thread = a->last_signaller = b->last_signaller = this_thread();
     58        a->last_thread = b->last_thread = a->last_signaller = b->last_signaller = this_thread;
    5959
    6060        if( !is_empty( &cond ) ) {
     
    8686//------------------------------------------------------------------------------
    8787void barge_op( global_data_t * mutex a ) {
    88         a->last_thread = this_thread();
     88        a->last_thread = this_thread;
    8989}
    9090
  • src/tests/sched-int-disjoint.c

    rfea3faa rb826e6b  
    55
    66#ifndef N
    7 #define N 100_000
     7#define N 10_000
    88#endif
    99
     
    4242
    4343void main( Barger * this ) {
    44         while( !all_done ) { 
     44        while( !all_done ) {
    4545                barge( &data );
    46                 yield(); 
     46                yield();
    4747        }
    4848}
     
    5353        wait( &cond );
    5454        if( d->state != SIGNAL ) {
    55                 sout | "ERROR barging!" | endl; 
     55                sout | "ERROR barging!" | endl;
    5656        }
    5757
     
    8585        bool running = data.counter < N && data.counter > 0;
    8686        if( data.state != SIGNAL && running ) {
    87                 sout | "ERROR Eager signal" | data.state | endl; 
     87                sout | "ERROR Eager signal" | data.state | endl;
    8888        }
    8989}
     
    9292
    9393void main( Signaller * this ) {
    94         while( !all_done ) { 
     94        while( !all_done ) {
    9595                logic( &mut );
    96                 yield(); 
     96                yield();
    9797        }
    9898}
     
    111111                sout | "All waiter done" | endl;
    112112                all_done = true;
    113         }       
     113        }
    114114}
  • src/tests/sched-int-wait.c

    rfea3faa rb826e6b  
    5050                unsigned action = (unsigned)rand48() % 4;
    5151                switch( action ) {
    52                         case 0: 
     52                        case 0:
    5353                                signal( &condABC, &globalA, &globalB, &globalC );
    5454                                break;
    55                         case 1: 
     55                        case 1:
    5656                                signal( &condAB , &globalA, &globalB );
    5757                                break;
    58                         case 2: 
     58                        case 2:
    5959                                signal( &condBC , &globalB, &globalC );
    6060                                break;
    61                         case 3: 
     61                        case 3:
    6262                                signal( &condAC , &globalA, &globalC );
    6363                                break;
     
    6767                }
    6868                yield();
    69         }       
     69        }
    7070}
    7171
  • src/tests/test.py

    rfea3faa rb826e6b  
    161161
    162162        # remove any outputs from the previous tests to prevent side effects
    163         rm( (out_file, test.name), dry_run )
     163        rm( (out_file, err_file, test.name), dry_run )
    164164
    165165        options = "-debug" if debug else "-nodebug"
    166166
    167167        # build, skipping to next test on error
    168         make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
     168        make_ret, _ = sh("""%s test=yes DEBUG_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
    169169
    170170        retcode = 0
     
    202202                        error = myfile.read()
    203203
    204                
     204
    205205        # clean the executable
    206206        sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
     
    221221                if   retcode == TestResult.SUCCESS:     result_txt = "Done"
    222222                elif retcode == TestResult.TIMEOUT:     result_txt = "TIMEOUT"
    223                 else :                                          result_txt = "ERROR"
     223                else :                                          result_txt = "ERROR code %d" % retcode
    224224        else :
    225225                if   retcode == TestResult.SUCCESS:     result_txt = "PASSED"
    226226                elif retcode == TestResult.TIMEOUT:     result_txt = "TIMEOUT"
    227                 else :                                          result_txt = "FAILED"
     227                else :                                          result_txt = "FAILED with code %d" % retcode
    228228
    229229        #print result with error if needed
  • src/tests/thread.c

    rfea3faa rb826e6b  
    44#include <thread>
    55
    6 // thread First;
    7 // void main(First* this);
     6thread First  { semaphore* lock; };
     7thread Second { semaphore* lock; };
    88
    9 // thread Second;
    10 // void main(Second* this);
    11 
    12 thread First  { signal_once* lock; };
    13 thread Second { signal_once* lock; };
    14 
    15 void ?{}( First * this, signal_once* lock ) { this->lock = lock; }
    16 void ?{}( Second * this, signal_once* lock ) { this->lock = lock; }
     9void ?{}( First * this, semaphore* lock ) { this->lock = lock; }
     10void ?{}( Second * this, semaphore* lock ) { this->lock = lock; }
    1711
    1812void main(First* this) {
     
    2115                yield();
    2216        }
    23         signal(this->lock);
     17        V(this->lock);
    2418}
    2519
    2620void main(Second* this) {
    27         wait(this->lock);
     21        P(this->lock);
    2822        for(int i = 0; i < 10; i++) {
    2923                sout | "Second : Suspend No." | i + 1 | endl;
     
    3428
    3529int main(int argc, char* argv[]) {
    36         signal_once lock;
     30        semaphore lock = { 0 };
    3731        sout | "User main begin" | endl;
    3832        {
Note: See TracChangeset for help on using the changeset viewer.