Changeset 154fdc8 for src


Ignore:
Timestamp:
Apr 19, 2017, 10:15:45 AM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
cd348e7
Parents:
221c2de7 (diff), de4ce0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/LabelGenerator.cc

    r221c2de7 r154fdc8  
    2020#include "SynTree/Label.h"
    2121#include "SynTree/Attribute.h"
     22#include "SynTree/Statement.h"
    2223
    2324namespace ControlStruct {
     
    3132        }
    3233
    33         Label LabelGenerator::newLabel( std::string suffix ) {
     34        Label LabelGenerator::newLabel( std::string suffix, Statement * stmt ) {
    3435                std::ostringstream os;
    3536                os << "__L" << current++ << "__" << suffix;
     37                if ( stmt && ! stmt->get_labels().empty() ) {
     38                        os << "_" << stmt->get_labels().front() << "__";
     39                }
    3640                std::string ret = os.str();
    3741                Label l( ret );
  • src/ControlStruct/LabelGenerator.h

    r221c2de7 r154fdc8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelGenerator.h -- 
     7// LabelGenerator.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2424          public:
    2525                static LabelGenerator *getGenerator();
    26                 Label newLabel(std::string suffix = "");
     26                Label newLabel(std::string suffix, Statement * stmt = nullptr);
    2727                void reset() { current = 0; }
    2828                void rewind() { current--; }
  • src/ControlStruct/MLEMutator.cc

    r221c2de7 r154fdc8  
    5656                bool labeledBlock = !(cmpndStmt->get_labels().empty());
    5757                if ( labeledBlock ) {
    58                         Label brkLabel = generator->newLabel("blockBreak");
     58                        Label brkLabel = generator->newLabel("blockBreak", cmpndStmt);
    5959                        enclosingControlStructures.push_back( Entry( cmpndStmt, brkLabel ) );
    6060                } // if
     
    8080                // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested
    8181                // loops
    82                 Label brkLabel = generator->newLabel("loopBreak");
    83                 Label contLabel = generator->newLabel("loopContinue");
     82                Label brkLabel = generator->newLabel("loopBreak", loopStmt);
     83                Label contLabel = generator->newLabel("loopContinue", loopStmt);
    8484                enclosingControlStructures.push_back( Entry( loopStmt, brkLabel, contLabel ) );
    8585                loopStmt->set_body ( loopStmt->get_body()->acceptMutator( *this ) );
    8686
     87                assert( ! enclosingControlStructures.empty() );
    8788                Entry &e = enclosingControlStructures.back();
    8889                // sanity check that the enclosing loops have been popped correctly
     
    108109                bool labeledBlock = !(ifStmt->get_labels().empty());
    109110                if ( labeledBlock ) {
    110                         Label brkLabel = generator->newLabel("blockBreak");
     111                        Label brkLabel = generator->newLabel("blockBreak", ifStmt);
    111112                        enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) );
    112113                } // if
    113114
    114115                Parent::mutate( ifStmt );
    115                
     116
    116117                if ( labeledBlock ) {
    117118                        if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
     
    126127        Statement *MLEMutator::handleSwitchStmt( SwitchClass *switchStmt ) {
    127128                // generate a label for breaking out of a labeled switch
    128                 Label brkLabel = generator->newLabel("switchBreak");
     129                Label brkLabel = generator->newLabel("switchBreak", switchStmt);
    129130                enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) );
    130131                mutateAll( switchStmt->get_statements(), *this );
     
    158159
    159160                std::list< Entry >::reverse_iterator targetEntry;
    160                 if ( branchStmt->get_type() == BranchStmt::Goto ) {
    161                         return branchStmt;
    162                 } else if ( branchStmt->get_type() == BranchStmt::Continue) {
    163                         // continue target must be a loop
    164                         if ( branchStmt->get_target() == "" ) {
    165                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } );
    166                         } else {
    167                                 // labelled continue - lookup label in table ot find attached control structure
    168                                 targetEntry = std::find( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), (*targetTable)[branchStmt->get_target()] );
    169                         } // if
    170                         if ( targetEntry == enclosingControlStructures.rend() || ! isLoop( targetEntry->get_controlStructure() ) ) {
    171                                 throw SemanticError( "'continue' target must be an enclosing loop: " + originalTarget );
    172                         } // if
    173                 } else if ( branchStmt->get_type() == BranchStmt::Break ) {
    174                         if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" );
    175                         targetEntry = enclosingControlStructures.rbegin();
    176                 } else {
    177                         assert( false );
    178                 } // if
    179 
    180                 if ( branchStmt->get_target() != "" && targetTable->find( branchStmt->get_target() ) == targetTable->end() ) {
    181                         throw SemanticError("The label defined in the exit loop statement does not exist: " + originalTarget );  // shouldn't happen (since that's already checked)
    182                 } // if
     161                switch ( branchStmt->get_type() ) {
     162                        case BranchStmt::Goto:
     163                                return branchStmt;
     164                        case BranchStmt::Continue:
     165                        case BranchStmt::Break: {
     166                                bool isContinue = branchStmt->get_type() == BranchStmt::Continue;
     167                                // unlabeled break/continue
     168                                if ( branchStmt->get_target() == "" ) {
     169                                        if ( isContinue ) {
     170                                                // continue target is outermost loop
     171                                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } );
     172                                        } else {
     173                                                // break target is outmost control structure
     174                                                if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" );
     175                                                targetEntry = enclosingControlStructures.rbegin();
     176                                        } // if
     177                                } else {
     178                                        // labeled break/continue - lookup label in table to find attached control structure
     179                                        targetEntry = std::find( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), (*targetTable)[branchStmt->get_target()] );
     180                                } // if
     181                                // ensure that selected target is valid
     182                                if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isLoop( targetEntry->get_controlStructure() ) ) ) {
     183                                        throw SemanticError( toString( (isContinue ? "'continue'" : "'break'"), " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), originalTarget ) );
     184                                } // if
     185                                break;
     186                        }
     187                        default:
     188                                assert( false );
     189                } // switch
    183190
    184191                // branch error checks, get the appropriate label name and create a goto
     
    197204                } // switch
    198205
    199                 if ( branchStmt->get_target() == "" && branchStmt->get_type() != BranchStmt::Continue ) {
    200                         // unlabelled break/continue - can keep branch as break/continue for extra semantic information, but add
    201                         // exitLabel as its destination so that label passes can easily determine where the break/continue goes to
    202                         branchStmt->set_target( exitLabel );
    203                         return branchStmt;
    204                 } else {
    205                         // labelled break/continue - can't easily emulate this with break and continue, so transform into a goto
    206                         delete branchStmt;
    207                         return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto );
    208                 } // if
     206                // transform break/continue statements into goto to simplify later handling of branches
     207                delete branchStmt;
     208                return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto );
    209209        }
    210210
  • src/GenPoly/Box.cc

    r221c2de7 r154fdc8  
    3434#include "Parser/ParseNode.h"
    3535
     36#include "SynTree/Attribute.h"
    3637#include "SynTree/Constant.h"
    3738#include "SynTree/Declaration.h"
     
    165166                        using Parent::mutate;
    166167
     168                        PolyGenericCalculator();
     169
    167170                        template< typename DeclClass >
    168171                        DeclClass *handleDecl( DeclClass *decl, Type *type );
     
    198201                        ScopedSet< std::string > knownLayouts;          ///< Set of generic type layouts known in the current scope, indexed by sizeofName
    199202                        ScopedSet< std::string > knownOffsets;          ///< Set of non-generic types for which the offset array exists in the current scope, indexed by offsetofName
     203                        UniqueName bufNamer;                           ///< Namer for VLA buffers
    200204                };
    201205
     
    14521456////////////////////////////////////////// PolyGenericCalculator ////////////////////////////////////////////////////
    14531457
     1458                PolyGenericCalculator::PolyGenericCalculator()
     1459                        : Parent(), knownLayouts(), knownOffsets(), bufNamer( "_buf" ) {}
     1460
    14541461                void PolyGenericCalculator::beginTypeScope( Type *ty ) {
    14551462                        scopeTyVars.beginScope();
     
    15281535                        if ( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl *>( declStmt->get_decl() ) ) {
    15291536                                if ( findGeneric( objectDecl->get_type() ) ) {
    1530                                         // change initialization of a polymorphic value object
    1531                                         // to allocate storage with alloca
     1537                                        // change initialization of a polymorphic value object to allocate via a VLA
     1538                                        // (alloca was previously used, but can't be safely used in loops)
    15321539                                        Type *declType = objectDecl->get_type();
    1533                                         UntypedExpr *alloc = new UntypedExpr( new NameExpr( "__builtin_alloca" ) );
    1534                                         alloc->get_args().push_back( new NameExpr( sizeofName( mangleType( declType ) ) ) );
     1540                                        std::string bufName = bufNamer.newName();
     1541                                        ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0,
     1542                                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ),
     1543                                                true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 );
     1544                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) );
    15351545
    15361546                                        delete objectDecl->get_init();
    15371547
    1538                                         std::list<Expression*> designators;
    1539                                         objectDecl->set_init( new SingleInit( alloc, designators, false ) ); // not constructed
     1548                                        objectDecl->set_init( new SingleInit( new NameExpr( bufName ) ) );
    15401549                                }
    15411550                        }
  • src/Parser/ParseNode.h

    r221c2de7 r154fdc8  
    107107  public:
    108108        ExpressionNode( Expression * expr = nullptr ) : expr( expr ) {}
    109         ExpressionNode( const ExpressionNode &other );
    110109        virtual ~ExpressionNode() {}
    111         virtual ExpressionNode * clone() const override { return expr ? new ExpressionNode( expr->clone() ) : nullptr; }
     110        virtual ExpressionNode * clone() const override { return expr ? static_cast<ExpressionNode*>((new ExpressionNode( expr->clone() ))->set_next( maybeClone( get_next() ) )) : nullptr; }
    112111
    113112        bool get_extension() const { return extension; }
  • src/ResolvExpr/AlternativeFinder.cc

    r221c2de7 r154fdc8  
    211211        }
    212212
    213         // std::unordered_map< Expression *, UniqueExpr * > ;
     213        void AlternativeFinder::addAnonConversions( const Alternative & alt ) {
     214                // adds anonymous member interpretations whenever an aggregate value type is seen.
     215                Expression * expr = alt.expr->clone();
     216                std::unique_ptr< Expression > manager( expr ); // RAII for expr
     217                alt.env.apply( expr->get_result() );
     218                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( expr->get_result() ) ) {
     219                        NameExpr nameExpr( "" );
     220                        addAggMembers( structInst, expr, alt.cost+Cost( 0, 0, 1 ), alt.env, &nameExpr );
     221                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( expr->get_result() ) ) {
     222                        NameExpr nameExpr( "" );
     223                        addAggMembers( unionInst, expr, alt.cost+Cost( 0, 0, 1 ), alt.env, &nameExpr );
     224                } // if
     225        }
    214226
    215227        template< typename StructOrUnionType >
     
    220232                std::list< Declaration* > members;
    221233                aggInst->lookup( name, members );
     234
    222235                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    223236                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
    224237                                alternatives.push_back( Alternative( new MemberExpr( dwt, expr->clone() ), env, newCost ) );
    225238                                renameTypes( alternatives.back().expr );
     239                                addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression.
    226240                        } else {
    227241                                assert( false );
     
    730744                if ( candidates.empty() && ! errors.isEmpty() ) { throw errors; }
    731745
     746                // compute conversionsion costs
    732747                for ( AltList::iterator withFunc = candidates.begin(); withFunc != candidates.end(); ++withFunc ) {
    733748                        Cost cvtCost = computeConversionCost( *withFunc, indexer );
     
    751766                        } // if
    752767                } // for
     768                // function may return struct or union value, in which case we need to add alternatives for implicit conversions to each of the anonymous members
     769                for ( const Alternative & alt : alternatives ) {
     770                        addAnonConversions( alt );
     771                }
     772
    753773                candidates.clear();
    754774                candidates.splice( candidates.end(), alternatives );
     
    885905                        )
    886906                        renameTypes( alternatives.back().expr );
    887                         if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
    888                                 NameExpr nameExpr( "" );
    889                                 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
    890                         } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
    891                                 NameExpr nameExpr( "" );
    892                                 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
    893                         } // if
     907                        addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression.
    894908                } // for
    895909        }
  • src/ResolvExpr/AlternativeFinder.h

    r221c2de7 r154fdc8  
    7878                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7979
     80                /// Adds alternatives for anonymous members
     81                void addAnonConversions( const Alternative & alt );
    8082                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    8183                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
  • src/SymTab/Autogen.cc

    r221c2de7 r154fdc8  
    498498                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
    499499                if ( returnVal ) {
    500                         if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, back_inserter( funcDecl->get_statements()->get_kids() ) );
    501                         else funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
     500                        funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    502501                }
    503502        }
  • src/SymTab/Validate.cc

    r221c2de7 r154fdc8  
    208208        };
    209209
     210        class ArrayLength : public Visitor {
     211        public:
     212                /// for array types without an explicit length, compute the length and store it so that it
     213                /// is known to the rest of the phases. For example,
     214                ///   int x[] = { 1, 2, 3 };
     215                ///   int y[][2] = { { 1, 2, 3 }, { 1, 2, 3 } };
     216                /// here x and y are known at compile-time to have length 3, so change this into
     217                ///   int x[3] = { 1, 2, 3 };
     218                ///   int y[3][2] = { { 1, 2, 3 }, { 1, 2, 3 } };
     219                static void computeLength( std::list< Declaration * > & translationUnit );
     220
     221                virtual void visit( ObjectDecl * objDecl );
     222        };
     223
    210224        class CompoundLiteral final : public GenPoly::DeclMutator {
    211225                Type::StorageClasses storageClasses;
     
    235249                acceptAll( translationUnit, pass3 );
    236250                VerifyCtorDtorAssign::verify( translationUnit );
     251                ArrayLength::computeLength( translationUnit );
    237252        }
    238253
     
    869884                }
    870885        }
     886
     887        void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) {
     888                ArrayLength len;
     889                acceptAll( translationUnit, len );
     890        }
     891
     892        void ArrayLength::visit( ObjectDecl * objDecl ) {
     893                if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
     894                        if ( at->get_dimension() != nullptr ) return;
     895                        if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->get_init() ) ) {
     896                                at->set_dimension( new ConstantExpr( Constant::from_ulong( init->get_initializers().size() ) ) );
     897                        }
     898                }
     899        }
    871900} // namespace SymTab
    872901
  • src/SynTree/Expression.cc

    r221c2de7 r154fdc8  
    339339                        return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() );
    340340                } else {
    341                         assertf( false, "makeSub expects struct or union type for aggregate" );
     341                        assertf( false, "makeSub expects struct or union type for aggregate, but got: %s", toString( t ).c_str() );
    342342                }
    343343        }
  • src/libcfa/Makefile.am

    r221c2de7 r154fdc8  
    4141CC = ${abs_top_srcdir}/src/driver/cfa
    4242
    43 headers = limits stdlib math iostream fstream iterator rational assert containers/vector
     43headers = limits stdlib math iostream fstream iterator rational assert containers/pair containers/vector
    4444
    4545# not all platforms support concurrency, add option do disable it
  • src/libcfa/Makefile.in

    r221c2de7 r154fdc8  
    9999am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    100100        libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \
    101         fstream.c iterator.c rational.c assert.c containers/vector.c \
    102         concurrency/coroutine.c concurrency/thread.c \
    103         concurrency/kernel.c concurrency/monitor.c \
    104         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     101        fstream.c iterator.c rational.c assert.c containers/pair.c \
     102        containers/vector.c concurrency/coroutine.c \
     103        concurrency/thread.c concurrency/kernel.c \
     104        concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     105        concurrency/invoke.c
    105106am__dirstamp = $(am__leading_dot)dirstamp
    106107@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    113114        libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \
    114115        libcfa_d_a-assert.$(OBJEXT) \
     116        containers/libcfa_d_a-pair.$(OBJEXT) \
    115117        containers/libcfa_d_a-vector.$(OBJEXT) $(am__objects_1)
    116118@BUILD_CONCURRENCY_TRUE@am__objects_3 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \
     
    126128am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    127129        libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \
    128         fstream.c iterator.c rational.c assert.c containers/vector.c \
    129         concurrency/coroutine.c concurrency/thread.c \
    130         concurrency/kernel.c concurrency/monitor.c \
    131         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     130        fstream.c iterator.c rational.c assert.c containers/pair.c \
     131        containers/vector.c concurrency/coroutine.c \
     132        concurrency/thread.c concurrency/kernel.c \
     133        concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     134        concurrency/invoke.c
    132135@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    133136@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    138141        libcfa_a-fstream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \
    139142        libcfa_a-rational.$(OBJEXT) libcfa_a-assert.$(OBJEXT) \
     143        containers/libcfa_a-pair.$(OBJEXT) \
    140144        containers/libcfa_a-vector.$(OBJEXT) $(am__objects_5)
    141145@BUILD_CONCURRENCY_TRUE@am__objects_7 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \
     
    176180        $(am__libcfa_a_SOURCES_DIST)
    177181am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \
    178         fstream iterator rational assert containers/vector \
    179         concurrency/coroutine concurrency/thread concurrency/kernel \
    180         concurrency/monitor ${shell echo stdhdr/*} \
     182        fstream iterator rational assert containers/pair \
     183        containers/vector concurrency/coroutine concurrency/thread \
     184        concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \
    181185        concurrency/invoke.h
    182186HEADERS = $(nobase_cfa_include_HEADERS)
     
    310314AM_CCASFLAGS = @CFA_FLAGS@
    311315headers = limits stdlib math iostream fstream iterator rational assert \
    312         containers/vector $(am__append_3)
     316        containers/pair containers/vector $(am__append_3)
    313317libobjs = ${headers:=.o}
    314318libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     
    400404        @$(MKDIR_P) containers/$(DEPDIR)
    401405        @: > containers/$(DEPDIR)/$(am__dirstamp)
     406containers/libcfa_d_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     407        containers/$(DEPDIR)/$(am__dirstamp)
    402408containers/libcfa_d_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
    403409        containers/$(DEPDIR)/$(am__dirstamp)
     
    428434libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \
    429435        libhdr/$(DEPDIR)/$(am__dirstamp)
     436containers/libcfa_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     437        containers/$(DEPDIR)/$(am__dirstamp)
    430438containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
    431439        containers/$(DEPDIR)/$(am__dirstamp)
     
    458466        -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
    459467        -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
     468        -rm -f containers/libcfa_a-pair.$(OBJEXT)
    460469        -rm -f containers/libcfa_a-vector.$(OBJEXT)
     470        -rm -f containers/libcfa_d_a-pair.$(OBJEXT)
    461471        -rm -f containers/libcfa_d_a-vector.$(OBJEXT)
    462472        -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT)
     
    497507@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@
    498508@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread.Po@am__quote@
     509@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-pair.Po@am__quote@
    499510@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@
     511@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-pair.Po@am__quote@
    500512@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@
    501513@AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@
     
    681693@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`
    682694
     695containers/libcfa_d_a-pair.o: containers/pair.c
     696@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     697@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po
     698@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.o' libtool=no @AMDEPBACKSLASH@
     699@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     700@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     701
     702containers/libcfa_d_a-pair.obj: containers/pair.c
     703@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     704@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po
     705@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.obj' libtool=no @AMDEPBACKSLASH@
     706@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     707@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     708
    683709containers/libcfa_d_a-vector.o: containers/vector.c
    684710@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-vector.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-vector.Tpo -c -o containers/libcfa_d_a-vector.o `test -f 'containers/vector.c' || echo '$(srcdir)/'`containers/vector.c
     
    904930@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    905931@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`
     932
     933containers/libcfa_a-pair.o: containers/pair.c
     934@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     935@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po
     936@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.o' libtool=no @AMDEPBACKSLASH@
     937@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     938@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     939
     940containers/libcfa_a-pair.obj: containers/pair.c
     941@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     942@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po
     943@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.obj' libtool=no @AMDEPBACKSLASH@
     944@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     945@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
    906946
    907947containers/libcfa_a-vector.o: containers/vector.c
  • src/libcfa/stdlib.c

    r221c2de7 r154fdc8  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr  1 18:31:26 2017
    13 // Update Count     : 181
     12// Last Modified On : Sun Apr 16 10:41:05 2017
     13// Update Count     : 189
    1414//
    1515
     
    7878} // posix_memalign
    7979
    80 forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } )
     80forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } )
    8181T * new( Params p ) {
    82         return ((T*)malloc()){ p };
     82        return ((T *)malloc()){ p };
    8383}
    8484
     
    229229forall( otype T | { int ?<?( T, T ); } )
    230230unsigned int bsearch( T key, const T * arr, size_t dimension ) {
    231         int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
    232         T *result = (T *)bsearch( &key, arr, dimension, sizeof(T), comp );
     231        T *result = bsearch( key, arr, dimension );
    233232        return result ? result - arr : dimension;                       // pointer subtraction includes sizeof(T)
    234233} // bsearch
  • src/prelude/prelude.cf

    r221c2de7 r154fdc8  
    217217signed int ?<?( _Bool, _Bool ),                                         ?<=?( _Bool, _Bool ),
    218218           ?>?( _Bool, _Bool ),                                         ?>=?( _Bool, _Bool );
     219signed int ?<?( char, char ),                           ?<=?( char, char ),
     220           ?>?( char, char ),                           ?>=?( char, char );
     221signed int ?<?( signed char, signed char ),                             ?<=?( signed char, signed char ),
     222           ?>?( signed char, signed char ),                             ?>=?( signed char, signed char );
    219223signed int ?<?( unsigned char, unsigned char ),                         ?<=?( unsigned char, unsigned char ),
    220224           ?>?( unsigned char, unsigned char ),                         ?>=?( unsigned char, unsigned char );
     225signed int ?<?( signed short, signed short ),                           ?<=?( signed short, signed short ),
     226           ?>?( signed short, signed short ),                           ?>=?( signed short, signed short );
     227signed int ?<?( unsigned short, unsigned short ),                       ?<=?( unsigned short, unsigned short ),
     228           ?>?( unsigned short, unsigned short ),                               ?>=?( unsigned short, unsigned short );
    221229signed int ?<?( signed int, signed int ),                               ?<=?( signed int, signed int ),
    222230           ?>?( signed int, signed int ),                               ?>=?( signed int, signed int );
     
    265273
    266274signed int ?==?( _Bool, _Bool ),                                                        ?!=?( _Bool, _Bool );
     275signed int ?==?( char, char ),                                                          ?!=?( char, char );
     276signed int ?==?( signed char, signed char ),                            ?!=?( signed char, signed char );
     277signed int ?==?( unsigned char, unsigned char ),                        ?!=?( unsigned char, unsigned char );
     278signed int ?==?( signed short, signed short ),                          ?!=?( signed short, signed short );
     279signed int ?==?( unsigned short, unsigned short ),                      ?!=?( unsigned short, unsigned short );
    267280signed int ?==?( signed int, signed int ),                                      ?!=?( signed int, signed int );
    268281signed int ?==?( unsigned int, unsigned int ),                                  ?!=?( unsigned int, unsigned int );
Note: See TracChangeset for help on using the changeset viewer.