Changes in / [add7117:f5e81d1]


Ignore:
Location:
src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    radd7117 rf5e81d1  
    3333#include "SymTab/Autogen.h"
    3434#include "GenPoly/PolyMutator.h"
    35 #include "GenPoly/DeclMutator.h"
    3635#include "SynTree/AddStmtVisitor.h"
    3736#include "CodeGen/GenType.h"  // for warnings
     
    217216                        SymTab::Indexer & indexer;
    218217                };
    219 
    220                 class FixCtorExprs : public GenPoly::DeclMutator {
    221                   public:
    222                         /// expands ConstructorExpr nodes into comma expressions, using a temporary for the first argument
    223                         static void fix( std::list< Declaration * > & translationUnit );
    224 
    225                         virtual Expression * mutate( ConstructorExpr * ctorExpr );
    226                 };
    227218        } // namespace
    228219
     
    230221                // fixes ConstructorInit for global variables. should happen before fixInitializers.
    231222                InitTweak::fixGlobalInit( translationUnit, filename, inLibrary );
    232 
    233223
    234224                InsertImplicitCalls::insert( translationUnit );
     
    241231
    242232                GenStructMemberCalls::generate( translationUnit );
    243                 // xxx - ctor expansion currently has to be after FixCopyCtors, because there is currently a
    244                 // hack in the way untyped assignments are generated, where the first argument cannot have
    245                 // its address taken because of the way codegeneration handles UntypedExpr vs. ApplicationExpr.
    246                 // Thus such assignment exprs must never pushed through expression resolution (and thus should
    247                 // not go through the FixCopyCtors pass), otherwise they will fail -- guaranteed.
    248                 // Also needs to happen after GenStructMemberCalls, since otherwise member constructors exprs
    249                 // don't look right, and a member can be constructed more than once.
    250                 FixCtorExprs::fix( translationUnit );
    251233        }
    252234
     
    301283                                throw warner.errors;
    302284                        }
    303                 }
    304 
    305                 void FixCtorExprs::fix( std::list< Declaration * > & translationUnit ) {
    306                         FixCtorExprs fixer;
    307                         fixer.mutateDeclarationList( translationUnit );
    308285                }
    309286
     
    503480                                        retExpr = deref;
    504481                                } // if
    505                                 retExpr->set_env( env->clone() );
     482                                // xxx - might need to set env on retExpr...
     483                                // retExpr->set_env( env->clone() );
    506484                                return retExpr;
    507485                        } else {
     
    936914                        return safe_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
    937915                }
    938 
    939                 Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    940                         static UniqueName tempNamer( "_tmp_ctor_expr" );
    941                         assert( ctorExpr->get_results().size() == 1 );
    942                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr );
    943                         addDeclaration( tmp );
    944 
    945                         ApplicationExpr * callExpr = safe_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
    946                         TypeSubstitution * env = ctorExpr->get_env();
    947                         ctorExpr->set_callExpr( nullptr );
    948                         ctorExpr->set_env( nullptr );
    949 
    950                         Expression *& firstArg = callExpr->get_args().front();
    951                         UntypedExpr * assign = new UntypedExpr( new NameExpr( "?=?" ) );
    952                         assign->get_args().push_back( new VariableExpr( tmp ) );
    953                         assign->get_args().push_back( firstArg );
    954                         cloneAll( ctorExpr->get_results(), assign->get_results() );
    955                         firstArg = assign;
    956 
    957                         CommaExpr * commaExpr = new CommaExpr( callExpr, new VariableExpr( tmp ) );
    958                         commaExpr->set_env( env );
    959                         delete ctorExpr;
    960                         return commaExpr;
    961                 }
    962916        } // namespace
    963917} // namespace InitTweak
  • src/InitTweak/InitTweak.cc

    radd7117 rf5e81d1  
    358358                template<typename CallExpr>
    359359                Expression *& callArg( CallExpr * callExpr, unsigned int pos ) {
    360                         if ( pos >= callExpr->get_args().size() ) assertf( false, "asking for argument that doesn't exist. Return NULL/throw exception?" );
     360                        if ( pos >= callExpr->get_args().size() ) assert( false && "asking for argument that doesn't exist. Return NULL/throw exception?" );
    361361                        for ( Expression *& arg : callExpr->get_args() ) {
    362362                                if ( pos == 0 ) return arg;
     
    373373                        return callArg( untypedExpr, pos );
    374374                } else {
    375                         assertf( false, "Unexpected expression type passed to getCallArg" );
     375                        assert( false && "Unexpected expression type passed to getCallArg" );
    376376                }
    377377        }
     
    388388                                return memberExpr->get_member()->get_name();
    389389                        } else {
    390                                 assertf( false, "Unexpected expression type being called as a function in call expression" );
     390                                assert( false && "Unexpected expression type being called as a function in call expression" );
    391391                        }
    392392                }
     
    400400                } else {
    401401                        std::cerr << expr << std::endl;
    402                         assertf( false, "Unexpected expression type passed to getFunctionName" );
     402                        assert( false && "Unexpected expression type passed to getFunctionName" );
    403403                }
    404404        }
  • src/Parser/DeclarationNode.cc

    radd7117 rf5e81d1  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  9 23:21:47 2016
    13 // Update Count     : 402
     12// Last Modified On : Mon Aug 29 22:30:56 2016
     13// Update Count     : 327
    1414//
    1515
     
    4343extern LinkageSpec::Spec linkage;                                               // defined in parser.yy
    4444
    45 DeclarationNode::DeclarationNode() :
    46                 type( 0 ),
    47                 storageClass( NoStorageClass ),
    48                 isInline( false ),
    49                 isNoreturn( false ),
    50                 bitfieldWidth( 0 ),
    51                 initializer( 0 ),
    52                 hasEllipsis( false ),
    53                 linkage( ::linkage ),
    54                 extension( false ) {
     45DeclarationNode::DeclarationNode()
     46                : type( 0 )
     47                , storageClass( NoStorageClass )
     48                , isInline( false )
     49                , isNoreturn( false )
     50                , bitfieldWidth( 0 )
     51                , initializer( 0 )
     52                , hasEllipsis( false )
     53                , linkage( ::linkage )
     54                , extension( false )
     55                , error() {
     56        attr.expr = nullptr;
     57        attr.type = nullptr;
     58
    5559        variable.tyClass = DeclarationNode::Type;
    5660        variable.assertions = nullptr;
    57 
    58         attr.expr = nullptr;
    59         attr.type = nullptr;
    6061}
    6162
     
    392393
    393394        if ( (qsrc & qdst).any() ) {                                            // common bits between qualifier masks ?
    394                 for ( int i = 0; i < NoOfQualifier; i += 1 ) {  // find common qualifiers
    395                         if ( qsrc[i] & qdst[i] ) {
    396                                 error += string(error.empty() ? "" : ", ") + "duplicate " + DeclarationNode::qualifierName[i];
     395                error = "duplicate qualifier ";
     396                int j = 0;                                                                              // separator detector
     397                for ( int i = 0; i < DeclarationNode::NoOfQualifier; i += 1 ) {
     398                        if ( qsrc[i] & qdst[i] ) {                                      // find specific qualifiers in common
     399                                if ( j > 0 ) error += ", ";
     400                                error += DeclarationNode::qualifierName[i];
     401                                j += 1;
    397402                        } // if
    398403                } // for
     404                error += " in declaration of ";
    399405        } // if
    400406} // DeclarationNode::checkQualifiers
     
    436442                storageClass = q->storageClass;
    437443        } else if ( q->storageClass != NoStorageClass ) {
    438                 if ( storageClass == q->storageClass ) {
    439                         q->error += string( "duplicate " ) + storageName[ storageClass ];
    440                 } else {                                                                                // can only have one storage class
    441                         q->error += string( "multiple " ) + storageName[ storageClass ] + " & " + storageName[ q->storageClass ];
    442                 } // if
    443         } // if
    444         if ( ! q->error.empty() ) {
    445                 error += (! error.empty() ? ", " : "") + q->error;
    446         } // if
    447         return this;
    448 } // DeclarationNode::copyStorageClasses
     444                q->error = "invalid combination of storage classes in declaration of ";
     445        } // if
     446        if ( error.empty() ) error = q->error;
     447        return this;
     448}
    449449
    450450static void addTypeToType( TypeData *&src, TypeData *&dst ) {
     
    908908
    909909Declaration *DeclarationNode::build() const {
    910         if ( ! error.empty() ) throw SemanticError( error + " in declaration of ", this );
     910        if ( ! error.empty() ) throw SemanticError( error, this );
    911911        if ( type ) {
    912912                if ( type->kind == TypeData::Variable ) {
     
    922922                return (new ObjectDecl( name, storageClass, linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ))->set_extension( extension );
    923923        } // if
    924         throw SemanticError( "invalid function specifier ", this );
     924        throw SemanticError( "invalid function specifier in declaration of ", this );
    925925}
    926926
     
    971971}
    972972
     973// DeclarationNode::StorageClass DeclarationNode::buildStorageClass() const {
     974//      DeclarationNode::StorageClass ret = DeclarationNode::NoStorageClass;
     975//      for ( std::list< DeclarationNode::StorageClass >::const_iterator i = storageClasses.begin(); i != storageClasses.end(); ++i ) {
     976//        if ( *i == DeclarationNode::Inline || *i == DeclarationNode::Noreturn ) continue; // ignore function specifiers
     977//        if ( ret != DeclarationNode::NoStorageClass ) {       // already have a valid storage class ?
     978//                      throw SemanticError( "invalid combination of storage classes in declaration of ", this );
     979//              } // if
     980//              ret = *i;
     981//      } // for
     982//      return ret;
     983// }
     984
     985// bool DeclarationNode::buildFuncSpecifier( DeclarationNode::StorageClass key ) const {
     986//      std::list< DeclarationNode::StorageClass >::const_iterator first = std::find( storageClasses.begin(), storageClasses.end(), key );
     987//   if ( first == storageClasses.end() ) return false; // not found
     988//      first = std::find( ++first, storageClasses.end(), key ); // found
     989//   if ( first == storageClasses.end() ) return true;          // not found again
     990//      throw SemanticError( "duplicate function specifier in declaration of ", this );
     991// }
     992
    973993// Local Variables: //
    974994// tab-width: 4 //
  • src/Parser/ParseNode.h

    radd7117 rf5e81d1  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep  8 21:58:06 2016
    13 // Update Count     : 587
     12// Last Modified On : Mon Aug 29 21:45:43 2016
     13// Update Count     : 583
    1414//
    1515
     
    290290        // bool buildFuncSpecifier( StorageClass key ) const;
    291291
     292        struct Enumeration_t {
     293                std::string name;
     294                DeclarationNode * constants;
     295        };
     296        Enumeration_t enumeration;
     297
    292298        struct Variable_t {
    293299                DeclarationNode::TypeClass tyClass;
     
    402408                        if ( result ) {
    403409                                *out++ = result;
     410                        } else {
    404411                        } // if
    405412                } catch( SemanticError &e ) {
  • src/Parser/TypeData.h

    radd7117 rf5e81d1  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  9 23:20:55 2016
    13 // Update Count     : 117
     12// Last Modified On : Mon Aug 29 22:31:52 2016
     13// Update Count     : 110
    1414//
    1515
     
    9696                Array_t array;
    9797                Enumeration_t enumeration;
    98                 // Variable_t variable;
    9998                Function_t function;
    10099                Symbolic_t symbolic;
    101100                DeclarationNode * tuple;
    102101                ExpressionNode * typeexpr;
    103                 // Attr_t attr;
     102                //Attr_t attr;
    104103                // DeclarationNode::BuiltinType builtin;
    105104
  • src/Parser/parser.cc

    radd7117 rf5e81d1  
    51255125    {
    51265126                        Token fn;
    5127                         fn.str = new std::string( "?{}" ); // location undefined - use location of '{'?
    5128                         (yyval.en) = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( (yyvsp[(1) - (4)].en) )->set_last( (yyvsp[(3) - (4)].en) ) ) ) );
     5127                        fn.str = new std::string( "?{}" ); // location undefined
     5128                        (yyval.en) = new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( (yyvsp[(1) - (4)].en) )->set_last( (yyvsp[(3) - (4)].en) ) ) );
    51295129                }
    51305130    break;
  • src/Parser/parser.yy

    radd7117 rf5e81d1  
    391391                {
    392392                        Token fn;
    393                         fn.str = new std::string( "?{}" ); // location undefined - use location of '{'?
    394                         $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
     393                        fn.str = new std::string( "?{}" ); // location undefined
     394                        $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) );
    395395                }
    396396        ;
  • src/ResolvExpr/AlternativeFinder.cc

    radd7117 rf5e81d1  
    209209        }
    210210
    211         void AlternativeFinder::find( Expression *expr, bool adjust, bool prune ) {
     211        void AlternativeFinder::find( Expression *expr, bool adjust ) {
    212212                expr->accept( *this );
    213213                if ( alternatives.empty() ) {
     
    219219                        }
    220220                }
    221                 if ( prune ) {
    222                         PRINT(
    223                                 std::cerr << "alternatives before prune:" << std::endl;
    224                                 printAlts( alternatives, std::cerr );
    225                         )
    226                         AltList::iterator oldBegin = alternatives.begin();
    227                         pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ), indexer );
    228                         if ( alternatives.begin() == oldBegin ) {
    229                                 std::ostringstream stream;
    230                                 stream << "Can't choose between alternatives for expression ";
    231                                 expr->print( stream );
    232                                 stream << "Alternatives are:";
    233                                 AltList winners;
    234                                 findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) );
    235                                 printAlts( winners, stream, 8 );
    236                                 throw SemanticError( stream.str() );
    237                         }
    238                         alternatives.erase( oldBegin, alternatives.end() );
    239                         PRINT(
    240                                 std::cerr << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
    241                         )
    242                 }
     221                PRINT(
     222                        std::cerr << "alternatives before prune:" << std::endl;
     223                        printAlts( alternatives, std::cerr );
     224                )
     225                AltList::iterator oldBegin = alternatives.begin();
     226                pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ), indexer );
     227                if ( alternatives.begin() == oldBegin ) {
     228                        std::ostringstream stream;
     229                        stream << "Can't choose between alternatives for expression ";
     230                        expr->print( stream );
     231                        stream << "Alternatives are:";
     232                        AltList winners;
     233                        findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) );
     234                        printAlts( winners, stream, 8 );
     235                        throw SemanticError( stream.str() );
     236                }
     237                alternatives.erase( oldBegin, alternatives.end() );
     238                PRINT(
     239                        std::cerr << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
     240                )
    243241
    244242                // Central location to handle gcc extension keyword for all expression types.
     
    248246        }
    249247
    250         void AlternativeFinder::findWithAdjustment( Expression *expr, bool prune ) {
    251                 find( expr, true, prune );
     248        void AlternativeFinder::findWithAdjustment( Expression *expr ) {
     249                find( expr, true );
    252250        }
    253251
    254252        template< typename StructOrUnionType >
    255         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     253        void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, Expression * member ) {
    256254                NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member );
    257255                const std::string & name = nameExpr->get_name();
     256
    258257                std::list< Declaration* > members;
    259258                aggInst->lookup( name, members );
     
    814813                        if ( agg->expr->get_results().size() == 1 ) {
    815814                                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_results().front() ) ) {
    816                                         addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     815                                        addAggMembers( structInst, agg->expr, agg->cost, memberExpr->get_member() );
    817816                                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_results().front() ) ) {
    818                                         addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     817                                        addAggMembers( unionInst, agg->expr, agg->cost, memberExpr->get_member() );
    819818                                } // if
    820819                        } // if
     
    844843                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
    845844                                NameExpr nameExpr( "" );
    846                                 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     845                                addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), &nameExpr );
    847846                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
    848847                                NameExpr nameExpr( "" );
    849                                 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     848                                addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), &nameExpr );
    850849                        } // if
    851850                } // for
     
    10681067                alternatives.push_back( Alternative( impCpCtorExpr->clone(), env, Cost::zero ) );
    10691068        }
    1070 
    1071         void AlternativeFinder::visit( ConstructorExpr * ctorExpr ) {
    1072                 AlternativeFinder finder( indexer, env );
    1073                 // don't prune here, since it's guaranteed all alternatives will have the same type
    1074                 // (giving the alternatives different types is half of the point of ConstructorExpr nodes)
    1075                 finder.findWithAdjustment( ctorExpr->get_callExpr(), false );
    1076                 for ( Alternative & alt : finder.alternatives ) {
    1077                         alternatives.push_back( Alternative( new ConstructorExpr( alt.expr->clone() ), alt.env, alt.cost ) );
    1078                 }
    1079         }
    10801069} // namespace ResolvExpr
    10811070
  • src/ResolvExpr/AlternativeFinder.h

    radd7117 rf5e81d1  
    2929          public:
    3030                AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
    31                 void find( Expression *expr, bool adjust = false, bool prune = true );
     31                void find( Expression *expr, bool adjust = false );
    3232                /// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types
    33                 void findWithAdjustment( Expression *expr, bool prune = true );
     33                void findWithAdjustment( Expression *expr );
    3434                AltList &get_alternatives() { return alternatives; }
    3535
     
    6666                virtual void visit( TupleExpr *tupleExpr );
    6767                virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    68                 virtual void visit( ConstructorExpr * ctorExpr );
    6968          public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
    7069          /// Runs a new alternative finder on each element in [begin, end)
     
    7574          private:
    7675                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    77                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     76                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, Expression * member );
    7877                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    7978                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
  • src/SymTab/Validate.cc

    radd7117 rf5e81d1  
    6060#include "ResolvExpr/typeops.h"
    6161#include <algorithm>
    62 #include "InitTweak/InitTweak.h"
    6362
    6463#define debugPrint( x ) if ( doDebug ) { std::cout << x; }
     
    172171        };
    173172
    174         class VerifyCtorDtorAssign : public Visitor {
     173        class VerifyCtorDtor : public Visitor {
    175174        public:
    176                 /// ensure that constructors, destructors, and assignment have at least one
    177                 /// parameter, the first of which must be a pointer, and that ctor/dtors have no
     175                /// ensure that constructors and destructors have at least one
     176                /// parameter, the first of which must be a pointer, and no
    178177                /// return values.
    179178                static void verify( std::list< Declaration * > &translationUnit );
     
    203202                compoundliteral.mutateDeclarationList( translationUnit );
    204203                acceptAll( translationUnit, pass3 );
    205                 VerifyCtorDtorAssign::verify( translationUnit );
     204                VerifyCtorDtor::verify( translationUnit );
    206205        }
    207206
     
    688687        }
    689688
    690         void VerifyCtorDtorAssign::verify( std::list< Declaration * > & translationUnit ) {
    691                 VerifyCtorDtorAssign verifier;
     689        void VerifyCtorDtor::verify( std::list< Declaration * > & translationUnit ) {
     690                VerifyCtorDtor verifier;
    692691                acceptAll( translationUnit, verifier );
    693692        }
    694693
    695         void VerifyCtorDtorAssign::visit( FunctionDecl * funcDecl ) {
     694        void VerifyCtorDtor::visit( FunctionDecl * funcDecl ) {
    696695                FunctionType * funcType = funcDecl->get_functionType();
    697696                std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals();
    698697                std::list< DeclarationWithType * > &params = funcType->get_parameters();
    699698
    700                 if ( InitTweak::isCtorDtorAssign( funcDecl->get_name() ) ) {
     699                if ( funcDecl->get_name() == "?{}" || funcDecl->get_name() == "^?{}" ) {
    701700                        if ( params.size() == 0 ) {
    702                                 throw SemanticError( "Constructors, destructors, and assignment functions require at least one parameter ", funcDecl );
     701                                throw SemanticError( "Constructors and destructors require at least one parameter ", funcDecl );
    703702                        }
    704703                        if ( ! dynamic_cast< PointerType * >( params.front()->get_type() ) ) {
    705                                 throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a pointer ", funcDecl );
     704                                throw SemanticError( "First parameter of a constructor or destructor must be a pointer ", funcDecl );
    706705                        }
    707                         if ( InitTweak::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
     706                        if ( returnVals.size() != 0 ) {
    708707                                throw SemanticError( "Constructors and destructors cannot have explicit return values ", funcDecl );
    709708                        }
  • src/SynTree/Expression.cc

    radd7117 rf5e81d1  
    2828#include "TypeSubstitution.h"
    2929#include "Common/utility.h"
    30 #include "InitTweak/InitTweak.h"
    3130
    3231
     
    497496
    498497void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
    499         os << "Implicit Copy Constructor Expression: " << std::endl;
     498        os << std::string( indent, ' ' ) << "Implicit Copy Constructor Expression: " << std::endl;
    500499        assert( callExpr );
    501500        callExpr->print( os, indent + 2 );
     
    507506}
    508507
    509 
    510 ConstructorExpr::ConstructorExpr( Expression * callExpr ) : callExpr( callExpr ) {
    511         // allow resolver to type a constructor used as an expression as if it has the same type as its first argument
    512         assert( callExpr );
    513         Expression * arg = InitTweak::getCallArg( callExpr, 0 );
    514         assert( arg );
    515         cloneAll( arg->get_results(), results );
    516 }
    517 
    518 ConstructorExpr::ConstructorExpr( const ConstructorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
    519 }
    520 
    521 ConstructorExpr::~ConstructorExpr() {
    522         delete callExpr;
    523 }
    524 
    525 void ConstructorExpr::print( std::ostream &os, int indent ) const {
    526         os <<  "Constructor Expression: " << std::endl;
    527         assert( callExpr );
    528         os << std::string( indent+2, ' ' );
    529         callExpr->print( os, indent + 2 );
    530         Expression::print( os, indent );
     508UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
     509
     510UntypedValofExpr::~UntypedValofExpr() { delete body; }
     511
     512void UntypedValofExpr::print( std::ostream &os, int indent ) const {
     513        os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl;
     514        if ( get_body() != 0 )
     515                get_body()->print( os, indent + 2 );
    531516}
    532517
     
    547532        if ( type ) type->print( os, indent + 2 );
    548533        if ( initializer ) initializer->print( os, indent + 2 );
    549 }
    550 
    551 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    552 
    553 UntypedValofExpr::~UntypedValofExpr() { delete body; }
    554 
    555 void UntypedValofExpr::print( std::ostream &os, int indent ) const {
    556         os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl;
    557         if ( get_body() != 0 )
    558                 get_body()->print( os, indent + 2 );
    559534}
    560535
  • src/SynTree/Expression.h

    radd7117 rf5e81d1  
    595595};
    596596
    597 /// ConstructorExpr represents the use of a constructor in an expression context, e.g. int * x = malloc() { 5 };
    598 class ConstructorExpr : public Expression {
    599 public:
    600         ConstructorExpr( Expression * callExpr );
    601         ConstructorExpr( const ConstructorExpr & other );
    602         ~ConstructorExpr();
    603 
    604         Expression *get_callExpr() const { return callExpr; }
    605         void set_callExpr( Expression *newValue ) { callExpr = newValue; }
    606 
    607         virtual ConstructorExpr *clone() const { return new ConstructorExpr( *this ); }
    608         virtual void accept( Visitor &v ) { v.visit( this ); }
    609         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    610         virtual void print( std::ostream &os, int indent = 0 ) const;
    611 private:
    612         Expression * callExpr;
     597/// ValofExpr represents a GCC 'lambda expression'
     598class UntypedValofExpr : public Expression {
     599  public:
     600        UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}
     601        UntypedValofExpr( const UntypedValofExpr & other );
     602        virtual ~UntypedValofExpr();
     603
     604        Expression *get_value();
     605        Statement *get_body() const { return body; }
     606
     607        virtual UntypedValofExpr *clone() const { return new UntypedValofExpr( *this ); }
     608        virtual void accept( Visitor &v ) { v.visit( this ); }
     609        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     610        virtual void print( std::ostream &os, int indent = 0 ) const;
     611  private:
     612        Statement *body;
    613613};
    614614
     
    635635};
    636636
    637 /// ValofExpr represents a GCC 'lambda expression'
    638 class UntypedValofExpr : public Expression {
    639   public:
    640         UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}
    641         UntypedValofExpr( const UntypedValofExpr & other );
    642         virtual ~UntypedValofExpr();
    643 
    644         Expression *get_value();
    645         Statement *get_body() const { return body; }
    646 
    647         virtual UntypedValofExpr *clone() const { return new UntypedValofExpr( *this ); }
    648         virtual void accept( Visitor &v ) { v.visit( this ); }
    649         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    650         virtual void print( std::ostream &os, int indent = 0 ) const;
    651   private:
    652         Statement *body;
    653 };
    654 
    655 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10'
    656637class RangeExpr : public Expression {
    657638  public:
  • src/SynTree/Mutator.cc

    radd7117 rf5e81d1  
    340340}
    341341
    342 Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) {
    343         mutateAll( ctorExpr->get_results(), *this );
    344         ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) );
    345         return ctorExpr;
     342Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
     343        mutateAll( valofExpr->get_results(), *this );
     344        return valofExpr;
    346345}
    347346
     
    351350        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
    352351        return compLitExpr;
    353 }
    354 
    355 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
    356         mutateAll( valofExpr->get_results(), *this );
    357         return valofExpr;
    358352}
    359353
  • src/SynTree/Mutator.h

    radd7117 rf5e81d1  
    7676        virtual Expression* mutate( AsmExpr *asmExpr );
    7777        virtual Expression* mutate( ImplicitCopyCtorExpr *impCpCtorExpr );
    78         virtual Expression* mutate( ConstructorExpr *ctorExpr );
     78        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7979        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
    80         virtual Expression* mutate( UntypedValofExpr *valofExpr );
    8180        virtual Expression* mutate( RangeExpr *rangeExpr );
    8281        virtual Expression* mutate( TupleIndexExpr *tupleExpr );
  • src/SynTree/SynTree.h

    radd7117 rf5e81d1  
    8181class AsmExpr;
    8282class ImplicitCopyCtorExpr;
    83 class ConstructorExpr;
     83class UntypedValofExpr;
    8484class CompoundLiteralExpr;
    85 class UntypedValofExpr;
    8685class RangeExpr;
    8786class TupleIndexExpr;
  • src/SynTree/Visitor.cc

    radd7117 rf5e81d1  
    288288}
    289289
    290 void Visitor::visit( ConstructorExpr * ctorExpr ) {
    291         acceptAll( ctorExpr->get_results(), *this );
    292         maybeAccept( ctorExpr->get_callExpr(), *this );
     290void Visitor::visit( UntypedValofExpr *valofExpr ) {
     291        acceptAll( valofExpr->get_results(), *this );
     292        maybeAccept( valofExpr->get_body(), *this );
    293293}
    294294
     
    297297        maybeAccept( compLitExpr->get_type(), *this );
    298298        maybeAccept( compLitExpr->get_initializer(), *this );
    299 }
    300 
    301 void Visitor::visit( UntypedValofExpr *valofExpr ) {
    302         acceptAll( valofExpr->get_results(), *this );
    303         maybeAccept( valofExpr->get_body(), *this );
    304299}
    305300
  • src/SynTree/Visitor.h

    radd7117 rf5e81d1  
    7676        virtual void visit( AsmExpr *asmExpr );
    7777        virtual void visit( ImplicitCopyCtorExpr *impCpCtorExpr );
    78         virtual void visit( ConstructorExpr * ctorExpr );
     78        virtual void visit( UntypedValofExpr *valofExpr );
    7979        virtual void visit( CompoundLiteralExpr *compLitExpr );
    80         virtual void visit( UntypedValofExpr *valofExpr );
    8180        virtual void visit( RangeExpr *rangeExpr );
    8281        virtual void visit( TupleIndexExpr *tupleExpr );
  • src/include/assert.h

    radd7117 rf5e81d1  
    2222#define assertf(expr, fmt, ...) ((expr) ? static_cast<void>(0) : __assert_fail_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ))
    2323
    24 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) __attribute__((noreturn));
     24void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... );
    2525
    2626template<typename T, typename U>
  • src/libcfa/prelude.cf

    radd7117 rf5e81d1  
    636636
    637637// default ctor
    638 void    ?{}( _Bool * );
    639 void    ?{}( char * );
    640 void    ?{}( unsigned char * );
    641 void    ?{}( char signed * );
    642 void    ?{}( int short * );
    643 void    ?{}( int short unsigned * );
    644 void    ?{}( signed int * );
    645 void    ?{}( unsigned int * );
    646 void    ?{}( signed long int * );
    647 void    ?{}( unsigned long int * );
    648 void    ?{}( signed long long int * );
    649 void    ?{}( unsigned long long int * );
    650 void    ?{}( float * );
    651 void    ?{}( double * );
    652 void    ?{}( long double * );
    653 void    ?{}( float _Complex * );
    654 void    ?{}( double _Complex * );
    655 void    ?{}( long double _Complex * );
     638void    ?{}( _Bool * ),                         ?{}( volatile _Bool * );
     639void    ?{}( char * ),  ?{}( volatile char * );
     640void    ?{}( unsigned char * ), ?{}( volatile unsigned char * );
     641void    ?{}( char signed * ),                   ?{}( volatile char signed * );
     642void    ?{}( int short * ),                             ?{}( volatile int short * );
     643void    ?{}( int short unsigned * ),    ?{}( volatile int short unsigned * );
     644void    ?{}( signed int * ),                    ?{}( volatile signed int * );
     645void    ?{}( unsigned int * ),                  ?{}( volatile unsigned int * );
     646void    ?{}( signed long int * ),               ?{}( volatile signed long int * );
     647void    ?{}( unsigned long int * ),             ?{}( volatile unsigned long int * );
     648void    ?{}( signed long long int * ),          ?{}( volatile signed long long int * );
     649void    ?{}( unsigned long long int * ),        ?{}( volatile unsigned long long int * );
     650void    ?{}( float * ),                         ?{}( volatile float * );
     651void    ?{}( double * ),                        ?{}( volatile double * );
     652void    ?{}( long double * ),                   ?{}( volatile long double * );
     653void    ?{}( float _Complex * ),                ?{}( volatile float _Complex * );
     654void    ?{}( double _Complex * ),               ?{}( volatile double _Complex * );
     655void    ?{}( long double _Complex * ),          ?{}( volatile long double _Complex * );
    656656
    657657// copy ctor
    658 void    ?{}( _Bool *, _Bool );
    659 void    ?{}( char *, char );
    660 void    ?{}( unsigned char *, unsigned char );
    661 void    ?{}( char signed *, char signed );
    662 void    ?{}( int short *, int short );
    663 void    ?{}( int short unsigned *, int short unsigned );
    664 void    ?{}( signed int *, signed int);
    665 void    ?{}( unsigned int *, unsigned int);
    666 void    ?{}( signed long int *, signed long int);
    667 void    ?{}( unsigned long int *, unsigned long int);
    668 void    ?{}( signed long long int *, signed long long int);
    669 void    ?{}( unsigned long long int *, unsigned long long int);
    670 void    ?{}( float *, float);
    671 void    ?{}( double *, double);
    672 void    ?{}( long double *, long double);
    673 void    ?{}( float _Complex *, float _Complex);
    674 void    ?{}( double _Complex *, double _Complex);
    675 void    ?{}( long double _Complex *, long double _Complex);
     658void    ?{}( _Bool *, _Bool ),                                  ?{}( volatile _Bool *, _Bool );
     659void    ?{}( char *, char ),    ?{}( volatile char *, char );
     660void    ?{}( unsigned char *, unsigned char ),                  ?{}( volatile unsigned char *, unsigned char );
     661void    ?{}( char signed *, char signed ),                      ?{}( volatile char signed *, char signed );
     662void    ?{}( int short *, int short ),                          ?{}( volatile int short *, int short );
     663void    ?{}( int short unsigned *, int short unsigned ),        ?{}( volatile int short unsigned *, int short unsigned );
     664void    ?{}( signed int *, signed int),                         ?{}( volatile signed int *, signed int );
     665void    ?{}( unsigned int *, unsigned int),                     ?{}( volatile unsigned int *, unsigned int );
     666void    ?{}( signed long int *, signed long int),               ?{}( volatile signed long int *, signed long int );
     667void    ?{}( unsigned long int *, unsigned long int),           ?{}( volatile unsigned long int *, unsigned long int );
     668void    ?{}( signed long long int *, signed long long int),     ?{}( volatile signed long long int *, signed long long int );
     669void    ?{}( unsigned long long int *, unsigned long long int), ?{}( volatile unsigned long long int *, unsigned long long int );
     670void    ?{}( float *, float),                                   ?{}( volatile float *, float );
     671void    ?{}( double *, double),                                 ?{}( volatile double *, double );
     672void    ?{}( long double *, long double),                       ?{}( volatile long double *, long double );
     673void    ?{}( float _Complex *, float _Complex),                 ?{}( volatile float _Complex *, float _Complex );
     674void    ?{}( double _Complex *, double _Complex),               ?{}( volatile double _Complex *, double _Complex );
     675void    ?{}( long double _Complex *, long double _Complex),     ?{}( volatile long double _Complex *, long double _Complex );
    676676
    677677// dtor
    678 void    ^?{}( _Bool * );
    679 void    ^?{}( char * );
    680 void    ^?{}( char unsigned * );
    681 void    ^?{}( char signed * );
    682 void    ^?{}( int short * );
    683 void    ^?{}( int short unsigned * );
    684 void    ^?{}( signed int * );
    685 void    ^?{}( unsigned int * );
    686 void    ^?{}( signed long int * );
    687 void    ^?{}( unsigned long int * );
    688 void    ^?{}( signed long long int * );
    689 void    ^?{}( unsigned long long int * );
    690 void    ^?{}( float * );
    691 void    ^?{}( double * );
    692 void    ^?{}( long double * );
    693 void    ^?{}( float _Complex * );
    694 void    ^?{}( double _Complex * );
    695 void    ^?{}( long double _Complex * );
     678void    ^?{}( _Bool * ),                        ^?{}( volatile _Bool * );
     679void    ^?{}( char * ), ^?{}( volatile char * );
     680void    ^?{}( char unsigned * ),                        ^?{}( volatile char unsigned * );
     681void    ^?{}( char signed * ),                  ^?{}( volatile char signed * );
     682void    ^?{}( int short * ),                            ^?{}( volatile int short * );
     683void    ^?{}( int short unsigned * ),   ^?{}( volatile int short unsigned * );
     684void    ^?{}( signed int * ),                   ^?{}( volatile signed int * );
     685void    ^?{}( unsigned int * ),                 ^?{}( volatile unsigned int * );
     686void    ^?{}( signed long int * ),              ^?{}( volatile signed long int * );
     687void    ^?{}( unsigned long int * ),            ^?{}( volatile unsigned long int * );
     688void    ^?{}( signed long long int * ),         ^?{}( volatile signed long long int * );
     689void    ^?{}( unsigned long long int * ),       ^?{}( volatile unsigned long long int * );
     690void    ^?{}( float * ),                        ^?{}( volatile float * );
     691void    ^?{}( double * ),                       ^?{}( volatile double * );
     692void    ^?{}( long double * ),                  ^?{}( volatile long double * );
     693void    ^?{}( float _Complex * ),               ^?{}( volatile float _Complex * );
     694void    ^?{}( double _Complex * ),              ^?{}( volatile double _Complex * );
     695void    ^?{}( long double _Complex * ),         ^?{}( volatile long double _Complex * );
    696696
    697697// // default ctor
     
    719719
    720720forall( dtype DT ) void ?{}(                 DT *          *,                   DT * );
     721forall( dtype DT ) void ?{}(                 DT * volatile *,                   DT * );
    721722forall( dtype DT ) void ?{}( const           DT *          *,                   DT * );
     723forall( dtype DT ) void ?{}( const           DT * volatile *,                   DT * );
    722724forall( dtype DT ) void ?{}( const           DT *          *, const             DT * );
     725forall( dtype DT ) void ?{}( const           DT * volatile *, const             DT * );
    723726forall( dtype DT ) void ?{}(       volatile  DT *          *,                   DT * );
     727forall( dtype DT ) void ?{}(       volatile  DT * volatile *,                   DT * );
    724728forall( dtype DT ) void ?{}(       volatile  DT *          *,       volatile    DT * );
     729forall( dtype DT ) void ?{}(       volatile  DT * volatile *,       volatile    DT * );
    725730
    726731forall( dtype DT ) void ?{}( const volatile  DT *          *,                   DT * );
     732forall( dtype DT ) void ?{}( const volatile  DT * volatile *,                   DT * );
    727733forall( dtype DT ) void ?{}( const volatile  DT *          *, const             DT * );
     734forall( dtype DT ) void ?{}( const volatile  DT * volatile *, const             DT * );
    728735forall( dtype DT ) void ?{}( const volatile  DT *          *,       volatile    DT * );
     736forall( dtype DT ) void ?{}( const volatile  DT * volatile *,       volatile    DT * );
    729737forall( dtype DT ) void ?{}( const volatile  DT *          *, const volatile    DT * );
     738forall( dtype DT ) void ?{}( const volatile  DT * volatile *, const volatile    DT * );
    730739
    731740forall( dtype DT ) void ?{}(                 DT *          *,                   void * );
     741forall( dtype DT ) void ?{}(                 DT * volatile *,                   void * );
    732742forall( dtype DT ) void ?{}( const           DT *          *,                   void * );
     743forall( dtype DT ) void ?{}( const           DT * volatile *,                   void * );
    733744forall( dtype DT ) void ?{}( const           DT *          *, const             void * );
     745forall( dtype DT ) void ?{}( const           DT * volatile *, const             void * );
    734746forall( dtype DT ) void ?{}(       volatile  DT *          *,                   void * );
     747forall( dtype DT ) void ?{}(       volatile  DT * volatile *,                   void * );
    735748forall( dtype DT ) void ?{}(       volatile  DT *          *,       volatile    void * );
     749forall( dtype DT ) void ?{}(       volatile  DT * volatile *,       volatile    void * );
    736750
    737751forall( dtype DT ) void ?{}( const volatile  DT *          *,                   void * );
     752forall( dtype DT ) void ?{}( const volatile  DT * volatile *,                   void * );
    738753forall( dtype DT ) void ?{}( const volatile  DT *          *, const             void * );
     754forall( dtype DT ) void ?{}( const volatile  DT * volatile *, const             void * );
    739755forall( dtype DT ) void ?{}( const volatile  DT *          *,       volatile    void * );
     756forall( dtype DT ) void ?{}( const volatile  DT * volatile *,       volatile    void * );
    740757forall( dtype DT ) void ?{}( const volatile  DT *          *, const volatile    void * );
     758forall( dtype DT ) void ?{}( const volatile  DT * volatile *, const volatile    void * );
    741759
    742760forall( dtype DT ) void ?{}(                 void *          *,                 DT * );
     761forall( dtype DT ) void ?{}(                 void * volatile *,                 DT * );
    743762forall( dtype DT ) void ?{}( const           void *          *,                 DT * );
     763forall( dtype DT ) void ?{}( const           void * volatile *,                 DT * );
    744764forall( dtype DT ) void ?{}( const           void *          *, const           DT * );
     765forall( dtype DT ) void ?{}( const           void * volatile *, const           DT * );
    745766forall( dtype DT ) void ?{}(        volatile void *          *,                 DT * );
     767forall( dtype DT ) void ?{}(        volatile void * volatile *,                 DT * );
    746768forall( dtype DT ) void ?{}(        volatile void *          *,       volatile  DT * );
     769forall( dtype DT ) void ?{}(        volatile void * volatile *,       volatile  DT * );
    747770forall( dtype DT ) void ?{}( const volatile void *           *,                 DT * );
     771forall( dtype DT ) void ?{}( const volatile void * volatile *,                  DT * );
    748772forall( dtype DT ) void ?{}( const volatile void *           *, const           DT * );
     773forall( dtype DT ) void ?{}( const volatile void * volatile *, const            DT * );
    749774forall( dtype DT ) void ?{}( const volatile void *           *,       volatile  DT * );
     775forall( dtype DT ) void ?{}( const volatile void * volatile *,        volatile  DT * );
    750776forall( dtype DT ) void ?{}( const volatile void *           *, const volatile  DT * );
     777forall( dtype DT ) void ?{}( const volatile void * volatile *, const volatile   DT * );
    751778
    752779void    ?{}(                void *          *,                void * );
     780void    ?{}(                void * volatile *,                void * );
    753781void    ?{}( const          void *          *,                void * );
     782void    ?{}( const          void * volatile *,                void * );
    754783void    ?{}( const          void *          *, const          void * );
     784void    ?{}( const          void * volatile *, const          void * );
    755785void    ?{}(       volatile void *          *,                void * );
     786void    ?{}(       volatile void * volatile *,                void * );
    756787void    ?{}(       volatile void *          *,       volatile void * );
     788void    ?{}(       volatile void * volatile *,       volatile void * );
    757789void    ?{}( const volatile void *          *,                void * );
     790void    ?{}( const volatile void * volatile *,                void * );
    758791void    ?{}( const volatile void *          *, const          void * );
     792void    ?{}( const volatile void * volatile *, const          void * );
    759793void    ?{}( const volatile void *          *,       volatile void * );
     794void    ?{}( const volatile void * volatile *,       volatile void * );
    760795void    ?{}( const volatile void *          *, const volatile void * );
     796void    ?{}( const volatile void * volatile *, const volatile void * );
    761797
    762798//forall( dtype DT ) void ?{}(              DT *          *, forall( dtype DT2 ) const DT2 * );
    763799//forall( dtype DT ) void ?{}(              DT * volatile *, forall( dtype DT2 ) const DT2 * );
    764800forall( dtype DT ) void ?{}( const          DT *          *, forall( dtype DT2 ) const DT2 * );
     801forall( dtype DT ) void ?{}( const          DT * volatile *, forall( dtype DT2 ) const DT2 * );
    765802//forall( dtype DT ) void ?{}( volatile     DT *          *, forall( dtype DT2 ) const DT2 * );
    766803//forall( dtype DT ) void ?{}( volatile     DT * volatile *, forall( dtype DT2 ) const DT2 * );
    767804forall( dtype DT ) void ?{}( const volatile DT *          *, forall( dtype DT2 ) const DT2 * );
     805forall( dtype DT ) void ?{}( const volatile DT * volatile *, forall( dtype DT2 ) const DT2 * );
    768806
    769807forall( ftype FT ) void ?{}( FT *          *, forall( ftype FT2 ) FT2 * );
     808forall( ftype FT ) void ?{}( FT * volatile *, forall( ftype FT2 ) FT2 * );
    770809
    771810// default ctors
    772811forall( ftype FT ) void ?{}( FT *          * );
     812forall( ftype FT ) void ?{}( FT * volatile * );
    773813
    774814forall( dtype DT ) void ?{}(                 DT *          *);
     815forall( dtype DT ) void ?{}(                 DT * volatile *);
    775816forall( dtype DT ) void ?{}( const           DT *          *);
     817forall( dtype DT ) void ?{}( const           DT * volatile *);
    776818forall( dtype DT ) void ?{}(       volatile  DT *          *);
     819forall( dtype DT ) void ?{}(       volatile  DT * volatile *);
    777820forall( dtype DT ) void ?{}( const volatile  DT *          *);
     821forall( dtype DT ) void ?{}( const volatile  DT * volatile *);
    778822
    779823void    ?{}(                void *          *);
     824void    ?{}(                void * volatile *);
    780825void    ?{}( const          void *          *);
     826void    ?{}( const          void * volatile *);
    781827void    ?{}(       volatile void *          *);
     828void    ?{}(       volatile void * volatile *);
    782829void    ?{}( const volatile void *          *);
     830void    ?{}( const volatile void * volatile *);
    783831
    784832// dtors
    785833forall( ftype FT ) void ^?{}( FT *         * );
     834forall( ftype FT ) void ^?{}( FT * volatile * );
    786835
    787836forall( dtype DT ) void ^?{}(                DT *          *);
     837forall( dtype DT ) void ^?{}(                DT * volatile *);
    788838forall( dtype DT ) void ^?{}( const          DT *          *);
     839forall( dtype DT ) void ^?{}( const          DT * volatile *);
    789840forall( dtype DT ) void ^?{}(      volatile  DT *          *);
     841forall( dtype DT ) void ^?{}(      volatile  DT * volatile *);
    790842forall( dtype DT ) void ^?{}( const volatile  DT *         *);
     843forall( dtype DT ) void ^?{}( const volatile  DT * volatile *);
    791844
    792845void    ^?{}(               void *          *);
     846void    ^?{}(               void * volatile *);
    793847void    ^?{}( const         void *          *);
     848void    ^?{}( const         void * volatile *);
    794849void    ^?{}(      volatile void *          *);
     850void    ^?{}(      volatile void * volatile *);
    795851void    ^?{}( const volatile void *         *);
     852void    ^?{}( const volatile void * volatile *);
    796853
    797854// Local Variables: //
  • src/tests/.expect/declarationErrors.txt

    radd7117 rf5e81d1  
    11CFA Version 1.0.0 (debug)
    2 Error: duplicate static in declaration of x1: static const volatile short int
     2Error: invalid combination of storage classes in declaration of x9: static const volatile short int
    33
    4 Error: multiple extern & static in declaration of x2: extern const volatile short int
    5 
    6 Error: multiple extern & auto, multiple extern & static, multiple extern & static, duplicate extern in declaration of x3: extern const volatile short int
    7 
    8 Error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
     4Error: invalid combination of storage classes in declaration of x18: static const volatile instance of const volatile struct __anonymous0
    95  with members
    106   with body
    117
    128
    13 Error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
     9Error: duplicate qualifier volatile in declaration of x19: static const volatile instance of const volatile struct __anonymous1
    1410  with members
    1511   with body
    1612
    1713
    18 Error: duplicate static in declaration of x6: static const volatile instance of type Int
     14Error: invalid combination of storage classes in declaration of x28: static const volatile instance of type Int
    1915
    20 Error: duplicate const in declaration of f01: static inline function
     16Error: duplicate qualifier const in declaration of f01: static inline function
    2117  with no parameters
    2218  returning const volatile int
    2319
    2420
    25 Error: duplicate volatile in declaration of f02: static inline function
     21Error: duplicate qualifier volatile in declaration of f02: static inline function
    2622  with no parameters
    2723  returning const volatile int
    2824
    2925
    30 Error: duplicate const in declaration of f03: static inline function
     26Error: duplicate qualifier const in declaration of f03: static inline function
    3127  with no parameters
    3228  returning const volatile int
    3329
    3430
    35 Error: duplicate volatile in declaration of f04: static inline function
     31Error: duplicate qualifier volatile in declaration of f04: static inline function
    3632  with no parameters
    3733  returning const volatile int
    3834
    3935
    40 Error: duplicate const in declaration of f05: static inline function
     36Error: duplicate qualifier const in declaration of f05: static inline function
    4137  with no parameters
    4238  returning const volatile int
    4339
    4440
    45 Error: duplicate volatile in declaration of f06: static inline function
     41Error: duplicate qualifier volatile in declaration of f06: static inline function
    4642  with no parameters
    4743  returning const volatile int
    4844
    4945
    50 Error: duplicate const in declaration of f07: static inline function
     46Error: duplicate qualifier const in declaration of f07: static inline function
    5147  with no parameters
    5248  returning const volatile int
    5349
    5450
    55 Error: duplicate const, duplicate volatile in declaration of f08: static inline function
     51Error: duplicate qualifier const, volatile in declaration of f08: static inline function
    5652  with no parameters
    5753  returning const volatile int
    5854
    5955
    60 Error: duplicate const, duplicate volatile in declaration of f09: static inline function
     56Error: duplicate qualifier const, volatile in declaration of f09: static inline function
    6157  with no parameters
    6258  returning const volatile int
    6359
    6460
    65 Error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
     61Error: duplicate qualifier const, volatile in declaration of f09: static inline function
    6662  with no parameters
    67   returning const restrict volatile _Atomic int
     63  returning const volatile int
    6864
    6965
  • src/tests/declarationErrors.c

    radd7117 rf5e81d1  
    1010// Created On       : Wed Aug 17 08:23:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  9 22:57:52 2016
    13 // Update Count     : 31
     12// Last Modified On : Thu Aug 25 18:16:40 2016
     13// Update Count     : 5
    1414//
    1515
    16 static short int volatile static const x1;                              // duplicate static
    17 extern short int static volatile const x2;                              // multiple extern & static
    18 extern short int auto static volatile static extern const x3; // duplicate and multiple storage classes
    19 struct { int i; } const static volatile static x4;              // duplicate static
    20 struct { int i; } const static volatile const static volatile x5; // duplicate static & const & volatile
     16static short int volatile static const x9;                              // duplicate static
     17struct { int i; } const static volatile static x18;             // duplicate static
     18struct { int i; } const static volatile static volatile x19; // duplicate static & volatile
    2119typedef int Int;
    22 static Int volatile static const x6;                                    // duplicate static
     20static Int volatile static const x28;                                   // duplicate static
    2321
    2422const static inline const volatile int f01();                   // duplicate const
     
    2624const inline const volatile int static f03();                   // duplicate const
    2725volatile inline static const volatile int f04();                // duplicate volatile
    28 const static int const inline volatile f05();                   // duplicate const
    29 volatile int static const volatile inline f06();                // duplicate volatile
    30 const static const int volatile inline f07();                   // duplicate const
    31 volatile static const int inline const volatile f08();  // duplicate volatile
     26const static const inline volatile int f05();                   // duplicate const
     27volatile static const volatile inline int f06();                // duplicate volatile
     28const static const volatile int inline f07();                   // duplicate const
     29volatile static const int inline const volatile f08();          // duplicate volatile
    3230
    33 volatile static const int inline const volatile f09();  // duplicate volatile
    34 _Atomic _Atomic _Atomic volatile restrict static const const int inline restrict const volatile f09();  // duplicate volatile
     31volatile static const int inline const volatile f09();          // duplicate volatile
     32volatile static const int inline const volatile f09();          // duplicate volatile
    3533
    3634//Dummy main
  • src/tests/test.py

    radd7117 rf5e81d1  
    285285# check if the user already passed in a number of jobs for multi-threading
    286286make_flags = environ.get('MAKEFLAGS')
    287 make_jobs_fds = re.search("--jobserver-fds=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
    288 if make_jobs_fds :
    289         tokens = os.read(int(make_jobs_fds.group(1)), 1024)
    290         options.jobs = len(tokens)
    291         os.write(int(make_jobs_fds.group(2)), tokens)
     287make_has_max_jobs = re.search("(-j|--jobs)\s*([0-9]+)", make_flags) if make_flags else None
     288make_max_jobs = make_has_max_jobs.group(2) if make_has_max_jobs else None
     289make_cmd = "make" if make_flags and "-j" in make_flags else "make -j8"
    292290
    293291# make sure we have a valid number of jobs that corresponds to user input
     292options.jobs = int(make_max_jobs) if make_max_jobs else (options.jobs if options.jobs else 1)
    294293if options.jobs <= 0 :
    295294        print('ERROR: Invalid number of jobs', file=sys.stderr)
     
    297296
    298297print('Running on %i cores' % options.jobs)
    299 make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
    300298
    301299# users may want to simply list the tests
Note: See TracChangeset for help on using the changeset viewer.