Ignore:
Timestamp:
May 29, 2018, 3:26:31 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
3530f39a
Parents:
96812c0 (diff), da60c631 (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:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Keywords.cc

    r96812c0 r054514d  
    191191                void postvisit(   StructDecl * decl );
    192192
    193                 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
     193                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl*, bool & first );
    194194                void validate( DeclarationWithType * );
    195195                void addDtorStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
     
    441441        void MutexKeyword::postvisit(FunctionDecl* decl) {
    442442
    443                 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
     443                bool first = false;
     444                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl, first );
    444445                if( mutexArgs.empty() ) return;
    445446
    446                 if( CodeGen::isConstructor(decl->name) ) SemanticError( decl, "constructors cannot have mutex parameters" );
     447                if( CodeGen::isConstructor(decl->name) && first ) SemanticError( decl, "constructors cannot have mutex parameters" );
    447448
    448449                bool isDtor = CodeGen::isDestructor( decl->name );
     
    484485        }
    485486
    486         std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl ) {
     487        std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl, bool & first ) {
    487488                std::list<DeclarationWithType*> mutexArgs;
    488489
     490                bool once = true;
    489491                for( auto arg : decl->get_functionType()->get_parameters()) {
    490492                        //Find mutex arguments
    491493                        Type* ty = arg->get_type();
    492494                        if( ! ty->get_mutex() ) continue;
     495
     496                        if(once) {first = true;}
     497                        once = false;
    493498
    494499                        //Append it to the list
Note: See TracChangeset for help on using the changeset viewer.